GNOME Bugzilla – Bug 750993
non-modal popovers within modal popovers are non interactive
Last modified: 2015-06-17 13:58:17 UTC
Modal GtkPopovers are now able to stack just fine, although there's still glitches with non-modal popovers within modal popovers (this issue extends to GtkTextHandle). When this happens the gtk+ grab takes the events away from the non-modal popover, and into the modal popover (which usually dismisses everything). I'm attaching a couple of patches that let gtkmain.c treat child popovers like child widgets, and let events go unaffected by the grab. Note that this will probably break with non-modal inside non-modal inside modal, I'll let that account as "insanity" though.
Created attachment 305289 [details] [review] window: Add concept of popover "parent" This will be the widget that the popover relates to (::pointing-to in GtkPopover, ::parent in GtkTextHandle). Additional API to check the popover/parent relationship between widgets has been added, which will be useful wherever this is necessary in a generic manner.
Created attachment 305290 [details] [review] gtkmain: Ignore grab for events in child popovers Popovers may be spawn when there's GTK+ grabs somewhere else (eg. text selection popover/handles in an entry in a modal popover). When this happens, events go to the grab widget (in this case the modal popover) and are effectively ignored by the event widget, even though it's can be conceptually a child of the grab widget. To get away with this, tweak a bit gtk_main_do_event(), so events going to popovers that are related to grab_widget or a child of it are received, as it would happen with regular children of grab_widget.
Review of attachment 305290 [details] [review]: ::: gtk/gtkmain.c @@ +1481,3 @@ + return FALSE; + + toplevel = gtk_widget_get_ancestor (event_widget, GTK_TYPE_WINDOW); Could just use gtk_widget_get_toplevel here ?
Works nicely in the widget-factory testcase - this is probably the best we can do unless we actually fix the widget hierarchy for popovers.
(In reply to Matthias Clasen from comment #3) > Review of attachment 305290 [details] [review] [review]: > > ::: gtk/gtkmain.c > @@ +1481,3 @@ > + return FALSE; > + > + toplevel = gtk_widget_get_ancestor (event_widget, GTK_TYPE_WINDOW); > > Could just use gtk_widget_get_toplevel here ? This is consistent with the parent that GtkPopover and GtkTextHandle set (IIRC, so local and remote XEmbed works consistently). If we change this, should be done all through. I'm attaching newer patches that move the regular widget hierarchy checks to gtkmain.c, this makes the private GtkWindow api more concise IMO, and gets rid of the confuse naming. I've done nothing about the issue above though.
Created attachment 305308 [details] [review] window: Add concept of popover "parent" This will be the widget that the popover relates to (::pointing-to in GtkPopover, ::parent in GtkTextHandle). Additional API to check the popover/parent relationship between widgets has been added, which will be useful wherever this is necessary in a generic manner.
Created attachment 305309 [details] [review] gtkmain: Ignore grab for events in child popovers Popovers may be spawn when there's GTK+ grabs somewhere else (eg. text selection popover/handles in an entry in a modal popover). When this happens, events go to the grab widget (in this case the modal popover) and are effectively ignored by the event widget, even though it's can be conceptually a child of the grab widget. To get away with this, tweak a bit gtk_main_do_event(), so events going to popovers that are related to grab_widget or a child of it are received, as it would happen with regular children of grab_widget.
Review of attachment 305308 [details] [review]: Other than that, looks good to me. ::: gtk/gtkwindow.c @@ +11949,3 @@ } +/** Should make this /*< private > instead of /** to avoid confusing poor gtk-doc.
Review of attachment 305309 [details] [review]: ok
(In reply to Matthias Clasen from comment #8) > Review of attachment 305308 [details] [review] [review]: > > Other than that, looks good to me. > > ::: gtk/gtkwindow.c > @@ +11949,3 @@ > } > > +/** > > Should make this > > /*< private > > > instead of > > /** > > to avoid confusing poor gtk-doc. Oops right, added the comments through the emacs macro and forgot to at least remove the extra asterisk, changing that and pushing.
Attachment 305308 [details] pushed as 76dc8ac - window: Add concept of popover "parent" Attachment 305309 [details] pushed as 77d429b - gtkmain: Ignore grab for events in child popovers