aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Pedro CĂ´rte-Real <pedro@pedrocr.net>2019-07-06 11:57:32 +0100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-07-15 23:46:27 -0400
commitd0233af3b39475b47be4248846536811ddca2624 (patch)
treeacc61150bd9e6bc1a69c8e7f38a700e8a9e8b2ed /sway/tree/view.c
parentUse -fmacro-prefix-map to strip build path (diff)
downloadsway-d0233af3b39475b47be4248846536811ddca2624.tar.gz
sway-d0233af3b39475b47be4248846536811ddca2624.tar.zst
sway-d0233af3b39475b47be4248846536811ddca2624.zip
Rework gaps code to be simpler and correct
Instead of tracking gaps per child apply gaps in two logical places: 1. In tiled containers use the layout code to add the gaps between windows. This is much simpler and guarantees that the sizing of children is correct. 2. In the workspace itself apply all the gaps around the edge. Here we're in the correct position to size inner and outer gaps correctly and decide on smart gaps in a single location. Fixes #4296
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index f6d62ad6..be540804 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -183,14 +183,6 @@ bool view_is_only_visible(struct sway_view *view) {
183} 183}
184 184
185static bool gaps_to_edge(struct sway_view *view) { 185static bool gaps_to_edge(struct sway_view *view) {
186 struct sway_container *con = view->container;
187 while (con) {
188 if (con->current_gaps.top > 0 || con->current_gaps.right > 0 ||
189 con->current_gaps.bottom > 0 || con->current_gaps.left > 0) {
190 return true;
191 }
192 con = con->parent;
193 }
194 struct side_gaps gaps = view->container->workspace->current_gaps; 186 struct side_gaps gaps = view->container->workspace->current_gaps;
195 return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0; 187 return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0;
196} 188}
@@ -232,14 +224,14 @@ void view_autoconfigure(struct sway_view *view) {
232 224
233 if (config->hide_edge_borders == E_BOTH 225 if (config->hide_edge_borders == E_BOTH
234 || config->hide_edge_borders == E_VERTICAL || hide_smart) { 226 || config->hide_edge_borders == E_VERTICAL || hide_smart) {
235 con->border_left = con->x - con->current_gaps.left != ws->x; 227 con->border_left = con->x != ws->x;
236 int right_x = con->x + con->width + con->current_gaps.right; 228 int right_x = con->x + con->width;
237 con->border_right = right_x != ws->x + ws->width; 229 con->border_right = right_x != ws->x + ws->width;
238 } 230 }
239 if (config->hide_edge_borders == E_BOTH 231 if (config->hide_edge_borders == E_BOTH
240 || config->hide_edge_borders == E_HORIZONTAL || hide_smart) { 232 || config->hide_edge_borders == E_HORIZONTAL || hide_smart) {
241 con->border_top = con->y - con->current_gaps.top != ws->y; 233 con->border_top = con->y != ws->y;
242 int bottom_y = con->y + con->height + con->current_gaps.bottom; 234 int bottom_y = con->y + con->height;
243 con->border_bottom = bottom_y != ws->y + ws->height; 235 con->border_bottom = bottom_y != ws->y + ws->height;
244 } 236 }
245 237