diff options
author | lbonn <bonnans.l@gmail.com> | 2021-01-20 22:20:00 +0100 |
---|---|---|
committer | Tudor Brindus <me@tbrindus.ca> | 2021-02-25 09:40:20 -0500 |
commit | c6e7cf1ae554f36e5120962ace779737827ad088 (patch) | |
tree | 6071546edfe33925f7f205414166e62fbfd6d819 /sway/tree | |
parent | eea9c6331f01729d5feb8f86a4c0bbb53012d292 (diff) |
focus: beyond fullscreen when focused explicitly
When issuing a focus command on a specific container, users expect to
proceed it even if is hidden by a fullscreen window.
This matches the behavior of i3.
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 6b4c6de2..e22c5961 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -418,6 +418,28 @@ void container_for_each_child(struct sway_container *container, } } +struct sway_container *container_obstructing_fullscreen_container(struct sway_container *container) +{ + struct sway_workspace *workspace = container->pending.workspace; + + if (workspace && workspace->fullscreen && !container_is_fullscreen_or_child(container)) { + if (container_is_transient_for(container, workspace->fullscreen)) { + return NULL; + } + return workspace->fullscreen; + } + + struct sway_container *fullscreen_global = root->fullscreen_global; + if (fullscreen_global && container != fullscreen_global && !container_has_ancestor(container, fullscreen_global)) { + if (container_is_transient_for(container, fullscreen_global)) { + return NULL; + } + return fullscreen_global; + } + + return NULL; +} + bool container_has_ancestor(struct sway_container *descendant, struct sway_container *ancestor) { while (descendant) { |