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 750741 - Popover spawned from within another popover gets stacked behind the parent
Popover spawned from within another popover gets stacked behind the parent
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkPopover
3.17.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-06-10 19:31 UTC by Marcus Lundblad
Modified: 2015-06-12 19:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test program (683 bytes, application/javascript)
2015-06-10 19:31 UTC, Marcus Lundblad
  Details
window: Avoid rising the window of already shown popovers (1.13 KB, patch)
2015-06-12 13:08 UTC, Carlos Garnacho
committed Details | Review
popover: Avoid hiding modal popovers if another popover is taking focus (1.65 KB, patch)
2015-06-12 13:08 UTC, Carlos Garnacho
committed Details | Review

Description Marcus Lundblad 2015-06-10 19:31:47 UTC
Created attachment 305010 [details]
Test program

When placing a GtkMenuButton spawning a popover inside another popover, the second popover gets drawn behind the first one.

I wrote a small test program in GJS to expose the problem.
Clicking the menubutton in the window will open a popover containing a second menubutton, the popover opened by the second menubutton will appear below the first one.
Comment 1 Carlos Garnacho 2015-06-12 13:08:04 UTC
Created attachment 305145 [details] [review]
window: Avoid rising the window of already shown popovers

This breaks stacking, as popovers are repositioned sort of frequently
(even more after show/hide animations).
Comment 2 Carlos Garnacho 2015-06-12 13:08:08 UTC
Created attachment 305146 [details] [review]
popover: Avoid hiding modal popovers if another popover is taking focus

Due to popover modality itself, there's quite high chances the popover
stealing focus has been triggered from within, so stay friendly to it.
Hiding the popover here will only hide the grabbing popover too if this
happens.
Comment 3 Carlos Garnacho 2015-06-12 13:09:07 UTC
Note that there's still issues with non-modal popovers within modal popovers, as clicking on the former will be considered "outside" for the latter.
Comment 4 Matthias Clasen 2015-06-12 14:07:23 UTC
Review of attachment 305145 [details] [review]:

makes sense
Comment 5 Matthias Clasen 2015-06-12 14:10:03 UTC
Review of attachment 305146 [details] [review]:

tricky. but I guess it does the right thing. Might be good to have testcase for some of these tricky configurations somewhere in tests/ - maybe add some to testpopover...
Comment 6 Carlos Garnacho 2015-06-12 18:59:44 UTC
(In reply to Matthias Clasen from comment #5)
> Review of attachment 305146 [details] [review] [review]:
> 
> tricky. but I guess it does the right thing. 

Yeah, the right check would potentially involve recursive checks around popovers/parents, as we eg. get grab_notify somewhat verbosely AFAIR, so this might happen on grandparent popovers too. This sort of relies on popovers being spawn from user interaction though.

> Might be good to have testcase
> for some of these tricky configurations somewhere in tests/ - maybe add some
> to testpopover...

Right, I'll make sure there's one.
Comment 7 Carlos Garnacho 2015-06-12 19:01:38 UTC
Attachment 305145 [details] pushed as a0ff35f - window: Avoid rising the window of already shown popovers
Attachment 305146 [details] pushed as a01fe14 - popover: Avoid hiding modal popovers if another popover is taking focus