diff --git a/sway/commands/resize.c b/sway/commands/resize.c index 32b746ea..8caa4331 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c @@ -1,4 +1,3 @@ -#include #include #include #include @@ -457,7 +456,7 @@ static struct cmd_results *cmd_resize_set(int argc, char **argv) { if (argc > num_consumed_args) { return cmd_results_new(CMD_INVALID, "%s", usage); } - if (width.unit == MOVEMENT_UNIT_INVALID) { + if (height.unit == MOVEMENT_UNIT_INVALID) { return cmd_results_new(CMD_INVALID, "%s", usage); } } @@ -582,17 +581,16 @@ struct cmd_results *cmd_resize(int argc, char **argv) { } if (strcasecmp(argv[0], "set") == 0) { - return cmd_resize_set(argc - 1, &argv[1]); + error = cmd_resize_set(argc - 1, &argv[1]); } - if (strcasecmp(argv[0], "grow") == 0) { - return cmd_resize_adjust(argc - 1, &argv[1], 1); + else if (strcasecmp(argv[0], "grow") == 0) { + error = cmd_resize_adjust(argc - 1, &argv[1], 1); } - if (strcasecmp(argv[0], "shrink") == 0) { - return cmd_resize_adjust(argc - 1, &argv[1], -1); + else if (strcasecmp(argv[0], "shrink") == 0) { + error = cmd_resize_adjust(argc - 1, &argv[1], -1); } - - const char usage[] = "Expected 'resize " - " [] [px|ppt]'"; - - return cmd_results_new(CMD_INVALID, "%s", usage); + if (error->status == CMD_INVALID) { + sway_log(SWAY_ERROR, "Invalid resize command: '%s'", error->error); + } + return error; }