diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-29 12:58:54 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-09-29 12:58:54 +1000 |
commit | bb708d0f82d6e418ada6b0b5798455c8213e5412 (patch) | |
tree | f12eed2babed966f921540fc8f2680613ebddf91 | |
parent | Make gaps implementation consistent with i3-gaps (diff) | |
download | sway-bb708d0f82d6e418ada6b0b5798455c8213e5412.tar.gz sway-bb708d0f82d6e418ada6b0b5798455c8213e5412.tar.zst sway-bb708d0f82d6e418ada6b0b5798455c8213e5412.zip |
Don't allow negative gaps
-rw-r--r-- | sway/commands/gaps.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/commands/gaps.c b/sway/commands/gaps.c index 3791fcb4..2e0876a9 100644 --- a/sway/commands/gaps.c +++ b/sway/commands/gaps.c | |||
@@ -68,6 +68,9 @@ static struct cmd_results *gaps_set_defaults(int argc, char **argv) { | |||
68 | return cmd_results_new(CMD_INVALID, "gaps", | 68 | return cmd_results_new(CMD_INVALID, "gaps", |
69 | "Expected 'gaps inner|outer <px>'"); | 69 | "Expected 'gaps inner|outer <px>'"); |
70 | } | 70 | } |
71 | if (amount < 0) { | ||
72 | amount = 0; | ||
73 | } | ||
71 | 74 | ||
72 | if (inner) { | 75 | if (inner) { |
73 | config->gaps_inner = amount; | 76 | config->gaps_inner = amount; |
@@ -92,6 +95,9 @@ static void configure_gaps(struct sway_workspace *ws, void *_data) { | |||
92 | *prop -= data->amount; | 95 | *prop -= data->amount; |
93 | break; | 96 | break; |
94 | } | 97 | } |
98 | if (*prop < 0) { | ||
99 | *prop = 0; | ||
100 | } | ||
95 | arrange_workspace(ws); | 101 | arrange_workspace(ws); |
96 | } | 102 | } |
97 | 103 | ||