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 776306 - flowbox: Sometimes emits child-activated during rubberband selection
flowbox: Sometimes emits child-activated during rubberband selection
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.22.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 774914
 
 
Reported: 2016-12-20 11:26 UTC by Debarshi Ray
Modified: 2017-01-12 15:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
flowbox: Don't emit child-activated while dragging the pointer (1.50 KB, patch)
2016-12-20 11:59 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2016-12-20 11:26:40 UTC
Run ./tests/testflowbox with:
  * activate on single click = TRUE
  * selection mode = MULTIPLE

Click (press and release) any one of the children. It will emit 'child-activated', which is fine.

Now press the mouse button on the same child near one of its edges, and hold it for a bit for the multi-press gesture to emit 'stopped'. Start moving the mouse without releasing the button inside the child. Move enough for the drag gesture to kick in without leaving the child and then stop. You will see that it emitted 'child-activated' even though you never released the button.

It is a problem for GdMainIconBox (see bug 774914) where 'child-activated' on a selected child toggles the selection. For example, you have selected three images in gnome-photos and you initiate a drag-and-drop. Due to 'child-activated' being emitted midway through the DnD, you will lose one of the images from the selection.

This is caused by the drag gesture's 'update' handler claiming the sequence. That invokes the multi-press gesture's 'released' handler, which emits 'child-activated'. One solution is to cancel the multi-press's 'released' by listening to its 'stopped'.

Related to this ...

What is the purpose of priv->active_child_active, and why do we queue a draw when it is updated in gtk_flow_box_update_active? It seems priv->active_child_active is meant to track whether the mouse pointer is within the same child between the button being pressed and released. If that's all, then why the re-draw?
Comment 1 Debarshi Ray 2016-12-20 11:59:49 UTC
Created attachment 342257 [details] [review]
flowbox: Don't emit child-activated while dragging the pointer
Comment 2 Matthias Clasen 2016-12-20 13:15:58 UTC
Review of attachment 342257 [details] [review]:

ok
Comment 3 Debarshi Ray 2016-12-20 17:48:44 UTC
Comment on attachment 342257 [details] [review]
flowbox: Don't emit child-activated while dragging the pointer

Pushed to master and gtk-3-22.