*/
Con *con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode);
+/**
+ * Returns the fullscreen node that covers the given workspace if it exists.
+ * This is either a CF_GLOBAL fullscreen container anywhere or a CF_OUTPUT
+ * fullscreen container in the workspace.
+ *
+ */
+Con *con_get_fullscreen_covering_ws(Con *ws);
+
/**
* Returns true if the container is internal, such as __i3_scratch
*
/* 3: For floating containers, we also want to raise them on click.
* We will skip handling events on floating cons in fullscreen mode */
- Con *fs = (ws ? con_get_fullscreen_con(ws, CF_OUTPUT) : NULL);
+ Con *fs = con_get_fullscreen_covering_ws(ws);
if (floatingcon != NULL && fs != con) {
/* 4: floating_modifier plus left mouse button drags */
if (mod_pressed && event->detail == XCB_BUTTON_CLICK_LEFT) {
static void cmd_focus_force_focus(Con *con) {
/* Disable fullscreen container in workspace with container to be focused. */
Con *ws = con_get_workspace(con);
- Con *fullscreen_on_ws = (focused && focused->fullscreen_mode == CF_GLOBAL) ? focused : con_get_fullscreen_con(ws, CF_OUTPUT);
+ Con *fullscreen_on_ws = con_get_fullscreen_covering_ws(ws);
if (fullscreen_on_ws && fullscreen_on_ws != con && !con_has_parent(con, fullscreen_on_ws)) {
con_disable_fullscreen(fullscreen_on_ws);
}
return NULL;
}
+/*
+ * Returns the fullscreen node that covers the given workspace if it exists.
+ * This is either a CF_GLOBAL fullscreen container anywhere or a CF_OUTPUT
+ * fullscreen container in the workspace.
+ *
+ */
+Con *con_get_fullscreen_covering_ws(Con *ws) {
+ if (!ws) {
+ return NULL;
+ }
+ Con *fs = con_get_fullscreen_con(croot, CF_GLOBAL);
+ if (!fs) {
+ return con_get_fullscreen_con(ws, CF_OUTPUT);
+ }
+ return fs;
+}
+
/**
* Returns true if the container is internal, such as __i3_scratch
*
DLOG("Configure request!\n");
- Con *workspace = con_get_workspace(con),
- *fullscreen = NULL;
-
- /* There might not be a corresponding workspace for dock cons, therefore we
- * have to be careful here. */
- if (workspace) {
- fullscreen = con_get_fullscreen_con(workspace, CF_OUTPUT);
- if (!fullscreen)
- fullscreen = con_get_fullscreen_con(workspace, CF_GLOBAL);
- }
+ Con *workspace = con_get_workspace(con);
+ Con *fullscreen = con_get_fullscreen_covering_ws(workspace);
if (fullscreen != con && con_is_floating(con) && con_is_leaf(con)) {
/* find the height for the decorations */
/* handle fullscreen containers */
Con *ws = con_get_workspace(nc);
- Con *fs = (ws ? con_get_fullscreen_con(ws, CF_OUTPUT) : NULL);
- if (fs == NULL)
- fs = con_get_fullscreen_con(croot, CF_GLOBAL);
+ Con *fs = con_get_fullscreen_covering_ws(ws);
if (xcb_reply_contains_atom(state_reply, A__NET_WM_STATE_FULLSCREEN)) {
/* If this window is already fullscreen (after restarting!), skip
continue;
}
Con *workspace = TAILQ_FIRST(&(content->focus_head));
- Con *fullscreen = con_get_fullscreen_con(workspace, CF_OUTPUT);
+ Con *fullscreen = con_get_fullscreen_covering_ws(workspace);
Con *child;
TAILQ_FOREACH(child, &(workspace->floating_head), floating_windows) {
if (fullscreen != NULL) {