]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Create new workspace when there are no free existing ones to assign (Thanks...
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 28 Sep 2009 16:02:11 +0000 (18:02 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 28 Sep 2009 16:02:11 +0000 (18:02 +0200)
As the workspaces are now created dynamically, we cannot rely on
the workspaces to be there when we need them without creating them.
On the other hand, this eliminates the case that there are no workspaces
to assign to a new screen, because now we can just create one.

src/workspace.c
src/xinerama.c

index 94759cebc3c5ad0fd314f2e5a1b6c0a867baaa32..4663dfae0c7b1018c00a3fbc4ed5cf4927dbed45 100644 (file)
@@ -344,13 +344,14 @@ Workspace *get_first_workspace_for_screen(struct screens_head *slist, i3Screen *
                 }
         }
 
-        if (result != NULL) {
-                workspace_initialize(result, screen);
-                return result;
+        if (result == NULL) {
+                LOG("No existing free workspace found to assign, creating a new one\n");
+
+                result = workspace_get(num_workspaces);
         }
 
-        LOG("WARNING: No free workspace found to assign!\n");
-        return NULL;
+        workspace_initialize(result, screen);
+        return result;
 }
 
 /*
index db5b94673053adde85e7c45777ba742a565aa759..77da7bbf96a91ffc8820cb541f81515c3a50e1e3 100644 (file)
@@ -354,6 +354,7 @@ void xinerama_requery_screens(xcb_connection_t *conn) {
                         LOG("getting first ws for screen %p\n", screen);
                         Workspace *ws = get_first_workspace_for_screen(new_screens, screen);
                         initialize_screen(conn, screen, ws);
+                        ws->reassigned = true;
 
                         /* As this workspace just got visible (we got a new screen
                          * without workspace), we need to map its clients */