From 40d8fa84919c6d0e9fcb1536f4bc09710d4c031c Mon Sep 17 00:00:00 2001 From: Nikolai Nechaev Date: Wed, 26 Nov 2025 07:44:26 +0900 Subject: compositor: Configurable behavior when window to be focused conflicts with fullscreen (#12033) Renames `misc:new_window_takes_over_fullscreen` into `misc:on_focus_under_fullscreen` and implements the following behavior: - By default, when a tiling window is being focused on a workspace where a fullscreen/maximized window exists, respect the `misc:on_focus_under_fullscreen` config variable. --- src/desktop/state/FocusState.hpp | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/desktop/state/FocusState.hpp (limited to 'src/desktop/state/FocusState.hpp') diff --git a/src/desktop/state/FocusState.hpp b/src/desktop/state/FocusState.hpp new file mode 100644 index 00000000..2bf0953d --- /dev/null +++ b/src/desktop/state/FocusState.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include "../DesktopTypes.hpp" +#include "../../SharedDefs.hpp" + +class CWLSurfaceResource; + +namespace Desktop { + class CFocusState { + public: + CFocusState(); + ~CFocusState() = default; + + CFocusState(CFocusState&&) = delete; + CFocusState(CFocusState&) = delete; + CFocusState(const CFocusState&) = delete; + + void fullWindowFocus(PHLWINDOW w, SP surface = nullptr, bool preserveFocusHistory = false, bool forceFSCycle = false); + void rawWindowFocus(PHLWINDOW w, SP surface = nullptr, bool preserveFocusHistory = false); + void rawSurfaceFocus(SP s, PHLWINDOW pWindowOwner = nullptr); + void rawMonitorFocus(PHLMONITOR m); + + SP surface(); + PHLWINDOW window(); + PHLMONITOR monitor(); + const std::vector& windowHistory(); + + void addWindowToHistory(PHLWINDOW w); + + private: + void removeWindowFromHistory(PHLWINDOW w); + void moveWindowToLatestInHistory(PHLWINDOW w); + + WP m_focusSurface; + PHLWINDOWREF m_focusWindow; + PHLMONITORREF m_focusMonitor; + std::vector m_windowFocusHistory; // first element is the most recently focused + + SP m_windowOpen, m_windowClose; + }; + + SP focusState(); +}; -- cgit v1.2.3