From 73eb49cf81373b5b561db5f927a4236f7208c117 Mon Sep 17 00:00:00 2001 From: Chengyu Zheng Date: Mon, 23 Apr 2018 18:51:10 +0200 Subject: [PATCH 1/3] remove output pos syntax --- sway/commands/output.c | 30 ++++++++---------------------- sway/sway.5.txt | 2 +- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/sway/commands/output.c b/sway/commands/output.c index f7e3372ce..74728a9c9 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c @@ -73,29 +73,15 @@ static struct cmd_results *cmd_output_position(struct output_config *output, char *end; output->x = strtol(argv[*i], &end, 10); + // Format is 1234 4321 + if (++*i >= argc) { + return cmd_results_new(CMD_INVALID, "output", + "Missing position argument (y)."); + } + output->y = strtol(argv[*i], &end, 10); if (*end) { - // Format is 1234,4321 - if (*end != ',') { - return cmd_results_new(CMD_INVALID, "output", - "Invalid position x."); - } - ++end; - output->y = strtol(end, &end, 10); - if (*end) { - return cmd_results_new(CMD_INVALID, "output", - "Invalid position y."); - } - } else { - // Format is 1234 4321 (legacy) - if (++*i >= argc) { - return cmd_results_new(CMD_INVALID, "output", - "Missing position argument (y)."); - } - output->y = strtol(argv[*i], &end, 10); - if (*end) { - return cmd_results_new(CMD_INVALID, "output", - "Invalid position y."); - } + return cmd_results_new(CMD_INVALID, "output", + "Invalid position y."); } return NULL; diff --git a/sway/sway.5.txt b/sway/sway.5.txt index 039753493..1cd267c02 100644 --- a/sway/sway.5.txt +++ b/sway/sway.5.txt @@ -374,7 +374,7 @@ The default colors are: + output HDMI-A-1 mode 1920x1080@60Hz -**output** position|pos :: +**output** position|pos :: Configures the specified output to be arranged at the given position. **output** scale :: From 3aa2349beb28fc72d7124806e91ed9481221460f Mon Sep 17 00:00:00 2001 From: Chengyu Zheng Date: Mon, 23 Apr 2018 19:17:33 +0200 Subject: [PATCH 2/3] remove output pos syntax fix --- sway/commands.c | 2 +- sway/commands/output.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/sway/commands.c b/sway/commands.c index 6af3c5d0c..f75c21f0c 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -322,7 +322,7 @@ struct cmd_results *execute_command(char *_exec, struct sway_seat *seat) { cmdlist += strspn(cmdlist, whitespace); do { // Split commands - cmd = argsep(&cmdlist, ","); + cmd = argsep(&cmdlist, ";"); cmd += strspn(cmd, whitespace); if (strcmp(cmd, "") == 0) { wlr_log(L_INFO, "Ignoring empty command."); diff --git a/sway/commands/output.c b/sway/commands/output.c index 74728a9c9..f0466aa30 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c @@ -73,15 +73,17 @@ static struct cmd_results *cmd_output_position(struct output_config *output, char *end; output->x = strtol(argv[*i], &end, 10); - // Format is 1234 4321 - if (++*i >= argc) { - return cmd_results_new(CMD_INVALID, "output", - "Missing position argument (y)."); - } - output->y = strtol(argv[*i], &end, 10); if (*end) { - return cmd_results_new(CMD_INVALID, "output", - "Invalid position y."); + // Format is 1234 4321 + if (++*i >= argc) { + return cmd_results_new(CMD_INVALID, "output", + "Missing position argument (y)."); + } + output->y = strtol(argv[*i], &end, 10); + if (*end) { + return cmd_results_new(CMD_INVALID, "output", + "Invalid position y."); + } } return NULL; From 367c25e79e4b03b16daa64f5ea4665d7cc97742d Mon Sep 17 00:00:00 2001 From: Chengyu Zheng Date: Mon, 23 Apr 2018 19:19:03 +0200 Subject: [PATCH 3/3] remove output pos syntax fix fix --- sway/commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/commands.c b/sway/commands.c index f75c21f0c..6af3c5d0c 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -322,7 +322,7 @@ struct cmd_results *execute_command(char *_exec, struct sway_seat *seat) { cmdlist += strspn(cmdlist, whitespace); do { // Split commands - cmd = argsep(&cmdlist, ";"); + cmd = argsep(&cmdlist, ","); cmd += strspn(cmd, whitespace); if (strcmp(cmd, "") == 0) { wlr_log(L_INFO, "Ignoring empty command.");