diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-19 08:56:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-19 08:56:03 -0400 |
commit | 21eb63cc9ebff4e843595c64e40b5707a158c925 (patch) | |
tree | 8be54bda3c472f31666e0d2fad5b5647d67c62e6 /sway/commands | |
parent | render_output(): When fullscreen, clear to black and don't render background (diff) | |
parent | Merge pull request #1823 from RyanDwyer/key-repeat (diff) | |
download | sway-21eb63cc9ebff4e843595c64e40b5707a158c925.tar.gz sway-21eb63cc9ebff4e843595c64e40b5707a158c925.tar.zst sway-21eb63cc9ebff4e843595c64e40b5707a158c925.zip |
Merge branch 'master' into fullscreen
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/input.c | 4 | ||||
-rw-r--r-- | sway/commands/input/repeat_delay.c | 30 | ||||
-rw-r--r-- | sway/commands/input/repeat_rate.c | 30 |
3 files changed, 64 insertions, 0 deletions
diff --git a/sway/commands/input.c b/sway/commands/input.c index fa9cf05a..eeb4ee75 100644 --- a/sway/commands/input.c +++ b/sway/commands/input.c | |||
@@ -55,6 +55,10 @@ struct cmd_results *cmd_input(int argc, char **argv) { | |||
55 | res = input_cmd_natural_scroll(argc_new, argv_new); | 55 | res = input_cmd_natural_scroll(argc_new, argv_new); |
56 | } else if (strcasecmp("pointer_accel", argv[1]) == 0) { | 56 | } else if (strcasecmp("pointer_accel", argv[1]) == 0) { |
57 | res = input_cmd_pointer_accel(argc_new, argv_new); | 57 | res = input_cmd_pointer_accel(argc_new, argv_new); |
58 | } else if (strcasecmp("repeat_delay", argv[1]) == 0) { | ||
59 | res = input_cmd_repeat_delay(argc_new, argv_new); | ||
60 | } else if (strcasecmp("repeat_rate", argv[1]) == 0) { | ||
61 | res = input_cmd_repeat_rate(argc_new, argv_new); | ||
58 | } else if (strcasecmp("scroll_method", argv[1]) == 0) { | 62 | } else if (strcasecmp("scroll_method", argv[1]) == 0) { |
59 | res = input_cmd_scroll_method(argc_new, argv_new); | 63 | res = input_cmd_scroll_method(argc_new, argv_new); |
60 | } else if (strcasecmp("tap", argv[1]) == 0) { | 64 | } else if (strcasecmp("tap", argv[1]) == 0) { |
diff --git a/sway/commands/input/repeat_delay.c b/sway/commands/input/repeat_delay.c new file mode 100644 index 00000000..ce265841 --- /dev/null +++ b/sway/commands/input/repeat_delay.c | |||
@@ -0,0 +1,30 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <string.h> | ||
3 | #include "sway/config.h" | ||
4 | #include "sway/commands.h" | ||
5 | #include "sway/input/input-manager.h" | ||
6 | |||
7 | struct cmd_results *input_cmd_repeat_delay(int argc, char **argv) { | ||
8 | struct cmd_results *error = NULL; | ||
9 | if ((error = checkarg(argc, "repeat_delay", EXPECTED_EQUAL_TO, 1))) { | ||
10 | return error; | ||
11 | } | ||
12 | struct input_config *current_input_config = | ||
13 | config->handler_context.input_config; | ||
14 | if (!current_input_config) { | ||
15 | return cmd_results_new(CMD_FAILURE, | ||
16 | "repeat_delay", "No input device defined."); | ||
17 | } | ||
18 | struct input_config *new_config = | ||
19 | new_input_config(current_input_config->identifier); | ||
20 | |||
21 | int repeat_delay = atoi(argv[0]); | ||
22 | if (repeat_delay < 0) { | ||
23 | return cmd_results_new(CMD_INVALID, "repeat_delay", | ||
24 | "Repeat delay cannot be negative"); | ||
25 | } | ||
26 | new_config->repeat_delay = repeat_delay; | ||
27 | |||
28 | apply_input_config(new_config); | ||
29 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
30 | } | ||
diff --git a/sway/commands/input/repeat_rate.c b/sway/commands/input/repeat_rate.c new file mode 100644 index 00000000..f2ea2e69 --- /dev/null +++ b/sway/commands/input/repeat_rate.c | |||
@@ -0,0 +1,30 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <string.h> | ||
3 | #include "sway/config.h" | ||
4 | #include "sway/commands.h" | ||
5 | #include "sway/input/input-manager.h" | ||
6 | |||
7 | struct cmd_results *input_cmd_repeat_rate(int argc, char **argv) { | ||
8 | struct cmd_results *error = NULL; | ||
9 | if ((error = checkarg(argc, "repeat_rate", EXPECTED_EQUAL_TO, 1))) { | ||
10 | return error; | ||
11 | } | ||
12 | struct input_config *current_input_config = | ||
13 | config->handler_context.input_config; | ||
14 | if (!current_input_config) { | ||
15 | return cmd_results_new(CMD_FAILURE, | ||
16 | "repeat_rate", "No input device defined."); | ||
17 | } | ||
18 | struct input_config *new_config = | ||
19 | new_input_config(current_input_config->identifier); | ||
20 | |||
21 | int repeat_rate = atoi(argv[0]); | ||
22 | if (repeat_rate < 0) { | ||
23 | return cmd_results_new(CMD_INVALID, "repeat_rate", | ||
24 | "Repeat rate cannot be negative"); | ||
25 | } | ||
26 | new_config->repeat_rate = repeat_rate; | ||
27 | |||
28 | apply_input_config(new_config); | ||
29 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
30 | } | ||