diff options
author | Ryan Dwyer <[email protected]> | 2018-10-02 08:57:55 +1000 |
---|---|---|
committer | GitHub <[email protected]> | 2018-10-02 08:57:55 +1000 |
commit | b542c5413efdbbe0bbf3be0196fe566b8c6bb07f (patch) | |
tree | 6b9f56b3700dda60efdaff4446fc684009490b5b /sway/tree/container.c | |
parent | 9956a1a9ab7141da813e8db63adb7b800958400b (diff) | |
parent | 82559c16c701aa912b341ecbbd116c2992c5e698 (diff) |
Merge pull request #2739 from RedSoxFan/fix-2653
Fix smart gaps
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 788300cc..e1e616f9 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -1021,10 +1021,28 @@ void container_add_gaps(struct sway_container *c) { if (!c->view && c->layout != L_TABBED && c->layout != L_STACKED) { return; } - // Children of tabbed/stacked containers re-use the gaps of the container - enum sway_container_layout layout = container_parent_layout(c); - if (layout == L_TABBED || layout == L_STACKED) { - return; + // Descendants of tabbed/stacked containers re-use the gaps of the container + struct sway_container *temp = c; + while (temp) { + enum sway_container_layout layout = container_parent_layout(temp); + if (layout == L_TABBED || layout == L_STACKED) { + return; + } + temp = temp->parent; + } + // If smart gaps is on, don't add gaps if there is only one view visible + if (config->smart_gaps) { + struct sway_view *view = c->view; + if (!view) { + struct sway_seat *seat = + input_manager_get_default_seat(input_manager); + struct sway_container *focus = + seat_get_focus_inactive_view(seat, &c->node); + view = focus ? focus->view : NULL; + } + if (view && view_is_only_visible(view)) { + return; + } } struct sway_workspace *ws = c->workspace; |