diff options
-rw-r--r-- | include/sway/tree/view.h | 9 | ||||
-rw-r--r-- | sway/tree/view.c | 13 | ||||
-rw-r--r-- | sway/tree/workspace.c | 2 |
3 files changed, 13 insertions, 11 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 8898cde5..467bf78b 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -239,11 +239,12 @@ uint32_t view_configure(struct sway_view *view, double lx, double ly, int width, | |||
239 | bool view_inhibit_idle(struct sway_view *view); | 239 | bool view_inhibit_idle(struct sway_view *view); |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * Whether or not the view is the only visible view in its tree. If the view | 242 | * Whether or not this view's most distant ancestor (possibly itself) is the |
243 | * is tiling, there may be floating views. If the view is floating, there may | 243 | * only visible node in its tree. If the view is tiling, there may be floating |
244 | * be tiling views or views in a different floating container. | 244 | * views. If the view is floating, there may be tiling views or views in a |
245 | * different floating container. | ||
245 | */ | 246 | */ |
246 | bool view_is_only_visible(struct sway_view *view); | 247 | bool view_ancestor_is_only_visible(struct sway_view *view); |
247 | 248 | ||
248 | /** | 249 | /** |
249 | * Configure the view's position and size based on the container's position and | 250 | * Configure the view's position and size based on the container's position and |
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) { |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 5568d1f5..0fa28951 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -709,7 +709,7 @@ void workspace_add_gaps(struct sway_workspace *ws) { | |||
709 | if (focus && !focus->view) { | 709 | if (focus && !focus->view) { |
710 | focus = seat_get_focus_inactive_view(seat, &focus->node); | 710 | focus = seat_get_focus_inactive_view(seat, &focus->node); |
711 | } | 711 | } |
712 | if (focus && focus->view && view_is_only_visible(focus->view)) { | 712 | if (focus && focus->view && view_ancestor_is_only_visible(focus->view)) { |
713 | ws->current_gaps.top = 0; | 713 | ws->current_gaps.top = 0; |
714 | ws->current_gaps.right = 0; | 714 | ws->current_gaps.right = 0; |
715 | ws->current_gaps.bottom = 0; | 715 | ws->current_gaps.bottom = 0; |