GNOME Bugzilla – Bug 749679
Avoid device position queries during DnD
Last modified: 2015-05-21 16:13:19 UTC
Some widgets are using gdk_window_get_device_position() and alike in response to DnD motion events (mainly in order to trigger scrolling). When this happens on a client running in Xwayland, the pointer is grabbed by the compositor on behalf of the drag source, so Xwayland loses temporarily sight of the pointer and places it at 0/0, which makes all device position queries bogus during DnD. I'm attaching some patches to avoid this situation in the places I spotted.
Created attachment 303753 [details] [review] textview: Avoid usage of gdk_window_get_device_position() during DnD Just use the last coordinates given on XdndPosition/drag_motion() in order to trigger scrolling. When running on Xwayland, the pointer position is unknown at this stage on the X11 side, so the coordinates given here are bogus. This change avoids both roundtrips and this situation.
Created attachment 303754 [details] [review] treeview: Avoid usage of gdk_window_get_device_position() during DnD Just use the last coordinates given on XdndPosition/drag_motion() in order to trigger scrolling. When running on Xwayland, the pointer position is unknown at this stage on the X11 side, so the coordinates given here are bogus. This change avoids both roundtrips and this situation.
Created attachment 303755 [details] [review] iconview: Avoid usage of gdk_window_get_device_position() during DnD Just use the last coordinates given on XdndPosition/drag_motion() in order to trigger scrolling. When running on Xwayland, the pointer position is unknown at this stage on the X11 side, so the coordinates given here are bogus. This change avoids both roundtrips and this situation.
Review of attachment 303753 [details] [review]: sure. less code too!
Review of attachment 303754 [details] [review]: ::: gtk/gtktreeview.c @@ +4200,3 @@ + y = tree_view->priv->event_last_y; + gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, 0, y, + NULL, &y); I tend to avoid wrapping like this nowadays, and rather bend the 80col limit...
Review of attachment 303755 [details] [review]: ok. less code too!
Attachment 303753 [details] pushed as b54031d - textview: Avoid usage of gdk_window_get_device_position() during DnD Attachment 303754 [details] pushed as b666f14 - treeview: Avoid usage of gdk_window_get_device_position() during DnD Attachment 303755 [details] pushed as 61cc107 - iconview: Avoid usage of gdk_window_get_device_position() during DnD