Don't allow negative gaps

This commit is contained in:
Ryan Dwyer 2018-09-29 12:58:54 +10:00
parent 415a48ac63
commit bb708d0f82

View file

@ -68,6 +68,9 @@ static struct cmd_results *gaps_set_defaults(int argc, char **argv) {
return cmd_results_new(CMD_INVALID, "gaps", return cmd_results_new(CMD_INVALID, "gaps",
"Expected 'gaps inner|outer <px>'"); "Expected 'gaps inner|outer <px>'");
} }
if (amount < 0) {
amount = 0;
}
if (inner) { if (inner) {
config->gaps_inner = amount; config->gaps_inner = amount;
@ -92,6 +95,9 @@ static void configure_gaps(struct sway_workspace *ws, void *_data) {
*prop -= data->amount; *prop -= data->amount;
break; break;
} }
if (*prop < 0) {
*prop = 0;
}
arrange_workspace(ws); arrange_workspace(ws);
} }