From 4dfe61c2d4fbe022dfaed18b4e54f3341d20011b Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 8 Mar 2010 11:12:02 +0100 Subject: [PATCH] Fixes for the last commit: check outputs instead of workspaces, correctly reset state when switching workspaces, little style fixes --- src/client.c | 23 ++++++++++++++--------- src/workspace.c | 9 ++++++--- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/client.c b/src/client.c index f5e7718e..9c136ca6 100644 --- a/src/client.c +++ b/src/client.c @@ -3,7 +3,7 @@ * * i3 - an improved dynamic tiling window manager * - * © 2009 Michael Stapelberg and contributors + * © 2009-2010 Michael Stapelberg and contributors * * 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) { Workspace *workspace; + Output *output; Rect r; if (global) { - TAILQ_FOREACH(workspace, workspaces, workspaces) { - if (workspace->fullscreen_client == NULL && workspace->fullscreen_client != client) + TAILQ_FOREACH(output, &outputs, outputs) { + if (!output->active) + continue; + + if (output->current_workspace->fullscreen_client == NULL) continue; - LOG("Not entering global fullscreen mode, there already is a fullscreen client.\n"); + LOG("Not entering global fullscreen mode, there already " + "is a fullscreen client on output %s.\n", output->name); return; } @@ -172,19 +177,19 @@ void client_enter_fullscreen(xcb_connection_t *conn, Client *client, bool global /* Set fullscreen_client for each active workspace. * Expand the rectangle to contain all outputs. */ TAILQ_FOREACH(output, &outputs, outputs) { - if(!output->active) + if (!output->active) continue; output->current_workspace->fullscreen_client = client; /* 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; - if(r.y > output->rect.y) + if (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; - 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; } diff --git a/src/workspace.c b/src/workspace.c index f3cc24c8..94d6a068 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -145,11 +145,14 @@ void workspace_show(xcb_connection_t *conn, int workspace) { redecorate_window(conn, old_client); else xcb_flush(conn); - /* We need to check, if a global fullscreen-client is blocking the t_ws and if - * necessary switch that to local fullscreen */ + /* We need to check if a global fullscreen-client is blocking + * the t_ws and if necessary switch that to local fullscreen */ 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); + } } /* Check if we need to change something or if we’re already there */ -- 2.39.5