From db2845963408dd0d66a3587469c6f26bfa4d9e1f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 19 Sep 2018 21:54:27 +1000 Subject: Introduce create_output command (for developer use) Should help with testing hotplugging. --- sway/commands.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index 41e1c653..27a88319 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -143,6 +143,7 @@ static struct cmd_handler config_handlers[] = { /* Runtime-only commands. Keep alphabetized */ static struct cmd_handler command_handlers[] = { { "border", cmd_border }, + { "create_output", cmd_create_output }, { "exit", cmd_exit }, { "floating", cmd_floating }, { "fullscreen", cmd_fullscreen }, -- cgit v1.2.3 From efc08ec8880b8078d35f687c7913f787efc85f72 Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 19 Sep 2018 15:21:04 +0200 Subject: Fix segfault when executing command without focus --- sway/commands.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index 41e1c653..32079492 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -215,18 +215,23 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers, static void set_config_node(struct sway_node *node) { config->handler_context.node = node; + config->handler_context.container = NULL; + config->handler_context.workspace = NULL; + + if (node == NULL) { + return; + } + switch (node->type) { case N_CONTAINER: config->handler_context.container = node->sway_container; config->handler_context.workspace = node->sway_container->workspace; break; case N_WORKSPACE: - config->handler_context.container = NULL; config->handler_context.workspace = node->sway_workspace; break; - default: - config->handler_context.container = NULL; - config->handler_context.workspace = NULL; + case N_ROOT: + case N_OUTPUT: break; } } -- cgit v1.2.3