From b814ba98a7c74e29afe4e5e543ee6d0283a67d67 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 2 Oct 2023 16:27:32 +0100 Subject: [PATCH] misc: add misc:new_window_takes_over_fullscreen referenced in #3474 --- src/config/ConfigManager.cpp | 69 ++++++++++++++++++------------------ src/events/Windows.cpp | 9 +++-- 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index cffd2587..d639df0c 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -89,40 +89,41 @@ void CConfigManager::setDefaultVars() { configValues["general:layout"].strValue = "dwindle"; configValues["general:allow_tearing"].intValue = 0; - configValues["misc:disable_hyprland_logo"].intValue = 0; - configValues["misc:disable_splash_rendering"].intValue = 0; - configValues["misc:disable_hypr_chan"].intValue = 0; - configValues["misc:force_hypr_chan"].intValue = 0; - configValues["misc:vfr"].intValue = 1; - configValues["misc:vrr"].intValue = 0; - configValues["misc:mouse_move_enables_dpms"].intValue = 0; - configValues["misc:key_press_enables_dpms"].intValue = 0; - configValues["misc:always_follow_on_dnd"].intValue = 1; - configValues["misc:layers_hog_keyboard_focus"].intValue = 1; - configValues["misc:animate_manual_resizes"].intValue = 0; - configValues["misc:animate_mouse_windowdragging"].intValue = 0; - configValues["misc:disable_autoreload"].intValue = 0; - configValues["misc:enable_swallow"].intValue = 0; - configValues["misc:swallow_regex"].strValue = STRVAL_EMPTY; - configValues["misc:swallow_exception_regex"].strValue = STRVAL_EMPTY; - configValues["misc:focus_on_activate"].intValue = 0; - configValues["misc:no_direct_scanout"].intValue = 1; - configValues["misc:hide_cursor_on_touch"].intValue = 1; - configValues["misc:mouse_move_focuses_monitor"].intValue = 1; - configValues["misc:render_ahead_of_time"].intValue = 0; - configValues["misc:render_ahead_safezone"].intValue = 1; - configValues["misc:cursor_zoom_factor"].floatValue = 1.f; - configValues["misc:cursor_zoom_rigid"].intValue = 0; - configValues["misc:allow_session_lock_restore"].intValue = 0; - configValues["misc:groupbar_scrolling"].intValue = 1; - configValues["misc:group_insert_after_current"].intValue = 1; - configValues["misc:group_focus_removed_window"].intValue = 1; - configValues["misc:render_titles_in_groupbar"].intValue = 1; - configValues["misc:groupbar_titles_font_size"].intValue = 8; - configValues["misc:groupbar_gradients"].intValue = 1; - configValues["misc:close_special_on_empty"].intValue = 1; - configValues["misc:groupbar_text_color"].intValue = 0xffffffff; - configValues["misc:background_color"].intValue = 0xff111111; + configValues["misc:disable_hyprland_logo"].intValue = 0; + configValues["misc:disable_splash_rendering"].intValue = 0; + configValues["misc:disable_hypr_chan"].intValue = 0; + configValues["misc:force_hypr_chan"].intValue = 0; + configValues["misc:vfr"].intValue = 1; + configValues["misc:vrr"].intValue = 0; + configValues["misc:mouse_move_enables_dpms"].intValue = 0; + configValues["misc:key_press_enables_dpms"].intValue = 0; + configValues["misc:always_follow_on_dnd"].intValue = 1; + configValues["misc:layers_hog_keyboard_focus"].intValue = 1; + configValues["misc:animate_manual_resizes"].intValue = 0; + configValues["misc:animate_mouse_windowdragging"].intValue = 0; + configValues["misc:disable_autoreload"].intValue = 0; + configValues["misc:enable_swallow"].intValue = 0; + configValues["misc:swallow_regex"].strValue = STRVAL_EMPTY; + configValues["misc:swallow_exception_regex"].strValue = STRVAL_EMPTY; + configValues["misc:focus_on_activate"].intValue = 0; + configValues["misc:no_direct_scanout"].intValue = 1; + configValues["misc:hide_cursor_on_touch"].intValue = 1; + configValues["misc:mouse_move_focuses_monitor"].intValue = 1; + configValues["misc:render_ahead_of_time"].intValue = 0; + configValues["misc:render_ahead_safezone"].intValue = 1; + configValues["misc:cursor_zoom_factor"].floatValue = 1.f; + configValues["misc:cursor_zoom_rigid"].intValue = 0; + configValues["misc:allow_session_lock_restore"].intValue = 0; + configValues["misc:groupbar_scrolling"].intValue = 1; + configValues["misc:group_insert_after_current"].intValue = 1; + configValues["misc:group_focus_removed_window"].intValue = 1; + configValues["misc:render_titles_in_groupbar"].intValue = 1; + configValues["misc:groupbar_titles_font_size"].intValue = 8; + configValues["misc:groupbar_gradients"].intValue = 1; + configValues["misc:close_special_on_empty"].intValue = 1; + configValues["misc:groupbar_text_color"].intValue = 0xffffffff; + configValues["misc:background_color"].intValue = 0xff111111; + configValues["misc:new_window_takes_over_fullscreen"].intValue = 0; configValues["debug:int"].intValue = 0; configValues["debug:log_damage"].intValue = 0; diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 2ea4e46c..b870f01d 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -46,6 +46,7 @@ void Events::listener_mapWindow(void* owner, void* data) { static auto* const PSWALLOW = &g_pConfigManager->getConfigValuePtr("misc:enable_swallow")->intValue; static auto* const PSWALLOWREGEX = &g_pConfigManager->getConfigValuePtr("misc:swallow_regex")->strValue; static auto* const PSWALLOWEXREGEX = &g_pConfigManager->getConfigValuePtr("misc:swallow_exception_regex")->strValue; + static auto* const PNEWTAKESOVERFS = &g_pConfigManager->getConfigValuePtr("misc:new_window_takes_over_fullscreen")->intValue; auto PMONITOR = g_pCompositor->m_pLastMonitor; const auto PWORKSPACE = @@ -467,8 +468,12 @@ void Events::listener_mapWindow(void* owner, void* data) { const auto PLSFROMFOCUS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus); if (PLSFROMFOCUS && PLSFROMFOCUS->layerSurface->current.keyboard_interactive) PWINDOW->m_bNoInitialFocus = true; - if (PWORKSPACE->m_bHasFullscreenWindow && !requestsFullscreen) - PWINDOW->m_bNoInitialFocus = true; + if (PWORKSPACE->m_bHasFullscreenWindow && !requestsFullscreen) { + if (*PNEWTAKESOVERFS == 0) + PWINDOW->m_bNoInitialFocus = true; + else + requestsFullscreen = true; + } if (!PWINDOW->m_bNoFocus && !PWINDOW->m_bNoInitialFocus && (PWINDOW->m_iX11Type != 2 || (PWINDOW->m_bIsX11 && wlr_xwayland_or_surface_wants_focus(PWINDOW->m_uSurface.xwayland))) && !workspaceSilent &&