After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749679 - Avoid device position queries during DnD
Avoid device position queries during DnD
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-05-21 12:39 UTC by Carlos Garnacho
Modified: 2015-05-21 16:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
textview: Avoid usage of gdk_window_get_device_position() during DnD (4.07 KB, patch)
2015-05-21 12:40 UTC, Carlos Garnacho
accepted-commit_now Details | Review
treeview: Avoid usage of gdk_window_get_device_position() during DnD (2.82 KB, patch)
2015-05-21 12:40 UTC, Carlos Garnacho
accepted-commit_now Details | Review
iconview: Avoid usage of gdk_window_get_device_position() during DnD (3.16 KB, patch)
2015-05-21 12:40 UTC, Carlos Garnacho
accepted-commit_now Details | Review

Description Carlos Garnacho 2015-05-21 12:39:26 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.
Comment 1 Carlos Garnacho 2015-05-21 12:40:08 UTC
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.
Comment 2 Carlos Garnacho 2015-05-21 12:40:13 UTC
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.
Comment 3 Carlos Garnacho 2015-05-21 12:40:18 UTC
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.
Comment 4 Matthias Clasen 2015-05-21 14:34:30 UTC
Review of attachment 303753 [details] [review]:

sure. less code too!
Comment 5 Matthias Clasen 2015-05-21 14:35:42 UTC
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...
Comment 6 Matthias Clasen 2015-05-21 15:21:05 UTC
Review of attachment 303755 [details] [review]:

ok. less code too!
Comment 7 Carlos Garnacho 2015-05-21 16:13:19 UTC
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