listbase: Cancel rubberband if not handling drag
authorAntónio Fernandes <antoniof@gnome.org>
Fri, 24 Jun 2022 08:05:29 +0000 (09:05 +0100)
committerCorey Berla <corey@berla.me>
Mon, 19 Dec 2022 07:31:31 +0000 (21:31 -1000)
commitefbd2289405553c6dad96a99501203f330896340
treefb183e63b43ca3c8143313c466a6be49b13a73c8
parent146cf0bdd4a4f3dda6a330aa68774b27dc2fbb11
listbase: Cancel rubberband if not handling drag

If the drag events are claimed by another gesture (e.g. a GtkDragSource
in an item widget), list base still commits a rubberband selection, for
a rubberband which wasn't even visible yet. This is a problem for the
GNOME Files application which needs both rubberbanding and drag-n-drop.

My previous fix[0] was enough for the case where the event sequence is
claimed right before the first GtkDragGesture::drag-update emission,
but it's useless if the event is claimed later (e.g. after the drag
treashold), because a rubberband already exists by that time.

Therefore, the complete solution requres checking whether the event
sequence is no longer being handled by our gesture, and commit the
selection changes only if it is, but otherwise cleanup the rubberband.

This is what GtkFlowBox does already, so let's do the same here.

[0] commit dc4540fae98d4f707ce1030b0f8d161c987646e0
gtk/gtklistbase.c