aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c13
1 files changed, 9 insertions, 4 deletions
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,
215 215
216static void set_config_node(struct sway_node *node) { 216static void set_config_node(struct sway_node *node) {
217 config->handler_context.node = node; 217 config->handler_context.node = node;
218 config->handler_context.container = NULL;
219 config->handler_context.workspace = NULL;
220
221 if (node == NULL) {
222 return;
223 }
224
218 switch (node->type) { 225 switch (node->type) {
219 case N_CONTAINER: 226 case N_CONTAINER:
220 config->handler_context.container = node->sway_container; 227 config->handler_context.container = node->sway_container;
221 config->handler_context.workspace = node->sway_container->workspace; 228 config->handler_context.workspace = node->sway_container->workspace;
222 break; 229 break;
223 case N_WORKSPACE: 230 case N_WORKSPACE:
224 config->handler_context.container = NULL;
225 config->handler_context.workspace = node->sway_workspace; 231 config->handler_context.workspace = node->sway_workspace;
226 break; 232 break;
227 default: 233 case N_ROOT:
228 config->handler_context.container = NULL; 234 case N_OUTPUT:
229 config->handler_context.workspace = NULL;
230 break; 235 break;
231 } 236 }
232} 237}