Closed Bug 407982 Opened 17 years ago Closed 17 years ago

More events should walk the Gdk tree instead of being dropped

Categories

(Core :: Widget: Gtk, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9beta3

People

(Reporter: ventnor.bugzilla, Assigned: ventnor.bugzilla)

Details

(Keywords: platform-parity)

Attachments

(1 file, 3 obsolete files)

Attached patch Patch (obsolete) — Splinter Review
We fixed the problem where you couldn't scroll while the cursor is over a plugin in bug 386687. More of these events should take the same approach; specifically, mouse events. This is especially problematic when autoscrolling because the speed/direction may not change (mousemove) or you can't cancel it with a click (mousedown/mouseup). This may (I don't know for certain) also allow Linux to receive mouse events on the DOM from plugin windows.
Attachment #292686 - Flags: superreview?(roc)
Attachment #292686 - Flags: review?(roc)
+        if (aEvent->window == mDrawingarea->inner_window) {
+            event.refPoint.x = nscoord(aEvent->x);
+            event.refPoint.y = nscoord(aEvent->y);
+        } else {
+            nsRect windowRect;
+            ScreenToWidget(nsRect(nscoord(aEvent->x_root), nscoord(aEvent->y_root), 1, 1), windowRect);
+
+            event.refPoint.x = windowRect.x;
+            event.refPoint.y = windowRect.y;
+        }

This code should be factored out and shared.

+    nsRefPtr<nsWindow> window;
+    GdkWindow *gdkWindow = event->window;
+    while (!(window = get_window_for_gdk_window(gdkWindow))) {
+        // See scroll_event_cb. We need this to get events even when cursor is over plugins.
+        gdkWindow = gdk_window_get_parent(gdkWindow);
+        if (!gdkWindow)
+            return FALSE;
+    }

This loop should be factored out and shared too. Something like
already_AddRefed<nsWindow> GetEventTargetWindow(GdkEvent*) or something.
Attached patch Patch 2 (obsolete) — Splinter Review
The first part can't be factored out because GDK event structures are evil, but the second part can be happily refactored.
Attachment #292686 - Attachment is obsolete: true
Attachment #292827 - Flags: superreview?(roc)
Attachment #292827 - Flags: review?(roc)
Attachment #292686 - Flags: superreview?(roc)
Attachment #292686 - Flags: review?(roc)
+static nsWindow* get_first_nswindow_for_gdkwindow (GdkWindow *aGdkWindow);

Call this GetFirstNSWindowForGDKWindow

+    nsRefPtr<nsWindow> window = get_first_nswindow_for_gdkwindow(gdkWindow);

'window' should just be an nsWindow* (4 occurrences)
Attached patch Patch 2.1 (obsolete) — Splinter Review
Attachment #292827 - Attachment is obsolete: true
Attachment #292828 - Flags: superreview?(roc)
Attachment #292828 - Flags: review?(roc)
Attachment #292827 - Flags: superreview?(roc)
Attachment #292827 - Flags: review?(roc)
Attached patch Patch 2.2Splinter Review
Forgot about unnecessary local variable during refactoring.
Attachment #292828 - Attachment is obsolete: true
Attachment #292829 - Flags: superreview?(roc)
Attachment #292829 - Flags: review?(roc)
Attachment #292828 - Flags: superreview?(roc)
Attachment #292828 - Flags: review?(roc)
Attachment #292829 - Flags: superreview?(roc)
Attachment #292829 - Flags: superreview+
Attachment #292829 - Flags: review?(roc)
Attachment #292829 - Flags: review+
Attachment #292829 - Flags: approval1.9?
Attachment #292829 - Flags: approval1.9? → approval1.9+
Keywords: checkin-needed
Checking in widget/src/gtk2/nsCommonWidget.cpp;
/cvsroot/mozilla/widget/src/gtk2/nsCommonWidget.cpp,v  <--  nsCommonWidget.cpp
new revision: 1.34; previous revision: 1.33
done
Checking in widget/src/gtk2/nsCommonWidget.h;
/cvsroot/mozilla/widget/src/gtk2/nsCommonWidget.h,v  <--  nsCommonWidget.h
new revision: 1.26; previous revision: 1.25
done
Checking in widget/src/gtk2/nsWindow.cpp;
/cvsroot/mozilla/widget/src/gtk2/nsWindow.cpp,v  <--  nsWindow.cpp
new revision: 1.242; previous revision: 1.241
done
Checking in widget/src/gtk2/nsWindow.h;
/cvsroot/mozilla/widget/src/gtk2/nsWindow.h,v  <--  nsWindow.h
new revision: 1.81; previous revision: 1.80
done
Status: NEW → RESOLVED
Closed: 17 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9 M11
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: