From: Ingo Bürk Date: Fri, 24 Aug 2018 07:49:41 +0000 (+0200) Subject: Merge pull request #3368 from orestisf1993/render_root X-Git-Tag: 4.16~53 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=commitdiff_plain;h=4cba9fcbdab1487459014dbf8882f5f34e61435e;hp=9a53d65e1886034fdb059e47febc59cbf1e41d51 Merge pull request #3368 from orestisf1993/render_root (floating) global fullscreen bugs & others --- diff --git a/include/con.h b/include/con.h index 58123a87..672d80ac 100644 --- a/include/con.h +++ b/include/con.h @@ -120,6 +120,14 @@ Con *con_parent_with_orientation(Con *con, orientation_t orientation); */ 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 * diff --git a/src/click.c b/src/click.c index 81e95dfa..1218a4c2 100644 --- a/src/click.c +++ b/src/click.c @@ -254,7 +254,7 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod /* 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) { diff --git a/src/commands.c b/src/commands.c index 0874eec2..0343f9dc 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1272,7 +1272,7 @@ void cmd_focus_direction(I3_CMD, const char *direction) { 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); } diff --git a/src/con.c b/src/con.c index f20f7c35..253d1d54 100644 --- a/src/con.c +++ b/src/con.c @@ -509,6 +509,23 @@ Con *con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode) { 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 * @@ -1694,8 +1711,7 @@ adjacent_t con_adjacent_borders(Con *con) { * */ int con_border_style(Con *con) { - Con *fs = con_get_fullscreen_con(con->parent, CF_OUTPUT); - if (fs == con) { + if (con->fullscreen_mode == CF_OUTPUT || con->fullscreen_mode == CF_GLOBAL) { DLOG("this one is fullscreen! overriding BS_NONE\n"); return BS_NONE; } diff --git a/src/handlers.c b/src/handlers.c index 5d0a6c62..0b6858d9 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -310,16 +310,12 @@ static void handle_configure_request(xcb_configure_request_event_t *event) { 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); + if (workspace && (strcmp(workspace->name, "__i3_scratch") == 0)) { + DLOG("This is a scratchpad container, ignoring ConfigureRequest\n"); + goto out; } + 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 */ @@ -332,12 +328,6 @@ static void handle_configure_request(xcb_configure_request_event_t *event) { bsr.height -= deco_height; } Con *floatingcon = con->parent; - - if (strcmp(con_get_workspace(floatingcon)->name, "__i3_scratch") == 0) { - DLOG("This is a scratchpad container, ignoring ConfigureRequest\n"); - return; - } - Rect newrect = floatingcon->rect; if (event->value_mask & XCB_CONFIG_WINDOW_X) { @@ -395,15 +385,14 @@ static void handle_configure_request(xcb_configure_request_event_t *event) { DLOG("Dock client will not be moved, we only support moving it to another output.\n"); } } - fake_absolute_configure_notify(con); - return; + goto out; } if (event->value_mask & XCB_CONFIG_WINDOW_STACK_MODE) { DLOG("window 0x%08x wants to be stacked %d\n", event->window, event->stack_mode); /* Emacs and IntelliJ Idea “request focus” by stacking their window - * above all others. */ + * above all others. */ if (event->stack_mode != XCB_STACK_MODE_ABOVE) { DLOG("stack_mode != XCB_STACK_MODE_ABOVE, ignoring ConfigureRequest\n"); goto out; @@ -414,23 +403,17 @@ static void handle_configure_request(xcb_configure_request_event_t *event) { goto out; } - Con *ws = con_get_workspace(con); - if (ws == NULL) { + if (workspace == NULL) { DLOG("Window is not being managed, ignoring ConfigureRequest\n"); goto out; } - if (strcmp(ws->name, "__i3_scratch") == 0) { - DLOG("This is a scratchpad container, ignoring ConfigureRequest\n"); - goto out; - } - - if (config.focus_on_window_activation == FOWA_FOCUS || (config.focus_on_window_activation == FOWA_SMART && workspace_is_visible(ws))) { + if (config.focus_on_window_activation == FOWA_FOCUS || (config.focus_on_window_activation == FOWA_SMART && workspace_is_visible(workspace))) { DLOG("Focusing con = %p\n", con); - workspace_show(ws); + workspace_show(workspace); con_activate(con); tree_render(); - } else if (config.focus_on_window_activation == FOWA_URGENT || (config.focus_on_window_activation == FOWA_SMART && !workspace_is_visible(ws))) { + } else if (config.focus_on_window_activation == FOWA_URGENT || (config.focus_on_window_activation == FOWA_SMART && !workspace_is_visible(workspace))) { DLOG("Marking con = %p urgent\n", con); con_set_urgency(con, true); tree_render(); diff --git a/src/manage.c b/src/manage.c index b4d0af95..f97ecc62 100644 --- a/src/manage.c +++ b/src/manage.c @@ -378,9 +378,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki /* 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 diff --git a/src/render.c b/src/render.c index dafccbb1..d8bffc61 100644 --- a/src/render.c +++ b/src/render.c @@ -234,25 +234,22 @@ static void render_root(Con *con, Con *fullscreen) { 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) { - /* Don’t render floating windows when there is a fullscreen window - * on that workspace. Necessary to make floating fullscreen work - * correctly (ticket #564). */ - /* If there is no fullscreen->window, this cannot be a - * transient window, so we _know_ we need to skip it. This - * happens during restarts where the container already exists, - * but the window was not yet associated. */ - if (fullscreen != NULL && fullscreen->window == NULL) - continue; - if (fullscreen != NULL && fullscreen->window != NULL) { + if (fullscreen != NULL) { + /* Don’t render floating windows when there is a fullscreen + * window on that workspace. Necessary to make floating + * fullscreen work correctly (ticket #564). Exception to the + * above rule: smart popup_during_fullscreen handling (popups + * belonging to the fullscreen app will be rendered). */ + if (config.popup_during_fullscreen != PDF_SMART) { + continue; + } + Con *floating_child = con_descend_focused(child); Con *transient_con = floating_child; bool is_transient_for = false; - /* Exception to the above rule: smart - * popup_during_fullscreen handling (popups belonging to - * the fullscreen app will be rendered). */ while (transient_con != NULL && transient_con->window != NULL && transient_con->window->transient_for != XCB_NONE) {