]> git.lizzy.rs Git - bspwm.git/blobdiff - src/messages.c
Handle mapping notify events
[bspwm.git] / src / messages.c
index 20a997de9d1bc5f7e07fd28f0a2bd9c43a51207b..6d9d970323cb749178496157d03ff2b29845a720 100644 (file)
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <stdbool.h>
 #include <stdarg.h>
+#include <inttypes.h>
 #include <unistd.h>
 #include "bspwm.h"
 #include "desktop.h"
@@ -342,6 +343,8 @@ void cmd_node(char **args, int num, FILE *rsp)
                                set_private(trg.monitor, trg.desktop, trg.node, (a == ALTER_SET ? b : !trg.node->private));
                        } else if (streq("locked", key)) {
                                set_locked(trg.monitor, trg.desktop, trg.node, (a == ALTER_SET ? b : !trg.node->locked));
+                       } else if (streq("marked", key)) {
+                               set_marked(trg.monitor, trg.desktop, trg.node, (a == ALTER_SET ? b : !trg.node->marked));
                        } else {
                                fail(rsp, "node %s: Invalid key: '%s'.\n", *(args - 1), key);
                                break;
@@ -633,7 +636,7 @@ void cmd_desktop(char **args, int num, FILE *rsp)
                                        break;
                                }
                        }
-                       focus_node(dst.monitor, dst.desktop, dst.desktop->focus);
+                       focus_node(dst.monitor, dst.desktop, NULL);
                } else if (streq("-a", *args) || streq("--activate", *args)) {
                        coordinates_t dst = trg;
                        if (num > 1 && *(args + 1)[0] != OPT_CHR) {
@@ -644,7 +647,9 @@ void cmd_desktop(char **args, int num, FILE *rsp)
                                        break;
                                }
                        }
-                       if (!activate_desktop(dst.monitor, dst.desktop)) {
+                       if (activate_desktop(dst.monitor, dst.desktop)) {
+                               activate_node(dst.monitor, dst.desktop, NULL);
+                       } else {
                                fail(rsp, "");
                                break;
                        }
@@ -823,7 +828,7 @@ void cmd_monitor(char **args, int num, FILE *rsp)
                                        return;
                                }
                        }
-                       focus_node(dst.monitor, dst.monitor->desk, dst.monitor->desk->focus);
+                       focus_node(dst.monitor, NULL, NULL);
                } else if (streq("-s", *args) || streq("--swap", *args)) {
                        num--, args++;
                        if (num < 1) {
@@ -1550,6 +1555,11 @@ void set_setting(coordinates_t loc, char *name, char *value, FILE *rsp)
                        fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
                        return;
                }
+       } else if (streq("mapping_events_count", name)) {
+               if (sscanf(value, "%" SCNi8, &mapping_events_count) != 1) {
+                       fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
+                       return;
+               }
        } else if (streq("directional_focus_tightness", name)) {
                tightness_t p;
                if (parse_tightness(value, &p)) {
@@ -1713,6 +1723,8 @@ void get_setting(coordinates_t loc, char *name, FILE* rsp)
                fprintf(rsp, "%s", status_prefix);
        } else if (streq("initial_polarity", name)) {
                fprintf(rsp, "%s", CHILD_POL_STR(initial_polarity));
+       } else if (streq("mapping_events_count", name)) {
+               fprintf(rsp, "%" PRIi8, mapping_events_count);
        } else if (streq("directional_focus_tightness", name)) {
                fprintf(rsp, "%s", TIGHTNESS_STR(directional_focus_tightness));
        } else if (streq("pointer_modifier", name)) {