fix(xwm): Defer X11 focus release between same-client transitions#2029
Conversation
The synchronous `set_input_focus(NONE, NONE)` in `X11Surface::leave` breaks focus transitions between same-client windows. Defer the focus-out decision to the next event-loop iteration so it can be cancelled out.
|
Okay this seems pretty okay as a fix, but I am a bit hesitant on merging the deferred |
Well, you are probably right, maybe I jumped the gun a bit. |
|
@Drakulix, Yet we still need to preserve the deferred path for |
Drakulix
left a comment
There was a problem hiding this comment.
Still feels a little hacky. At some point we probably should make focus-switches somewhat atomic, so that we can simply infer, if any new target is also an X11Surface or not.
But in the meantime this is a good solution. Thanks!
|
Just tested on Unity 6.4. Looking good 👍🏽 |
Description
X11Wmset_NET_ACTIVE_WINDOW = NONEfor any FocusOut event on a tracked top-level window, ignoringdetailfield. It breaks X11 clients like Unity Editor.Mechanism of the flaw:
_NET_ACTIVE_WINDOWto none, and...FocusIn.But that's not the whole issue.
X11Surfacealso synchronously callsset_input_focus(NONE, NONE), producing the intermediate state "focus is nowhere".Fixes:
Works not only for cosmic-comp but also for other compositors based on Smithay, all of which suffer the same issue.
Symptoms
Symptoms are exactly as described in pop-os/cosmic-comp#2006:
And many other related to input-unresponsiveness and sluggish experience, which cannot always be resolved by clicking other panels/alt-tabbing.
Diagnostics
Instrumentation wired into Smithay showed that:
Meaning that Unity switched focus from the top level to a sub-window, but _NET_ACTIVE_WINDOW became none.
How the fix works
FocusOutnow doesn't touch_NET_ACTIVE_WINDOWX11Wm.What I've checked
Checklist