diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-10-01 09:41:15 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-10-01 09:41:15 -0400 |
commit | 742d1764a6fb1fb9269dc9ffe08319da98f4d7b8 (patch) | |
tree | 9a9dbe4dd968f78e728496a33e17bf695c773dcd /sway/tree/container.c | |
parent | Merge pull request #2737 from Ragnis/criteria-floating (diff) | |
download | sway-742d1764a6fb1fb9269dc9ffe08319da98f4d7b8.tar.gz sway-742d1764a6fb1fb9269dc9ffe08319da98f4d7b8.tar.zst sway-742d1764a6fb1fb9269dc9ffe08319da98f4d7b8.zip |
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) { | |||
1021 | if (!c->view && c->layout != L_TABBED && c->layout != L_STACKED) { | 1021 | if (!c->view && c->layout != L_TABBED && c->layout != L_STACKED) { |
1022 | return; | 1022 | return; |
1023 | } | 1023 | } |
1024 | // Children of tabbed/stacked containers re-use the gaps of the container | 1024 | // Descendants of tabbed/stacked containers re-use the gaps of the container |
1025 | enum sway_container_layout layout = container_parent_layout(c); | 1025 | struct sway_container *temp = c; |
1026 | if (layout == L_TABBED || layout == L_STACKED) { | 1026 | while (temp) { |
1027 | return; | 1027 | enum sway_container_layout layout = container_parent_layout(temp); |
1028 | if (layout == L_TABBED || layout == L_STACKED) { | ||
1029 | return; | ||
1030 | } | ||
1031 | temp = temp->parent; | ||
1032 | } | ||
1033 | // If smart gaps is on, don't add gaps if there is only one view visible | ||
1034 | if (config->smart_gaps) { | ||
1035 | struct sway_view *view = c->view; | ||
1036 | if (!view) { | ||
1037 | struct sway_seat *seat = | ||
1038 | input_manager_get_default_seat(input_manager); | ||
1039 | struct sway_container *focus = | ||
1040 | seat_get_focus_inactive_view(seat, &c->node); | ||
1041 | view = focus ? focus->view : NULL; | ||
1042 | } | ||
1043 | if (view && view_is_only_visible(view)) { | ||
1044 | return; | ||
1045 | } | ||
1028 | } | 1046 | } |
1029 | 1047 | ||
1030 | struct sway_workspace *ws = c->workspace; | 1048 | struct sway_workspace *ws = c->workspace; |