From 8e6f769d6f4657cf20ec59ecb4e23219daa27e75 Mon Sep 17 00:00:00 2001 From: Bastien Dejean Date: Tue, 8 Sep 2020 10:58:12 +0200 Subject: [PATCH] Initialize the destination location early Fixes #1196. Closes #1197. --- src/query.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/query.c b/src/query.c index ba04458..5181413 100644 --- a/src/query.c +++ b/src/query.c @@ -527,6 +527,8 @@ monitor_select_t make_monitor_select(void) int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst) { + dst->node = NULL; + coordinates_t ref_copy = *ref; ref = &ref_copy; char *desc_copy = copy_string(desc, strlen(desc)); @@ -565,8 +567,6 @@ int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst) return SELECTOR_BAD_MODIFIERS; } - dst->node = NULL; - direction_t dir; cycle_dir_t cyc; history_dir_t hdi; @@ -676,6 +676,8 @@ int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst) int desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst) { + dst->desktop = NULL; + if (*desc == '%') { locate_desktop(desc + 1, dst); goto end; @@ -708,8 +710,6 @@ int desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst) return SELECTOR_BAD_MODIFIERS; } - dst->desktop = NULL; - cycle_dir_t cyc; history_dir_t hdi; uint16_t idx; @@ -794,6 +794,8 @@ end: int monitor_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst) { + dst->monitor = NULL; + if (*desc == '%') { locate_monitor(desc + 1, dst); goto end; @@ -825,8 +827,6 @@ int monitor_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst) return SELECTOR_BAD_MODIFIERS; } - dst->monitor = NULL; - direction_t dir; cycle_dir_t cyc; history_dir_t hdi; -- 2.44.0