[wayland] Implement xdg_activation_v1
Categories
(Core :: Widget: Gtk, defect, P1)
Tracking
()
People
(Reporter: emilio, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
225 bytes,
text/html
|
Details |
The test-case from bug 1691214 does work on X11 (and all other platforms), but it doesn't seem to work on Wayland.
STR is opening the test-case, clicking one of those buttons, then once it's loaded switching back to the original tab and click on the other. The window should be focused again, but it doesn't.
Reporter | ||
Comment 1•4 years ago
|
||
Reporter | ||
Comment 2•4 years ago
|
||
Ah, seems known: https://searchfox.org/mozilla-central/rev/04f921656dfd19a5afa503c9b9780a1a389f14c4/widget/gtk/nsWindow.cpp#2198-2205
Is this a GTK issue? Or something else? Is wayland really not supposed to have this capability?
Reporter | ||
Comment 3•4 years ago
|
||
I guess https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/50 is related here?
Comment 4•4 years ago
|
||
Yes, Wayland does not support that. The xdg_activation protocol looks promising!
Updated•4 years ago
|
Updated•4 years ago
|
Comment 5•4 years ago
|
||
Let's try to workaround it until xdg_activation protocol is ready.
Updated•3 years ago
|
Updated•3 years ago
|
Comment 6•3 years ago
•
|
||
The testcase here works with latest nightly & KDE on Fedora 35.
I'll also look at https://gitlab.gnome.org/GNOME/mutter/-/issues/2044#note_1326421 which seems to affect mutter.
Comment 7•3 years ago
|
||
For the record, Carlos Garnacho suggested that the usage here might be a bit unusual and Mutter maybe being overly strict. He send me a patch but the link has timed out, will ask him again for it and try if that fixes the xdg-activation issue.
Can you post the command you use to run a failing test?
Comment 8•3 years ago
|
||
(In reply to Robert Mader [:rmader] from comment #7)
For the record, Carlos Garnacho suggested that the usage here might be a bit unusual and Mutter maybe being overly strict. He send me a patch but the link has timed out, will ask him again for it and try if that fixes the xdg-activation issue.
Can you post the command you use to run a failing test?
I use this testcase:
https://bugzilla.mozilla.org/show_bug.cgi?id=1692119#c1
From my debugging done in mutter is fails at meta_wayland_seat_get_grab_info()
and here meta_wayland_pointer_can_grab_surface() fails because of different wl_surfaces.
To debug it put breakpoint to activation_activate() at meta-wayland-activation.c file (I run nested mutter compositor for the debugging purpose).
Another way how to run Firefox is just to run the testsuite from Firefox tree like:
WAYLAND_DISPLAY=wayland-1 MOZ_ENABLE_WAYLAND=1 ./mach mochitest toolkit
(where wayland-1 is display of the nested compositor)
Comment 9•3 years ago
|
||
Thanks! Here's a proposed patch that might make it work: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2137
However Carlos asks: "doing xdg_activation_token_v1_set_surface with the requester surface is hard to do on the Firefox side?" - you may want to talk to him on #gnome-shell, maybe this is solvable in Firefox.
Comment 10•3 years ago
|
||
Ah, that easy :)
Ok, I can confirm it works on plasma but not on Mutter - also with the MR linked above.
Comment 11•3 years ago
|
||
(In reply to Robert Mader [:rmader] from comment #9)
Thanks! Here's a proposed patch that might make it work: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2137
However Carlos asks: "doing xdg_activation_token_v1_set_surface with the requester surface is hard to do on the Firefox side?" - you may want to talk to him on #gnome-shell, maybe this is solvable in Firefox.
We already do that:
https://searchfox.org/mozilla-central/rev/3407e72ceb5039da514c03ae61bd279b1725c3b2/widget/gtk/nsWindow.cpp#2899
Comment 12•3 years ago
|
||
Dropping last comment from chat here:
hmm, it's not the surface, but the serial which is wrong. At https://hg.mozilla.org/mozilla-central/rev/19a1500c08e3#l1.116 that GetLastUserInputTime() should be the serial received on wl_pointer.button
which is awkward here, since gdk won't give you that
makes me wonder how does plasma do those checks
Comment 13•3 years ago
|
||
xdg_activation spec does not say anything about pointer button event time. If we need any user input there the protocol is useless as we can use gtk_window_present_with_time().
IIUC xdg_activation is used to transfer focus from one focused window to another one (to prevent focus stealing) but you don't need any particular time for that - important it the focused surface which is 'source' of the focus.
Also note according to doc set_serial call is optional (but we set that anyway).
Comment 14•3 years ago
|
||
Also mutter crashes when set_serial call is missing as it uses null wl_seat. From my testing KDE requests only focused source surface where the focus change is initiated.
Comment 15•3 years ago
|
||
Emilio, is there any possibility to extent the testcase to switch focus without user interaction? For instance open new window and pass focus back to main window. I tried so in timeout callback but the focus switch does not work even in X11. Is there any focus change protection so JS code can't operate with it?
Updated•3 years ago
|
Reporter | ||
Comment 16•3 years ago
|
||
Yeah, we require user activation for focus generally (unless it's a privileged caller). I think dom.disable_window_flip=false
should remove that requirement: https://searchfox.org/mozilla-central/rev/dfc0dea63a16b73078a46b6ae49b2a626b8c11b5/docshell/base/BrowsingContext.cpp#2310-2329
Comment 17•3 years ago
|
||
Thanks - I need to create a testcase for https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2137#note_1329686
Comment 18•3 years ago
|
||
According to https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2148 it should be working in mutter-41.3 so let's wait to it.
Comment 19•3 years ago
|
||
I can confirm the xdg-activation works with mutter-41.2-2.fc35.x86_64 so we can run the testsuite there.
Description
•