]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Correctly adjust state when transferring fullscreen windows to other workspac...
authorMichael Stapelberg <michael+x200@stapelberg.de>
Fri, 17 Apr 2009 19:01:33 +0000 (21:01 +0200)
committerMichael Stapelberg <michael+x200@stapelberg.de>
Fri, 17 Apr 2009 19:01:33 +0000 (21:01 +0200)
This fixes ticket #27.
Furthermore, it is ensured that only one client at a time is in fullscreen mode.

src/commands.c
src/util.c

index 728c6d7c2713902f6605ba353cac52bbd342f4c1..9f5be8dc002bdd8b4b412fa8c2294a3bb7812b19 100644 (file)
@@ -422,6 +422,13 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
                 t_ws->screen = container->workspace->screen;
                 /* Copy the dimensions from the virtual screen */
                memcpy(&(t_ws->rect), &(container->workspace->screen->rect), sizeof(Rect));
+        } else {
+                /* Check if there is already a fullscreen client on the destination workspace and
+                 * stop moving if so. */
+                if (current_client->fullscreen && (t_ws->fullscreen_client != NULL)) {
+                        LOG("Not moving: Fullscreen client already existing on destination workspace.\n");
+                        return;
+                }
         }
 
         Container *to_container = t_ws->table[t_ws->current_col][t_ws->current_row];
@@ -429,9 +436,13 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
         assert(to_container != NULL);
 
         remove_client_from_container(conn, current_client, container);
+        if (container->workspace->fullscreen_client == current_client)
+                container->workspace->fullscreen_client = NULL;
 
         CIRCLEQ_INSERT_TAIL(&(to_container->clients), current_client, clients);
         SLIST_INSERT_HEAD(&(to_container->workspace->focus_stack), current_client, focus_clients);
+        if (current_client->fullscreen)
+                t_ws->fullscreen_client = current_client;
         LOG("Moved.\n");
 
         current_client->container = to_container;
index 1ac3357d048e28daa75c14cbd7e6759cee6433f9..880be2d6526d48d72c6db9ed0e8d11e2a504c68d 100644 (file)
@@ -364,11 +364,13 @@ void toggle_fullscreen(xcb_connection_t *conn, Client *client) {
 
         Workspace *workspace = client->container->workspace;
 
-        workspace->fullscreen_client = (client->fullscreen ? NULL : client);
-
-        client->fullscreen = !client->fullscreen;
-
-        if (client->fullscreen) {
+        if (!client->fullscreen) {
+                if (workspace->fullscreen_client != NULL) {
+                        LOG("Not entering fullscreen mode, there already is a fullscreen client.\n");
+                        return;
+                }
+                client->fullscreen = true;
+                workspace->fullscreen_client = client;
                 LOG("Entering fullscreen mode...\n");
                 /* We just entered fullscreen mode, let’s configure the window */
                  uint32_t mask = XCB_CONFIG_WINDOW_X |
@@ -399,6 +401,8 @@ void toggle_fullscreen(xcb_connection_t *conn, Client *client) {
                 fake_configure_notify(conn, child_rect, client->child);
         } else {
                 LOG("leaving fullscreen mode\n");
+                client->fullscreen = false;
+                workspace->fullscreen_client = NULL;
                 /* Because the coordinates of the window haven’t changed, it would not be
                    re-configured if we don’t set the following flag */
                 client->force_reconfigure = true;