aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-10-01 09:41:15 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-10-01 09:41:15 -0400
commit742d1764a6fb1fb9269dc9ffe08319da98f4d7b8 (patch)
tree9a9dbe4dd968f78e728496a33e17bf695c773dcd /sway/tree/view.c
parentMerge pull request #2737 from Ragnis/criteria-floating (diff)
downloadsway-742d1764a6fb1fb9269dc9ffe08319da98f4d7b8.tar.gz
sway-742d1764a6fb1fb9269dc9ffe08319da98f4d7b8.tar.zst
sway-742d1764a6fb1fb9269dc9ffe08319da98f4d7b8.zip
Fix smart gaps
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index a024f325..3b271159 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -162,6 +162,23 @@ uint32_t view_configure(struct sway_view *view, double lx, double ly, int width,
162 return 0; 162 return 0;
163} 163}
164 164
165bool view_is_only_visible(struct sway_view *view) {
166 bool only_view = true;
167 struct sway_container *con = view->container;
168 while (con) {
169 enum sway_container_layout layout = container_parent_layout(con);
170 if (layout != L_TABBED && layout != L_STACKED) {
171 list_t *siblings = container_get_siblings(con);
172 if (siblings && siblings->length > 1) {
173 only_view = false;
174 break;
175 }
176 }
177 con = con->parent;
178 }
179 return only_view;
180}
181
165void view_autoconfigure(struct sway_view *view) { 182void view_autoconfigure(struct sway_view *view) {
166 if (!view->container->workspace) { 183 if (!view->container->workspace) {
167 // Hidden in the scratchpad 184 // Hidden in the scratchpad
@@ -178,24 +195,9 @@ void view_autoconfigure(struct sway_view *view) {
178 } 195 }
179 196
180 struct sway_workspace *ws = view->container->workspace; 197 struct sway_workspace *ws = view->container->workspace;
181
182 bool other_views = false;
183 if (config->hide_edge_borders == E_SMART) {
184 struct sway_container *con = view->container;
185 while (con) {
186 enum sway_container_layout layout = container_parent_layout(con);
187 if (layout != L_TABBED && layout != L_STACKED) {
188 list_t *siblings = container_get_siblings(con);
189 if (siblings && siblings->length > 1) {
190 other_views = true;
191 break;
192 }
193 }
194 con = con->parent;
195 }
196 }
197
198 struct sway_container *con = view->container; 198 struct sway_container *con = view->container;
199 bool other_views = config->hide_edge_borders == E_SMART ?
200 !view_is_only_visible(view) : false;
199 201
200 view->border_top = view->border_bottom = true; 202 view->border_top = view->border_bottom = true;
201 view->border_left = view->border_right = true; 203 view->border_left = view->border_right = true;