diff --git a/src/commands.c b/src/commands.c index 728c6d7c..9f5be8dc 100644 --- a/src/commands.c +++ b/src/commands.c @@ -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; diff --git a/src/util.c b/src/util.c index 1ac3357d..880be2d6 100644 --- a/src/util.c +++ b/src/util.c @@ -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;