Bug 1260773 - [GTK3][Wayland] Child popup gets focus-in, focus-out events
[GTK3][Wayland] Child popup gets focus-in, focus-out events
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: gtk3 (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Martin Stransky
Fedora Extras Quality Assurance
https://github.com/stransky/gecko-dev
:
Depends On:
Blocks: 1054334 1264355
  Show dependency treegraph
 
Reported: 2015-09-07 13:05 EDT by Martin Stransky
Modified: 2017-06-19 08:12 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1054334
: 1264355 (view as bug list)
Environment:
Last Closed: 2017-06-19 08:12:29 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Test program (5.71 KB, text/plain)
2015-10-20 03:45 EDT, Olivier Fourdan
no flags Details
Test program (5.71 KB, text/plain)
2015-10-20 03:47 EDT, Olivier Fourdan
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
GNOME Desktop 783957 None None None 2017-06-19 08:12 EDT
Mozilla Foundation 635134 None None None Never

  None (edit)
Description Martin Stransky 2015-09-07 13:05:09 EDT
When popup window is created (menubar for instance), it's misplaced (rendered at 0,0) and rendered behind main application. Works fine on broadway backend.

When I hit the "Super" key, those windows (menu bar, etc.) are rendered as an extra applications side by the main Firefox window.
Comment 1 Olivier Fourdan 2015-09-08 09:28:03 EDT
Hi Martin, can you provide a simple reproducer?

gtk3-demo seems to work fine and a simple menu app I had works fine as well on current f23 with gnome-3.17.9x.

There used to be some issues with popup menu some times ago but it's been fixed in both mutter and gtk+

https://bugzilla.gnome.org/show_bug.cgi?id=749716
https://bugzilla.gnome.org/show_bug.cgi?id=748951
https://bugzilla.gnome.org/show_bug.cgi?id=749717
Comment 2 Martin Stransky 2015-09-10 04:55:57 EDT
Okay, taking back for now - looks like Firefox emits too much input events so the window is created and then destroyed by Firefox itself.
Comment 3 Martin Stransky 2015-09-25 06:26:43 EDT
It's cause bu focus-out event which is send to container window (e.g. event widget) right after the popup is created. But the popups should not have the focus, it must stay on parent window as on X11.
Comment 4 Martin Stransky 2015-10-19 14:59:24 EDT
Olivier, I found the problem. When I create a popup (and set it transient for the parent) the new popup receives focus-in and parent gets focus-out. I don't see this on X11 where focus is still on parent. Is that related to the position problem? Does wayland handle focus differently?
Comment 5 Olivier Fourdan 2015-10-20 03:45 EDT
Created attachment 1084643 [details]
Test program

(In reply to Martin Stransky from comment #4)
> Olivier, I found the problem. When I create a popup (and set it transient
> for the parent) the new popup receives focus-in and parent gets focus-out. I
> don't see this on X11 where focus is still on parent. Is that related to the
> position problem? Does wayland handle focus differently?

I don't see this being mentioned in the docs for Wayland [1] and I cannot reproduce using the attached reproducer, focus remains on the main window even when the popup is mapped on screen.

I suspect gdk is not using a popup in your case, especially if the (expected to be popup) window is not placed relative to its parent window.

[1] http://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Input
Comment 6 Olivier Fourdan 2015-10-20 03:47 EDT
Created attachment 1084644 [details]
Test program

(fix the confusing messages in the focus in/out handlers)
Comment 7 Martin Stransky 2015-10-20 03:53:02 EDT
(In reply to Olivier Fourdan from comment #5)
> I suspect gdk is not using a popup in your case, especially if the (expected
> to be popup) window is not placed relative to its parent window.
> 
> [1] http://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Input

Yes, that may be the case - but the window is created as GTK_WINDOW_POPUP so one may expect it is a popup ;-) So the example you created for correct placing should also fix the focus, right?
Comment 8 Olivier Fourdan 2015-10-20 05:16:48 EDT
(In reply to Martin Stransky from comment #7)
> Yes, that may be the case - but the window is created as GTK_WINDOW_POPUP so
> one may expect it is a popup ;-) So the example you created for correct
> placing should also fix the focus, right?

Specifying a GTK_WINDOW_POPUP does not imply that gdk will use an XdgPopup eventually, see what I wrote in https://bugzilla.redhat.com/show_bug.cgi?id=1264355#c10 

You need a grab as well otherwise the gdk backend for Wayland will not create an xdg_popup, as this is required anyway by the xdg_popup:

http://cgit.freedesktop.org/wayland/weston/tree/protocol/xdg-shell.xml#n542

(In reply to Martin Stransky from comment #7)
> So the example you created for correct placing should also fix the focus,
> right?

I don't see any focus transition with xdg_popup.
Comment 9 Jan Kurik 2016-02-24 08:44:07 EST
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase
Comment 10 Martin Stransky 2017-06-19 08:00:41 EDT
Olivier, I just came across this bug again and looks like the recent mutter version has this bug now. I tested your example (Thanks for it!) and it shows that focus *is* transferred on wayland/mutter while it stays on weston. Will file bug at b.g.o for that. Thanks!
Comment 11 Martin Stransky 2017-06-19 08:12:29 EDT
Filed as https://bugzilla.gnome.org/show_bug.cgi?id=783957

Note You need to log in before you can comment on or make changes to this bug.