diff options
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/seat.c | 1 | ||||
-rw-r--r-- | sway/commands/seat/hide_cursor.c (renamed from sway/commands/hide_cursor.c) | 14 |
2 files changed, 6 insertions, 9 deletions
diff --git a/sway/commands/seat.c b/sway/commands/seat.c index 56acd204..3e7ffed9 100644 --- a/sway/commands/seat.c +++ b/sway/commands/seat.c | |||
@@ -10,6 +10,7 @@ static struct cmd_handler seat_handlers[] = { | |||
10 | { "attach", seat_cmd_attach }, | 10 | { "attach", seat_cmd_attach }, |
11 | { "cursor", seat_cmd_cursor }, | 11 | { "cursor", seat_cmd_cursor }, |
12 | { "fallback", seat_cmd_fallback }, | 12 | { "fallback", seat_cmd_fallback }, |
13 | { "hide_cursor", seat_cmd_hide_cursor }, | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | struct cmd_results *cmd_seat(int argc, char **argv) { | 16 | struct cmd_results *cmd_seat(int argc, char **argv) { |
diff --git a/sway/commands/hide_cursor.c b/sway/commands/seat/hide_cursor.c index 3778fcff..343573b5 100644 --- a/sway/commands/hide_cursor.c +++ b/sway/commands/seat/hide_cursor.c | |||
@@ -2,15 +2,17 @@ | |||
2 | #include <string.h> | 2 | #include <string.h> |
3 | #include "sway/commands.h" | 3 | #include "sway/commands.h" |
4 | #include "sway/config.h" | 4 | #include "sway/config.h" |
5 | #include "sway/input/cursor.h" | ||
6 | #include "sway/input/seat.h" | 5 | #include "sway/input/seat.h" |
7 | #include "stringop.h" | 6 | #include "stringop.h" |
8 | 7 | ||
9 | struct cmd_results *cmd_hide_cursor(int argc, char **argv) { | 8 | struct cmd_results *seat_cmd_hide_cursor(int argc, char **argv) { |
10 | struct cmd_results *error = NULL; | 9 | struct cmd_results *error = NULL; |
11 | if ((error = checkarg(argc, "hide_cursor", EXPECTED_EQUAL_TO, 1))) { | 10 | if ((error = checkarg(argc, "hide_cursor", EXPECTED_EQUAL_TO, 1))) { |
12 | return error; | 11 | return error; |
13 | } | 12 | } |
13 | if (!config->handler_context.seat_config) { | ||
14 | return cmd_results_new(CMD_FAILURE, "hide_cursor", "No seat defined"); | ||
15 | } | ||
14 | 16 | ||
15 | char *end; | 17 | char *end; |
16 | int timeout = strtol(argv[0], &end, 10); | 18 | int timeout = strtol(argv[0], &end, 10); |
@@ -21,13 +23,7 @@ struct cmd_results *cmd_hide_cursor(int argc, char **argv) { | |||
21 | if (timeout < 100 && timeout != 0) { | 23 | if (timeout < 100 && timeout != 0) { |
22 | timeout = 100; | 24 | timeout = 100; |
23 | } | 25 | } |
24 | config->hide_cursor_timeout = timeout; | 26 | config->handler_context.seat_config->hide_cursor_timeout = timeout; |
25 | |||
26 | struct sway_seat *seat; | ||
27 | wl_list_for_each(seat, &server.input->seats, link) { | ||
28 | wl_event_source_timer_update(seat->cursor->hide_source, | ||
29 | config->hide_cursor_timeout); | ||
30 | } | ||
31 | 27 | ||
32 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 28 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
33 | } | 29 | } |