2018-12-17 21:37:15 +01:00
|
|
|
#define _POSIX_C_SOURCE 200809L
|
|
|
|
#include <string.h>
|
|
|
|
#include "sway/commands.h"
|
|
|
|
#include "sway/config.h"
|
|
|
|
#include "sway/input/seat.h"
|
|
|
|
#include "stringop.h"
|
|
|
|
|
2018-12-27 06:32:15 +01:00
|
|
|
struct cmd_results *seat_cmd_hide_cursor(int argc, char **argv) {
|
2018-12-17 21:37:15 +01:00
|
|
|
struct cmd_results *error = NULL;
|
|
|
|
if ((error = checkarg(argc, "hide_cursor", EXPECTED_EQUAL_TO, 1))) {
|
|
|
|
return error;
|
|
|
|
}
|
2018-12-27 06:32:15 +01:00
|
|
|
if (!config->handler_context.seat_config) {
|
2019-01-11 00:27:21 +01:00
|
|
|
return cmd_results_new(CMD_FAILURE, "No seat defined");
|
2018-12-27 06:32:15 +01:00
|
|
|
}
|
2018-12-17 21:37:15 +01:00
|
|
|
|
|
|
|
char *end;
|
|
|
|
int timeout = strtol(argv[0], &end, 10);
|
|
|
|
if (*end) {
|
2019-01-11 00:27:21 +01:00
|
|
|
return cmd_results_new(CMD_INVALID, "Expected an integer timeout");
|
2018-12-17 21:37:15 +01:00
|
|
|
}
|
|
|
|
if (timeout < 100 && timeout != 0) {
|
|
|
|
timeout = 100;
|
|
|
|
}
|
2018-12-27 06:32:15 +01:00
|
|
|
config->handler_context.seat_config->hide_cursor_timeout = timeout;
|
2018-12-17 21:37:15 +01:00
|
|
|
|
2019-01-11 00:27:21 +01:00
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
2018-12-17 21:37:15 +01:00
|
|
|
}
|