mirror of
https://github.com/swaywm/sway.git
synced 2026-04-05 07:15:41 -04:00
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.
This commit is contained in:
parent
b80cf982ae
commit
36d9037f2c
6 changed files with 30 additions and 53 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#define _XOPEN_SOURCE 500
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include "sway/commands.h"
|
||||
|
|
@ -20,8 +21,8 @@ static struct workspace_config *workspace_config_find_or_create(char *ws_name) {
|
|||
return NULL;
|
||||
}
|
||||
wsc->workspace = strdup(ws_name);
|
||||
wsc->gaps_inner = -1;
|
||||
wsc->gaps_outer = -1;
|
||||
wsc->gaps_inner = INT_MIN;
|
||||
wsc->gaps_outer = INT_MIN;
|
||||
list_add(config->workspace_configs, wsc);
|
||||
return wsc;
|
||||
}
|
||||
|
|
@ -94,7 +95,16 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_FAILURE, "workspace gaps",
|
||||
"Expected 'workspace <ws> gaps inner|outer <px>'");
|
||||
}
|
||||
*prop = val >= 0 ? val : 0;
|
||||
*prop = val;
|
||||
|
||||
// Prevent invalid gaps configurations.
|
||||
if (wsc->gaps_inner < 0) {
|
||||
wsc->gaps_inner = 0;
|
||||
}
|
||||
if (wsc->gaps_outer < -wsc->gaps_inner) {
|
||||
wsc->gaps_outer = -wsc->gaps_inner;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (config->reading || !config->active) {
|
||||
return cmd_results_new(CMD_DEFER, "workspace", NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue