aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/commands/input/repeat_delay.c (renamed from sway/commands/input/repeat.c)25
-rw-r--r--sway/commands/input/repeat_rate.c30
-rw-r--r--sway/meson.build3
3 files changed, 32 insertions, 26 deletions
diff --git a/sway/commands/input/repeat.c b/sway/commands/input/repeat_delay.c
index b2f6fa46..ce265841 100644
--- a/sway/commands/input/repeat.c
+++ b/sway/commands/input/repeat_delay.c
@@ -28,28 +28,3 @@ struct cmd_results *input_cmd_repeat_delay(int argc, char **argv) {
28 apply_input_config(new_config); 28 apply_input_config(new_config);
29 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 29 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
30} 30}
31
32struct cmd_results *input_cmd_repeat_rate(int argc, char **argv) {
33 struct cmd_results *error = NULL;
34 if ((error = checkarg(argc, "repeat_rate", EXPECTED_EQUAL_TO, 1))) {
35 return error;
36 }
37 struct input_config *current_input_config =
38 config->handler_context.input_config;
39 if (!current_input_config) {
40 return cmd_results_new(CMD_FAILURE,
41 "repeat_rate", "No input device defined.");
42 }
43 struct input_config *new_config =
44 new_input_config(current_input_config->identifier);
45
46 int repeat_rate = atoi(argv[0]);
47 if (repeat_rate < 0) {
48 return cmd_results_new(CMD_INVALID, "repeat_rate",
49 "Repeat rate cannot be negative");
50 }
51 new_config->repeat_rate = repeat_rate;
52
53 apply_input_config(new_config);
54 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
55}
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
7struct 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}
diff --git a/sway/meson.build b/sway/meson.build
index 7dfda254..4ceb07b4 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -90,7 +90,8 @@ sway_sources = files(
90 'commands/input/middle_emulation.c', 90 'commands/input/middle_emulation.c',
91 'commands/input/natural_scroll.c', 91 'commands/input/natural_scroll.c',
92 'commands/input/pointer_accel.c', 92 'commands/input/pointer_accel.c',
93 'commands/input/repeat.c', 93 'commands/input/repeat_delay.c',
94 'commands/input/repeat_rate.c',
94 'commands/input/scroll_method.c', 95 'commands/input/scroll_method.c',
95 'commands/input/tap.c', 96 'commands/input/tap.c',
96 'commands/input/xkb_layout.c', 97 'commands/input/xkb_layout.c',