Bugfix: Correctly adjust state when transferring fullscreen windows to other workspaces (Thanks Mirko)

This fixes ticket #27.
Furthermore, it is ensured that only one client at a time is in fullscreen mode.
This commit is contained in:
Michael Stapelberg 2009-04-17 21:01:33 +02:00
parent 12cc8b78af
commit 49d5bdbb08
2 changed files with 20 additions and 5 deletions

View File

@ -422,6 +422,13 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
t_ws->screen = container->workspace->screen; t_ws->screen = container->workspace->screen;
/* Copy the dimensions from the virtual screen */ /* Copy the dimensions from the virtual screen */
memcpy(&(t_ws->rect), &(container->workspace->screen->rect), sizeof(Rect)); 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]; 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); assert(to_container != NULL);
remove_client_from_container(conn, current_client, container); 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); CIRCLEQ_INSERT_TAIL(&(to_container->clients), current_client, clients);
SLIST_INSERT_HEAD(&(to_container->workspace->focus_stack), current_client, focus_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"); LOG("Moved.\n");
current_client->container = to_container; current_client->container = to_container;

View File

@ -364,11 +364,13 @@ void toggle_fullscreen(xcb_connection_t *conn, Client *client) {
Workspace *workspace = client->container->workspace; Workspace *workspace = client->container->workspace;
workspace->fullscreen_client = (client->fullscreen ? NULL : client); if (!client->fullscreen) {
if (workspace->fullscreen_client != NULL) {
client->fullscreen = !client->fullscreen; LOG("Not entering fullscreen mode, there already is a fullscreen client.\n");
return;
if (client->fullscreen) { }
client->fullscreen = true;
workspace->fullscreen_client = client;
LOG("Entering fullscreen mode...\n"); LOG("Entering fullscreen mode...\n");
/* We just entered fullscreen mode, lets configure the window */ /* We just entered fullscreen mode, lets configure the window */
uint32_t mask = XCB_CONFIG_WINDOW_X | 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); fake_configure_notify(conn, child_rect, client->child);
} else { } else {
LOG("leaving fullscreen mode\n"); LOG("leaving fullscreen mode\n");
client->fullscreen = false;
workspace->fullscreen_client = NULL;
/* Because the coordinates of the window havent changed, it would not be /* Because the coordinates of the window havent changed, it would not be
re-configured if we dont set the following flag */ re-configured if we dont set the following flag */
client->force_reconfigure = true; client->force_reconfigure = true;