diff options
-rw-r--r-- | sway/tree/workspace.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index accdf6e3..aca35529 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -54,21 +54,6 @@ struct sway_output *workspace_get_initial_output(const char *name) { | |||
54 | return root->outputs->length ? root->outputs->items[0] : root->noop_output; | 54 | return root->outputs->length ? root->outputs->items[0] : root->noop_output; |
55 | } | 55 | } |
56 | 56 | ||
57 | static void prevent_invalid_outer_gaps(struct sway_workspace *ws) { | ||
58 | if (ws->gaps_outer.top < -ws->gaps_inner) { | ||
59 | ws->gaps_outer.top = -ws->gaps_inner; | ||
60 | } | ||
61 | if (ws->gaps_outer.right < -ws->gaps_inner) { | ||
62 | ws->gaps_outer.right = -ws->gaps_inner; | ||
63 | } | ||
64 | if (ws->gaps_outer.bottom < -ws->gaps_inner) { | ||
65 | ws->gaps_outer.bottom = -ws->gaps_inner; | ||
66 | } | ||
67 | if (ws->gaps_outer.left < -ws->gaps_inner) { | ||
68 | ws->gaps_outer.left = -ws->gaps_inner; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | struct sway_workspace *workspace_create(struct sway_output *output, | 57 | struct sway_workspace *workspace_create(struct sway_output *output, |
73 | const char *name) { | 58 | const char *name) { |
74 | if (output == NULL) { | 59 | if (output == NULL) { |
@@ -111,9 +96,6 @@ struct sway_workspace *workspace_create(struct sway_output *output, | |||
111 | if (wsc->gaps_inner != INT_MIN) { | 96 | if (wsc->gaps_inner != INT_MIN) { |
112 | ws->gaps_inner = wsc->gaps_inner; | 97 | ws->gaps_inner = wsc->gaps_inner; |
113 | } | 98 | } |
114 | // Since default outer gaps can be smaller than the negation of | ||
115 | // workspace specific inner gaps, check outer gaps again | ||
116 | prevent_invalid_outer_gaps(ws); | ||
117 | 99 | ||
118 | // Add output priorities | 100 | // Add output priorities |
119 | for (int i = 0; i < wsc->outputs->length; ++i) { | 101 | for (int i = 0; i < wsc->outputs->length; ++i) { |
@@ -718,10 +700,11 @@ void workspace_add_gaps(struct sway_workspace *ws) { | |||
718 | } | 700 | } |
719 | 701 | ||
720 | ws->current_gaps = ws->gaps_outer; | 702 | ws->current_gaps = ws->gaps_outer; |
721 | ws->current_gaps.top += ws->gaps_inner; | 703 | // Add inner gaps and make sure we don't turn out negative |
722 | ws->current_gaps.right += ws->gaps_inner; | 704 | ws->current_gaps.top = fmax(0, ws->current_gaps.top + ws->gaps_inner); |
723 | ws->current_gaps.bottom += ws->gaps_inner; | 705 | ws->current_gaps.right = fmax(0, ws->current_gaps.right + ws->gaps_inner); |
724 | ws->current_gaps.left += ws->gaps_inner; | 706 | ws->current_gaps.bottom = fmax(0, ws->current_gaps.bottom + ws->gaps_inner); |
707 | ws->current_gaps.left = fmax(0, ws->current_gaps.left + ws->gaps_inner); | ||
725 | 708 | ||
726 | ws->x += ws->current_gaps.left; | 709 | ws->x += ws->current_gaps.left; |
727 | ws->y += ws->current_gaps.top; | 710 | ws->y += ws->current_gaps.top; |