aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/workspace.c
diff options
context:
space:
mode:
authorLibravatar Tarmack <git@tarmack.eu>2018-10-11 21:51:11 +0200
committerLibravatar Tarmack <git@tarmack.eu>2018-10-13 17:42:49 +0200
commit36d9037f2c419756b00d1fe2dbeefca278bc2799 (patch)
treed2300c007bbd28a68fc83d1d36faf459c971186c /sway/commands/workspace.c
parentMerge pull request #2825 from RyanDwyer/fractional-scale-pixel-leaks (diff)
downloadsway-36d9037f2c419756b00d1fe2dbeefca278bc2799.tar.gz
sway-36d9037f2c419756b00d1fe2dbeefca278bc2799.tar.zst
sway-36d9037f2c419756b00d1fe2dbeefca278bc2799.zip
fix_edge_gaps: Allow negative values for outer gaps.
While allowing negative values for the outer gaps it is still prevented that negative values move windows out of the container. This replaces the non-i3 option for edge_gaps.
Diffstat (limited to 'sway/commands/workspace.c')
-rw-r--r--sway/commands/workspace.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c
index 63f29641..61aa443d 100644
--- a/sway/commands/workspace.c
+++ b/sway/commands/workspace.c
@@ -1,5 +1,6 @@
1#define _XOPEN_SOURCE 500 1#define _XOPEN_SOURCE 500
2#include <ctype.h> 2#include <ctype.h>
3#include <limits.h>
3#include <string.h> 4#include <string.h>
4#include <strings.h> 5#include <strings.h>
5#include "sway/commands.h" 6#include "sway/commands.h"
@@ -20,8 +21,8 @@ static struct workspace_config *workspace_config_find_or_create(char *ws_name) {
20 return NULL; 21 return NULL;
21 } 22 }
22 wsc->workspace = strdup(ws_name); 23 wsc->workspace = strdup(ws_name);
23 wsc->gaps_inner = -1; 24 wsc->gaps_inner = INT_MIN;
24 wsc->gaps_outer = -1; 25 wsc->gaps_outer = INT_MIN;
25 list_add(config->workspace_configs, wsc); 26 list_add(config->workspace_configs, wsc);
26 return wsc; 27 return wsc;
27} 28}
@@ -94,7 +95,16 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
94 return cmd_results_new(CMD_FAILURE, "workspace gaps", 95 return cmd_results_new(CMD_FAILURE, "workspace gaps",
95 "Expected 'workspace <ws> gaps inner|outer <px>'"); 96 "Expected 'workspace <ws> gaps inner|outer <px>'");
96 } 97 }
97 *prop = val >= 0 ? val : 0; 98 *prop = val;
99
100 // Prevent invalid gaps configurations.
101 if (wsc->gaps_inner < 0) {
102 wsc->gaps_inner = 0;
103 }
104 if (wsc->gaps_outer < -wsc->gaps_inner) {
105 wsc->gaps_outer = -wsc->gaps_inner;
106 }
107
98 } else { 108 } else {
99 if (config->reading || !config->active) { 109 if (config->reading || !config->active) {
100 return cmd_results_new(CMD_DEFER, "workspace", NULL); 110 return cmd_results_new(CMD_DEFER, "workspace", NULL);