input/seatop_default: focus view on workspace switch - #9161
Conversation
70c76c8 to
2090497
Compare
|
Reproduction steps for the bug this fixes:
On master: the workspace node is focused, so all tiled windows gain blue "active focus" decorations but none have keyboard focus. With this patch: the previously focused window on that workspace is focused. This is reproducible in a nested sway session. |
| struct sway_node *fallback = NULL; | ||
| wl_list_for_each(current, &seat->focus_stack, link) { | ||
| // prioritize a focused descendant | ||
| if (node_has_ancestor(current->node, node)) { |
There was a problem hiding this comment.
Do we really need a fallback mechanism? Or would it be enough to change this to current->node == node || node_has_ancestor(current->node, node)?
There was a problem hiding this comment.
Hmm. I tested both the fallback mechanism and your suggestion and compared it to i3, and neither matches i3's behaviour. I'll rework it.
When `focus_follows_mouse` is enabled and the cursor moves from one output to a layer surface (such as swaybar) on another output, Sway would previously focus the workspace node. This change updates workspace switching using either the mouse or `workspace_switch` to use `seat_get_focus_inactive_view` first, ensuring that the previously focused view on the target workspace receives focus.
2090497 to
637728c
Compare
|
I drastically changed the way this patch was implemented and simplified it. From observing i3's behaviour I was previously was trying to fall back to focused descendants. However after more testing I now realise that i3 is quite aggressive about focusing views only, and not containers. So there is no need to change the way that seat_get_focus_inactive works. Instead now the patch just calls As far as I can tell, this matches i3's behaviour in this area exactly. |
When
focus_follows_mouseis enabled and the cursor moves from oneoutput to a layer surface (such as swaybar) on another output, Sway
would previously focus the workspace node.
This change updates workspace switching using either the mouse or
workspace_switchto useseat_get_focus_inactive_viewfirst, ensuringthat the previously focused view on the target workspace receives focus.
Fixes: #8177