diff options
author | Tudor Brindus <me@tbrindus.ca> | 2020-05-31 19:03:42 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2020-06-08 19:01:45 -0400 |
commit | ed08f2f20cc533716001829398bdad8f0e98049b (patch) | |
tree | a61b4e212bcef3383bbe49256cf83f6bccd4e3a4 /sway/tree/view.c | |
parent | input: tweak resize behavior to not change tab focus on border click (diff) | |
download | sway-ed08f2f20cc533716001829398bdad8f0e98049b.tar.gz sway-ed08f2f20cc533716001829398bdad8f0e98049b.tar.zst sway-ed08f2f20cc533716001829398bdad8f0e98049b.zip |
tree/view: fix smart gaps when ancestor container is tabbed or stacked
Fixes #5406.
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index 314fd381..03ff89b5 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -192,21 +192,22 @@ bool view_inhibit_idle(struct sway_view *view) { | |||
192 | || sway_idle_inhibit_v1_is_active(application_inhibitor); | 192 | || sway_idle_inhibit_v1_is_active(application_inhibitor); |
193 | } | 193 | } |
194 | 194 | ||
195 | bool view_is_only_visible(struct sway_view *view) { | 195 | bool view_ancestor_is_only_visible(struct sway_view *view) { |
196 | bool only_view = true; | 196 | bool only_visible = true; |
197 | struct sway_container *con = view->container; | 197 | struct sway_container *con = view->container; |
198 | while (con) { | 198 | while (con) { |
199 | enum sway_container_layout layout = container_parent_layout(con); | 199 | enum sway_container_layout layout = container_parent_layout(con); |
200 | if (layout != L_TABBED && layout != L_STACKED) { | 200 | if (layout != L_TABBED && layout != L_STACKED) { |
201 | list_t *siblings = container_get_siblings(con); | 201 | list_t *siblings = container_get_siblings(con); |
202 | if (siblings && siblings->length > 1) { | 202 | if (siblings && siblings->length > 1) { |
203 | only_view = false; | 203 | only_visible = false; |
204 | break; | ||
205 | } | 204 | } |
205 | } else { | ||
206 | only_visible = true; | ||
206 | } | 207 | } |
207 | con = con->parent; | 208 | con = con->parent; |
208 | } | 209 | } |
209 | return only_view; | 210 | return only_visible; |
210 | } | 211 | } |
211 | 212 | ||
212 | static bool gaps_to_edge(struct sway_view *view) { | 213 | static bool gaps_to_edge(struct sway_view *view) { |
@@ -247,7 +248,7 @@ void view_autoconfigure(struct sway_view *view) { | |||
247 | bool smart = config->hide_edge_borders_smart == ESMART_ON || | 248 | bool smart = config->hide_edge_borders_smart == ESMART_ON || |
248 | (config->hide_edge_borders_smart == ESMART_NO_GAPS && | 249 | (config->hide_edge_borders_smart == ESMART_NO_GAPS && |
249 | !gaps_to_edge(view)); | 250 | !gaps_to_edge(view)); |
250 | bool hide_smart = smart && view_is_only_visible(view); | 251 | bool hide_smart = smart && view_ancestor_is_only_visible(view); |
251 | 252 | ||
252 | if (config->hide_edge_borders == E_BOTH | 253 | if (config->hide_edge_borders == E_BOTH |
253 | || config->hide_edge_borders == E_VERTICAL || hide_smart) { | 254 | || config->hide_edge_borders == E_VERTICAL || hide_smart) { |