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 751793 - DnD: Look up past insensitive widgets for the DnD drop site
DnD: Look up past insensitive widgets for the DnD drop site
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-07-01 17:16 UTC by Carlos Garnacho
Modified: 2015-07-06 16:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtkdnd: Traverse across insensitive widgets (1.44 KB, patch)
2015-07-01 17:16 UTC, Carlos Garnacho
accepted-commit_now Details | Review

Description Carlos Garnacho 2015-07-01 17:16:06 UTC
GtkPlacesSidebar tries to manage sensitivity of rows when performing DnD over it, in order to further indicate those are not valid drop targets. This leads to some interesting loops:

- pointer moves within an insensitive row
- gtkdnd finds "no widget", emits ::drag-leave
- GtkPlacesSidebar::drag-leave marks all widgets sensitive again
- gtkdnd finds the sidebar, emits ::drag-motion
- rows are marked insensitive
- ...

This case is unusual, but legit I'd say, given that we try to find the widget bottom up, I'd say we should make it go through insensitive widgets, so we still allow parents to handle DnD.

PS. If I'm reading the code correctly, we would allow DnD in sensitive children of insensitive widgets, that strikes as odd to me, maybe we should check the state flags which at least propagate in the hierarchy?
Comment 1 Carlos Garnacho 2015-07-01 17:16:43 UTC
Created attachment 306545 [details] [review]
gtkdnd: Traverse across insensitive widgets

The current widget lookup code bails out on insensitive widgets, there's
however legit cases where we want DnD handled by a parent of the insensitive
widget, so just keep going upwards in that case.

We also use now the widget state flags, because get_sensitive() doesn't
propagate across hierarchies, so we could conceivably find a drop site
inside an insensitive widget.
Comment 2 Matthias Clasen 2015-07-01 17:27:37 UTC
(In reply to Carlos Garnacho from comment #0)
> GtkPlacesSidebar tries to manage sensitivity of rows when performing DnD
> over it, in order to further indicate those are not valid drop targets. This
> leads to some interesting loops:
> 
> - pointer moves within an insensitive row
> - gtkdnd finds "no widget", emits ::drag-leave
> - GtkPlacesSidebar::drag-leave marks all widgets sensitive again
> - gtkdnd finds the sidebar, emits ::drag-motion
> - rows are marked insensitive
> - ...
> 
> This case is unusual, but legit I'd say, given that we try to find the
> widget bottom up, I'd say we should make it go through insensitive widgets,
> so we still allow parents to handle DnD.
> 
> PS. If I'm reading the code correctly, we would allow DnD in sensitive
> children of insensitive widgets, that strikes as odd to me, maybe we should
> check the state flags which at least propagate in the hierarchy?

Children of insensitive widgets can not be sensitive, right ? we propagate that state downwards...
Comment 3 Carlos Garnacho 2015-07-01 17:35:30 UTC
Yes, but we were looking for gtk_widget_get_sensitive(), which will probably stay true for all children of the insensitive widget. Keep in mind that gtk_drag_find_widget() starts from the bottommost widget, up to the toplevel.
Comment 4 Matthias Clasen 2015-07-01 17:46:45 UTC
Right.
This is somewhat related to this old bug, I guess: bug 118100
But I guess the suggested change here is fairly harmless and not likely to break things
Comment 5 Carlos Soriano 2015-07-02 11:46:05 UTC
Looks fairly logical from my side.
Comment 6 Matthias Clasen 2015-07-04 22:56:05 UTC
Review of attachment 306545 [details] [review]:

lets go with this, then
Comment 7 Carlos Garnacho 2015-07-06 16:20:35 UTC
Attachment 306545 [details] pushed as 3f8982a - gtkdnd: Traverse across insensitive widgets