]> git.sur5r.net Git - i3/i3/blobdiff - src/util.c
Bugfix: Repeatedly try to find screens if none are available (Thanks mxf)
[i3/i3] / src / util.c
index 762b9481338a14fa58e3da63561a939cd91c5d23..f2e1a96f349302c8d743edf188a87487094d5492 100644 (file)
@@ -258,15 +258,18 @@ void unmap_workspace(xcb_connection_t *conn, Workspace *u_ws) {
         int unmapped_clients = 0;
         FOR_TABLE(u_ws)
                 CIRCLEQ_FOREACH(client, &(u_ws->table[cols][rows]->clients), clients) {
+                        LOG("unmapping normal client %p / %p / %p\n", client, client->frame, client->child);
                         xcb_unmap_window(conn, client->frame);
                         unmapped_clients++;
                 }
 
         /* To find floating clients, we traverse the focus stack */
         SLIST_FOREACH(client, &(u_ws->focus_stack), focus_clients) {
-                if (client->floating <= FLOATING_USER_OFF)
+                if (!client_is_floating(client))
                         continue;
 
+                LOG("unmapping floating client %p / %p / %p\n", client, client->frame, client->child);
+
                 xcb_unmap_window(conn, client->frame);
                 unmapped_clients++;
         }
@@ -319,6 +322,9 @@ void set_focus(xcb_connection_t *conn, Client *client, bool set_anyways) {
         c_ws->current_row = current_row;
         c_ws->current_col = current_col;
         c_ws = client->workspace;
+        /* Load current_col/current_row if we switch to a client without a container */
+        current_col = c_ws->current_col;
+        current_row = c_ws->current_row;
 
         /* Update container */
         if (client->container != NULL) {
@@ -361,6 +367,22 @@ void set_focus(xcb_connection_t *conn, Client *client, bool set_anyways) {
         if ((old_client != NULL) && (old_client != client) && !old_client->dock)
                 redecorate_window(conn, old_client);
 
+        /* If the last client was a floating client, we need to go to the next
+         * tiling client in stack and re-decorate it. */
+        if (client_is_floating(old_client)) {
+                LOG("Coming from floating client, searching next tiling...\n");
+                Client *current;
+                SLIST_FOREACH(current, &(client->workspace->focus_stack), focus_clients) {
+                        if (client_is_floating(current))
+                                continue;
+
+                        LOG("Found window: %p / child %p\n", current->frame, current->child);
+                        redecorate_window(conn, current);
+                        break;
+                }
+
+        }
+
         SLIST_REMOVE(&(client->workspace->focus_stack), client, Client, focus_clients);
         SLIST_INSERT_HEAD(&(client->workspace->focus_stack), client, focus_clients);