]> git.lizzy.rs Git - bspwm.git/blobdiff - restore.c
Implement ICCCM's WM_TAKE_FOCUS behavior
[bspwm.git] / restore.c
index d5a8569b9035436c35597dd767e7a19d6a6da247..31b573dedb61b869bc151cce7acc69d503a197e4 100644 (file)
--- a/restore.c
+++ b/restore.c
@@ -39,6 +39,11 @@ void restore_tree(char *file_path)
                 m = mon_head;
             else
                 m = m->next;
+            if (m == NULL) {
+                aborted = true;
+                break;
+            }
+            d = NULL;
             if (len >= 2)
                 switch (line[len - 2]) {
                     case '#':
@@ -53,6 +58,10 @@ void restore_tree(char *file_path)
                 d = m->desk_head;
             else
                 d = d->next;
+            if (d == NULL) {
+                aborted = true;
+                break;
+            }
             int i = len - 1;
             while (i > 0 && !isupper(line[i]))
                 i--;
@@ -103,13 +112,14 @@ void restore_tree(char *file_path)
             } else {
                 client_t *c = make_client(XCB_NONE);
                 num_clients++;
-                char floating, transient, fullscreen, urgent, locked;
-                sscanf(line + level, "%c %s %X %u %hux%hu%hi%hi %c%c%c%c%c", &br, c->class_name, &c->window, &c->border_width, &c->floating_rectangle.width, &c->floating_rectangle.height, &c->floating_rectangle.x, &c->floating_rectangle.y, &floating, &transient, &fullscreen, &urgent, &locked);
+                char floating, transient, fullscreen, urgent, locked, split_mode;
+                sscanf(line + level, "%c %s %X %u %hux%hu%hi%hi %c%c%c%c%c%c", &br, c->class_name, &c->window, &c->border_width, &c->floating_rectangle.width, &c->floating_rectangle.height, &c->floating_rectangle.x, &c->floating_rectangle.y, &floating, &transient, &fullscreen, &urgent, &locked, &split_mode);
                 c->floating = (floating == '-' ? false : true);
                 c->transient = (transient == '-' ? false : true);
                 c->fullscreen = (fullscreen == '-' ? false : true);
                 c->urgent = (urgent == '-' ? false : true);
                 c->locked = (locked == '-' ? false : true);
+                n->split_mode = (split_mode == '-' ? false : true);
                 n->client = c;
                 if (len >= 2 && line[len - 2] == '*')
                     d->focus = n;