]> git.lizzy.rs Git - bspwm.git/commitdiff
Initialize the destination location early
authorBastien Dejean <nihilhill@gmail.com>
Tue, 8 Sep 2020 08:58:12 +0000 (10:58 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Tue, 8 Sep 2020 08:58:12 +0000 (10:58 +0200)
Fixes #1196.
Closes #1197.

src/query.c

index ba0445808a7288c3ba21d61487bd9cdb6c14579f..5181413a4e762932e622a12db6efd8491d36a33d 100644 (file)
@@ -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;