Open
Bug 1174378
Opened 10 years ago
Updated 2 years ago
gdk_pointer*() is deprecated in Gtk3
Categories
(Core :: Widget: Gtk, defect, P5)
Core
Widget: Gtk
Tracking
()
NEW
Tracking | Status | |
---|---|---|
firefox41 | --- | affected |
People
(Reporter: hub, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: tpi:+)
Attachments
(1 file, 1 obsolete file)
gdk_pointer* is deprecated in Gtk3
Will attach a patch.
Reporter | ||
Comment 1•10 years ago
|
||
Reporter | ||
Updated•10 years ago
|
Assignee: nobody → hub
Status: NEW → ASSIGNED
Reporter | ||
Updated•10 years ago
|
Attachment #8621936 -
Flags: review?(karlt)
Reporter | ||
Comment 2•10 years ago
|
||
Comment 3•10 years ago
|
||
Comment on attachment 8621936 [details] [diff] [review]
Replace the deprecated pointer API with GdkDevice API. r=
Changing from pointer methods to device methods is not as trivial as this.
gdk_device_manager_get_client_pointer() requires a round trip to the X
server and so should only be used as a last resort. I assume this has not
been optimized because this is not usually the appropriate way to choose the
device.
Also, I assume that the reason for deprecating the pointer methods is to
persuade application developers to use the correct devices.
Usually gdk_event_get_device(), sometimes with
gdk_device_get_associated_device(), is the appropriate way to identify which
device to use.
Note that Gecko is always going to be compiled against headers and run against
libraries that are older than those installed on some developer machines and
so deprecated symbols are pretty much unavoidable. GDK_VERSION_MIN_REQUIRED
and GDK_VERSION_MAX_ALLOWED are provided to deal with this.
If the code changes are not selecting the right device, then I'd prefer to
keep the pointer methods at this stage.
> is_top_level_mouse_exit(GdkWindow* aWindow, GdkEventCrossing *aEvent)
> {
> gint x = gint(aEvent->x_root);
> gint y = gint(aEvent->y_root);
> GdkDisplay* display = gdk_window_get_display(aWindow);
>+#if (MOZ_WIDGET_GTK == 3)
>+ GdkDeviceManager *device_manager = gdk_display_get_device_manager(display);
>+ GdkDevice* device = gdk_device_manager_get_client_pointer(device_manager);
>+ GdkWindow* winAtPt = gdk_device_get_window_at_position(device, &x, &y);
>+#else
> GdkWindow* winAtPt = gdk_display_get_window_at_pointer(display, &x, &y);
>+#endif
The event already knows the device and so gdk_event_get_device() should be
used here.
Similarly for leave_notify_event_cb().
>+#if (MOZ_WIDGET_GTK == 3)
>+ GdkDisplay* display = gdk_window_get_display(mGdkWindow);
>+ GdkDeviceManager *device_manager = gdk_display_get_device_manager(display);
>+ GdkDevice* device = gdk_device_manager_get_client_pointer(device_manager);
>+ retval = gdk_device_grab(device,
Getting the right device here is seriously complicated by the possible
asynchronicity of the way that Gecko grabs the pointer in response to events
triggering the opening of menus, etc, so the appropriate event may no longer
be found by gtk_get_current_event_device().
gdk_device_manager_get_client_pointer() is fine in
SynthesizeNativeMouseEvent().
Attachment #8621936 -
Flags: review?(karlt) → review-
Reporter | ||
Comment 4•10 years ago
|
||
Reporter | ||
Updated•10 years ago
|
Attachment #8621936 -
Attachment is obsolete: true
Reporter | ||
Comment 5•10 years ago
|
||
(In reply to Karl Tomlinson (ni?:karlt) from comment #3)
> >+#if (MOZ_WIDGET_GTK == 3)
> >+ GdkDisplay* display = gdk_window_get_display(mGdkWindow);
> >+ GdkDeviceManager *device_manager = gdk_display_get_device_manager(display);
> >+ GdkDevice* device = gdk_device_manager_get_client_pointer(device_manager);
> >+ retval = gdk_device_grab(device,
>
> Getting the right device here is seriously complicated by the possible
> asynchronicity of the way that Gecko grabs the pointer in response to events
> triggering the opening of menus, etc, so the appropriate event may no longer
> be found by gtk_get_current_event_device().
gdk_pointer_grab() in its current implementation just list all devices from the device manager and if it is a mouse device, call gdk_device_grab on it. Also save them to be able to ungrab them (it is a GdkWindow method).
It doesn't call gdk_device_manager_get_client_pointer() but does call gdk_device_manager_list_devices ()
Seldom different for X11 backend:
https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkdevicemanager-core-x11.c#n711
https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkdevicemanager-core-x11.c#n727
We can use this as a fallback if gtk_get_current_event_device() return NULL.
Updated•9 years ago
|
Updated•8 years ago
|
Whiteboard: tpi:?
Updated•8 years ago
|
Priority: -- → P5
Updated•8 years ago
|
Whiteboard: tpi:? → tpi:+
Updated•8 years ago
|
Blocks: gtk3-pre-3.20
Reporter | ||
Updated•6 years ago
|
Assignee: hub → nobody
Status: ASSIGNED → NEW
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•