You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
807 B
30 lines
807 B
6 years ago
|
#define _POSIX_C_SOURCE 200809L
|
||
|
#include <string.h>
|
||
|
#include "sway/commands.h"
|
||
|
#include "sway/config.h"
|
||
|
#include "sway/input/seat.h"
|
||
|
#include "stringop.h"
|
||
|
|
||
6 years ago
|
struct cmd_results *seat_cmd_hide_cursor(int argc, char **argv) {
|
||
6 years ago
|
struct cmd_results *error = NULL;
|
||
|
if ((error = checkarg(argc, "hide_cursor", EXPECTED_EQUAL_TO, 1))) {
|
||
|
return error;
|
||
|
}
|
||
6 years ago
|
if (!config->handler_context.seat_config) {
|
||
|
return cmd_results_new(CMD_FAILURE, "hide_cursor", "No seat defined");
|
||
|
}
|
||
6 years ago
|
|
||
|
char *end;
|
||
|
int timeout = strtol(argv[0], &end, 10);
|
||
|
if (*end) {
|
||
|
return cmd_results_new(CMD_INVALID, "hide_cursor",
|
||
|
"Expected an integer timeout");
|
||
|
}
|
||
|
if (timeout < 100 && timeout != 0) {
|
||
|
timeout = 100;
|
||
|
}
|
||
6 years ago
|
config->handler_context.seat_config->hide_cursor_timeout = timeout;
|
||
6 years ago
|
|
||
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||
|
}
|