mirror of
https://github.com/swaywm/sway.git
synced 2025-11-07 13:29:56 -05:00
hide_cursor: change to a seat subcommand
This makes hide_cursor a seat subcommand, which allows for seat specific timeouts.
This commit is contained in:
parent
09bb71f650
commit
4d88c95790
14 changed files with 54 additions and 30 deletions
|
|
@ -10,6 +10,7 @@ static struct cmd_handler seat_handlers[] = {
|
|||
{ "attach", seat_cmd_attach },
|
||||
{ "cursor", seat_cmd_cursor },
|
||||
{ "fallback", seat_cmd_fallback },
|
||||
{ "hide_cursor", seat_cmd_hide_cursor },
|
||||
};
|
||||
|
||||
struct cmd_results *cmd_seat(int argc, char **argv) {
|
||||
|
|
|
|||
|
|
@ -2,15 +2,17 @@
|
|||
#include <string.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/input/cursor.h"
|
||||
#include "sway/input/seat.h"
|
||||
#include "stringop.h"
|
||||
|
||||
struct cmd_results *cmd_hide_cursor(int argc, char **argv) {
|
||||
struct cmd_results *seat_cmd_hide_cursor(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "hide_cursor", EXPECTED_EQUAL_TO, 1))) {
|
||||
return error;
|
||||
}
|
||||
if (!config->handler_context.seat_config) {
|
||||
return cmd_results_new(CMD_FAILURE, "hide_cursor", "No seat defined");
|
||||
}
|
||||
|
||||
char *end;
|
||||
int timeout = strtol(argv[0], &end, 10);
|
||||
|
|
@ -21,13 +23,7 @@ struct cmd_results *cmd_hide_cursor(int argc, char **argv) {
|
|||
if (timeout < 100 && timeout != 0) {
|
||||
timeout = 100;
|
||||
}
|
||||
config->hide_cursor_timeout = timeout;
|
||||
|
||||
struct sway_seat *seat;
|
||||
wl_list_for_each(seat, &server.input->seats, link) {
|
||||
wl_event_source_timer_update(seat->cursor->hide_source,
|
||||
config->hide_cursor_timeout);
|
||||
}
|
||||
config->handler_context.seat_config->hide_cursor_timeout = timeout;
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue