summaryrefslogtreecommitdiffstats
path: root/sway/commands
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-12-27 00:32:15 -0500
committerLibravatar emersion <contact@emersion.fr>2018-12-30 14:17:24 +0100
commit4d88c957905e7f6b2c8188d218ca22b3e6986fe4 (patch)
tree5f34ad1667607315cfbcb786ce71845a36595d82 /sway/commands
parentVerify seat fallback settings on reload (diff)
downloadsway-4d88c957905e7f6b2c8188d218ca22b3e6986fe4.tar.gz
sway-4d88c957905e7f6b2c8188d218ca22b3e6986fe4.tar.zst
sway-4d88c957905e7f6b2c8188d218ca22b3e6986fe4.zip
hide_cursor: change to a seat subcommand
This makes hide_cursor a seat subcommand, which allows for seat specific timeouts.
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/seat.c1
-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
15struct cmd_results *cmd_seat(int argc, char **argv) { 16struct 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
9struct cmd_results *cmd_hide_cursor(int argc, char **argv) { 8struct 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}