*
* i3 - an improved dynamic tiling window manager
*
- * © 2009 Michael Stapelberg and contributors
+ * © 2009-2010 Michael Stapelberg and contributors
*
* See file LICENSE for license information.
*
*/
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;
}
/* 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;
}
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 */