summaryrefslogtreecommitdiffstats
path: root/sway/commands/input/scroll_button.c
diff options
context:
space:
mode:
authorLibravatar M Stoeckl <code@mstoeckl.com>2019-01-10 18:27:21 -0500
committerLibravatar M Stoeckl <code@mstoeckl.com>2019-01-14 08:05:29 -0500
commit2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0 (patch)
tree56332b9c150459beb5aef94605372ef179ec8854 /sway/commands/input/scroll_button.c
parentRemove 'input' field of IPC command return json (diff)
downloadsway-2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0.tar.gz
sway-2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0.tar.zst
sway-2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0.zip
Remove now-unused "input" argument of cmd_results_new
Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))` applied to `cmd_results_new`. String usage constants have been converted from pointers to arrays when encountered. General handler format strings were sometimes modified to include the old input string, especially for unknown command errors.
Diffstat (limited to 'sway/commands/input/scroll_button.c')
-rw-r--r--sway/commands/input/scroll_button.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sway/commands/input/scroll_button.c b/sway/commands/input/scroll_button.c
index d82a1fe1..6b331419 100644
--- a/sway/commands/input/scroll_button.c
+++ b/sway/commands/input/scroll_button.c
@@ -10,30 +10,28 @@ struct cmd_results *input_cmd_scroll_button(int argc, char **argv) {
10 } 10 }
11 struct input_config *ic = config->handler_context.input_config; 11 struct input_config *ic = config->handler_context.input_config;
12 if (!ic) { 12 if (!ic) {
13 return cmd_results_new(CMD_FAILURE, "scroll_button", 13 return cmd_results_new(CMD_FAILURE, "No input device defined.");
14 "No input device defined.");
15 } 14 }
16 15
17 if (strcmp(*argv, "disable") == 0) { 16 if (strcmp(*argv, "disable") == 0) {
18 ic->scroll_button = 0; 17 ic->scroll_button = 0;
19 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 18 return cmd_results_new(CMD_SUCCESS, NULL);
20 } 19 }
21 20
22 char *message = NULL; 21 char *message = NULL;
23 uint32_t button = get_mouse_button(*argv, &message); 22 uint32_t button = get_mouse_button(*argv, &message);
24 if (message) { 23 if (message) {
25 error = cmd_results_new(CMD_INVALID, "scroll_button", message); 24 error = cmd_results_new(CMD_INVALID, message);
26 free(message); 25 free(message);
27 return error; 26 return error;
28 } else if (button == SWAY_SCROLL_UP || button == SWAY_SCROLL_DOWN 27 } else if (button == SWAY_SCROLL_UP || button == SWAY_SCROLL_DOWN
29 || button == SWAY_SCROLL_LEFT || button == SWAY_SCROLL_RIGHT) { 28 || button == SWAY_SCROLL_LEFT || button == SWAY_SCROLL_RIGHT) {
30 return cmd_results_new(CMD_INVALID, "scroll_button", 29 return cmd_results_new(CMD_INVALID,
31 "X11 axis buttons are not supported for scroll_button"); 30 "X11 axis buttons are not supported for scroll_button");
32 } else if (!button) { 31 } else if (!button) {
33 return cmd_results_new(CMD_INVALID, "scroll_button", 32 return cmd_results_new(CMD_INVALID, "Unknown button %s", *argv);
34 "Unknown button %s", *argv);
35 } 33 }
36 ic->scroll_button = button; 34 ic->scroll_button = button;
37 35
38 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 36 return cmd_results_new(CMD_SUCCESS, NULL);
39} 37}