Fixes for the last commit: check outputs instead of workspaces, correctly reset state when switching workspaces, little style fixes

This commit is contained in:
Michael Stapelberg 2010-03-08 11:12:02 +01:00
parent 9c77b0f9a1
commit 4dfe61c2d4
2 changed files with 20 additions and 12 deletions

View File

@ -3,7 +3,7 @@
* *
* i3 - an improved dynamic tiling window manager * i3 - an improved dynamic tiling window manager
* *
* © 2009 Michael Stapelberg and contributors * © 2009-2010 Michael Stapelberg and contributors
* *
* See file LICENSE for license information. * See file LICENSE for license information.
* *
@ -155,14 +155,19 @@ bool client_matches_class_name(Client *client, char *to_class, char *to_title,
*/ */
void client_enter_fullscreen(xcb_connection_t *conn, Client *client, bool global) { void client_enter_fullscreen(xcb_connection_t *conn, Client *client, bool global) {
Workspace *workspace; Workspace *workspace;
Output *output;
Rect r; Rect r;
if (global) { if (global) {
TAILQ_FOREACH(workspace, workspaces, workspaces) { TAILQ_FOREACH(output, &outputs, outputs) {
if (workspace->fullscreen_client == NULL && workspace->fullscreen_client != client) if (!output->active)
continue; continue;
LOG("Not entering global fullscreen mode, there already is a fullscreen client.\n"); if (output->current_workspace->fullscreen_client == NULL)
continue;
LOG("Not entering global fullscreen mode, there already "
"is a fullscreen client on output %s.\n", output->name);
return; return;
} }
@ -172,19 +177,19 @@ void client_enter_fullscreen(xcb_connection_t *conn, Client *client, bool global
/* Set fullscreen_client for each active workspace. /* Set fullscreen_client for each active workspace.
* Expand the rectangle to contain all outputs. */ * Expand the rectangle to contain all outputs. */
TAILQ_FOREACH(output, &outputs, outputs) { TAILQ_FOREACH(output, &outputs, outputs) {
if(!output->active) if (!output->active)
continue; continue;
output->current_workspace->fullscreen_client = client; output->current_workspace->fullscreen_client = client;
/* Temporarily abuse width/heigth as coordinates of the lower right corner */ /* Temporarily abuse width/heigth as coordinates of the lower right corner */
if(r.x > output->rect.x) if (r.x > output->rect.x)
r.x = output->rect.x; r.x = output->rect.x;
if(r.y > output->rect.y) if (r.y > output->rect.y)
r.y = output->rect.y; r.y = output->rect.y;
if(r.x + r.width < output->rect.x + output->rect.width) if (r.x + r.width < output->rect.x + output->rect.width)
r.width = output->rect.x + output->rect.width; r.width = output->rect.x + output->rect.width;
if(r.y + r.height < output->rect.y + output->rect.height) if (r.y + r.height < output->rect.y + output->rect.height)
r.height = output->rect.y + output->rect.height; r.height = output->rect.y + output->rect.height;
} }

View File

@ -145,11 +145,14 @@ void workspace_show(xcb_connection_t *conn, int workspace) {
redecorate_window(conn, old_client); redecorate_window(conn, old_client);
else xcb_flush(conn); else xcb_flush(conn);
/* We need to check, if a global fullscreen-client is blocking the t_ws and if /* We need to check if a global fullscreen-client is blocking
* necessary switch that to local fullscreen */ * the t_ws and if necessary switch that to local fullscreen */
Client* client = c_ws->fullscreen_client; Client* client = c_ws->fullscreen_client;
if (client != NULL && client->workspace != c_ws) if (client != NULL && client->workspace != c_ws) {
if (c_ws->fullscreen_client->workspace != c_ws)
c_ws->fullscreen_client = NULL;
client_enter_fullscreen(conn, client, false); client_enter_fullscreen(conn, client, false);
}
} }
/* Check if we need to change something or if were already there */ /* Check if we need to change something or if were already there */