GNOME Bugzilla – Bug 751793
DnD: Look up past insensitive widgets for the DnD drop site
Last modified: 2015-07-06 16:20:35 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?
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.
(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...
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.
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
Looks fairly logical from my side.
Review of attachment 306545 [details] [review]: lets go with this, then
Attachment 306545 [details] pushed as 3f8982a - gtkdnd: Traverse across insensitive widgets