2017-12-14 17:11:56 +01:00
|
|
|
#include <string.h>
|
|
|
|
#include <strings.h>
|
|
|
|
#include "sway/commands.h"
|
|
|
|
#include "sway/input/input-manager.h"
|
|
|
|
#include "log.h"
|
2018-05-30 19:20:02 +02:00
|
|
|
#include "stringop.h"
|
|
|
|
|
|
|
|
// must be in order for the bsearch
|
|
|
|
static struct cmd_handler seat_handlers[] = {
|
|
|
|
{ "attach", seat_cmd_attach },
|
|
|
|
{ "cursor", seat_cmd_cursor },
|
|
|
|
{ "fallback", seat_cmd_fallback },
|
|
|
|
};
|
2017-12-14 17:11:56 +01:00
|
|
|
|
|
|
|
struct cmd_results *cmd_seat(int argc, char **argv) {
|
|
|
|
struct cmd_results *error = NULL;
|
2018-05-30 19:20:02 +02:00
|
|
|
if ((error = checkarg(argc, "seat", EXPECTED_AT_LEAST, 1))) {
|
2017-12-14 17:11:56 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2018-05-30 19:20:02 +02:00
|
|
|
config->handler_context.seat_config = new_seat_config(argv[0]);
|
|
|
|
if (!config->handler_context.seat_config) {
|
|
|
|
return cmd_results_new(CMD_FAILURE, NULL,
|
|
|
|
"Couldn't allocate config");
|
2017-12-14 17:11:56 +01:00
|
|
|
}
|
|
|
|
|
2018-05-30 19:20:02 +02:00
|
|
|
struct cmd_results *res = subcommand(argv + 1, argc - 1, seat_handlers,
|
|
|
|
sizeof(seat_handlers));
|
2018-01-20 17:44:34 +01:00
|
|
|
|
2018-05-30 19:20:02 +02:00
|
|
|
free_seat_config(config->handler_context.seat_config);
|
|
|
|
config->handler_context.seat_config = NULL;
|
2018-01-20 17:44:34 +01:00
|
|
|
|
2017-12-19 11:26:55 +01:00
|
|
|
return res;
|
2017-12-14 17:11:56 +01:00
|
|
|
}
|