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 27a88319..07169f1e 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -216,18 +216,23 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers,
216 216
217static void set_config_node(struct sway_node *node) { 217static void set_config_node(struct sway_node *node) {
218 config->handler_context.node = node; 218 config->handler_context.node = node;
219 config->handler_context.container = NULL;
220 config->handler_context.workspace = NULL;
221
222 if (node == NULL) {
223 return;
224 }
225
219 switch (node->type) { 226 switch (node->type) {
220 case N_CONTAINER: 227 case N_CONTAINER:
221 config->handler_context.container = node->sway_container; 228 config->handler_context.container = node->sway_container;
222 config->handler_context.workspace = node->sway_container->workspace; 229 config->handler_context.workspace = node->sway_container->workspace;
223 break; 230 break;
224 case N_WORKSPACE: 231 case N_WORKSPACE:
225 config->handler_context.container = NULL;
226 config->handler_context.workspace = node->sway_workspace; 232 config->handler_context.workspace = node->sway_workspace;
227 break; 233 break;
228 default: 234 case N_ROOT:
229 config->handler_context.container = NULL; 235 case N_OUTPUT:
230 config->handler_context.workspace = NULL;
231 break; 236 break;
232 } 237 }
233} 238}