You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This can be tested with something like sleep 10 && loginctl lock-session & cargo run with a locker client like cosmic-greeter running.
This can't be tested on anvil (since it doesn't support session lock currently) or niri (because it doesn't support XWayland). But on cosmic-comp, when the XWayland keyboard grab is active, it remains active when the session is locked, and only the X client, and not the session lock surface, gets keyboard input. With this test client, esc can be used to release the grab and be able to interact with the lock surface.
On Sway, when the session lock is created, the XWayland window gets a FocusOut event, no longer intercepts key presses, then gets a FocusIn when the lock surface is destroyed, and it then goes back to intercepting key presses. This is presumably the correct behavior. If we released the grab, the protocol has no way to tell X11 that the grab is released and should be taken again.
This can potentially be fixed without changes in smithay (except maybe adding a Clone impl to XWaylandKeyboardGrab) by overriding the default XWaylandKeyboardGrabHandler::grab or otherwise changing things, but it would be good if possible if Smithay itself could help somehow.
I see a few ways to address this. Not sure what's best.
Session lock doesn't use a Smithay KeyboardGrab. So this could also be changed to not use a grab like that, and be handled in the compositor input logic similarly to session lock. But with lower precedence.
I guess a mechanism to have multiple keyboard grabs with different precedence levels would work (basically the opposite of the former approach), but that probably just makes things more complicated.
The compositor could clear the keyboard grab in SessionLockHandler::lock. But if the grab is a session lock, it could downcast that to the concrete type, and save it to be restored.
Alternately instead of downcasting, XWaylandKeyboardGrabHandler::grab() could save a copy of the grab. Which still needs to be added as a grab somewhere when the session is unlocked.
None of these are obviously a way for Smithay to help handle this. And is there anything else an XWayland keyboard grab needs to not take precedence over? Probably locking should cancel all grabs. Is this the only one that should be restored?
The text was updated successfully, but these errors were encountered:
Good point. Currently on cosmic-comp the screenshot UI and polkit prompt are just layer shell surfaces, but it would be good for them to be privileged clients that are given special precedence over this kind of grab in some way.
A solution for Smithay/smithay#1714.
With this, the lock screen is able to get keyboard focus normally, but
focus then reverts to the XWayland grab surface. This can be tested with
the example client from the issue.
Adding a new variant of `KeyboardFocusTarget` is annoying. Maybe it
could map to a different variant of the enum. But it presumably needs to
handle any `wl_surface` XWayland uses. (Override redirect surfaces?
Subsurfaces?)
This issue occurs with XWayland clients that use keyboard grabs, like
virtualbox
(pop-os/cosmic-comp#449). Or a minimal X client like this one:This can be tested with something like
sleep 10 && loginctl lock-session & cargo run
with a locker client likecosmic-greeter
running.This can't be tested on anvil (since it doesn't support session lock currently) or niri (because it doesn't support XWayland). But on cosmic-comp, when the XWayland keyboard grab is active, it remains active when the session is locked, and only the X client, and not the session lock surface, gets keyboard input. With this test client,
esc
can be used to release the grab and be able to interact with the lock surface.On Sway, when the session lock is created, the XWayland window gets a
FocusOut
event, no longer intercepts key presses, then gets aFocusIn
when the lock surface is destroyed, and it then goes back to intercepting key presses. This is presumably the correct behavior. If we released the grab, the protocol has no way to tell X11 that the grab is released and should be taken again.This can potentially be fixed without changes in smithay (except maybe adding a
Clone
impl toXWaylandKeyboardGrab
) by overriding the defaultXWaylandKeyboardGrabHandler::grab
or otherwise changing things, but it would be good if possible if Smithay itself could help somehow.I see a few ways to address this. Not sure what's best.
KeyboardGrab
. So this could also be changed to not use a grab like that, and be handled in the compositor input logic similarly to session lock. But with lower precedence.SessionLockHandler::lock
. But if the grab is a session lock, it could downcast that to the concrete type, and save it to be restored.XWaylandKeyboardGrabHandler::grab()
could save a copy of the grab. Which still needs to be added as a grab somewhere when the session is unlocked.None of these are obviously a way for Smithay to help handle this. And is there anything else an XWayland keyboard grab needs to not take precedence over? Probably locking should cancel all grabs. Is this the only one that should be restored?
The text was updated successfully, but these errors were encountered: