|
|
@ -11,8 +11,12 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (config->reading && strcmp("{", argv[1]) == 0) {
|
|
|
|
if (config->reading && strcmp("{", argv[1]) == 0) {
|
|
|
|
current_seat_config = new_seat_config(argv[0]);
|
|
|
|
free_seat_config(config->handler_context.seat_config);
|
|
|
|
wlr_log(L_DEBUG, "entering seat block: %s", current_seat_config->name);
|
|
|
|
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");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
wlr_log(L_DEBUG, "entering seat block: %s", argv[0]);
|
|
|
|
return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL);
|
|
|
|
return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -20,11 +24,18 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
|
|
|
|
return error;
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool has_context = (config->handler_context.seat_config != NULL);
|
|
|
|
|
|
|
|
if (!has_context) {
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int argc_new = argc-2;
|
|
|
|
int argc_new = argc-2;
|
|
|
|
char **argv_new = argv+2;
|
|
|
|
char **argv_new = argv+2;
|
|
|
|
|
|
|
|
|
|
|
|
struct cmd_results *res;
|
|
|
|
struct cmd_results *res;
|
|
|
|
current_seat_config = new_seat_config(argv[0]);
|
|
|
|
|
|
|
|
if (strcasecmp("attach", argv[1]) == 0) {
|
|
|
|
if (strcasecmp("attach", argv[1]) == 0) {
|
|
|
|
res = seat_cmd_attach(argc_new, argv_new);
|
|
|
|
res = seat_cmd_attach(argc_new, argv_new);
|
|
|
|
} else if (strcasecmp("fallback", argv[1]) == 0) {
|
|
|
|
} else if (strcasecmp("fallback", argv[1]) == 0) {
|
|
|
@ -32,6 +43,12 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]);
|
|
|
|
res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
current_seat_config = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
if (!has_context) {
|
|
|
|
|
|
|
|
// clean up the context we created earlier
|
|
|
|
|
|
|
|
free_seat_config(config->handler_context.seat_config);
|
|
|
|
|
|
|
|
config->handler_context.seat_config = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|