summaryrefslogtreecommitdiff
path: root/src/desktop/state/FocusState.hpp
diff options
context:
space:
mode:
authorNikolai Nechaev <nikolay_nechaev@mail.ru>2025-11-26 07:44:26 +0900
committerGitHub <noreply@github.com>2025-11-25 22:44:26 +0000
commit40d8fa84919c6d0e9fcb1536f4bc09710d4c031c (patch)
treee45044c92e5d8f716f2aa15668c61fed5aaf5895 /src/desktop/state/FocusState.hpp
parent1c1746de61a90dbbae072f3fc618c45af33fdd59 (diff)
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.
Diffstat (limited to 'src/desktop/state/FocusState.hpp')
-rw-r--r--src/desktop/state/FocusState.hpp43
1 files changed, 43 insertions, 0 deletions
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<CWLSurfaceResource> surface = nullptr, bool preserveFocusHistory = false, bool forceFSCycle = false);
+ void rawWindowFocus(PHLWINDOW w, SP<CWLSurfaceResource> surface = nullptr, bool preserveFocusHistory = false);
+ void rawSurfaceFocus(SP<CWLSurfaceResource> s, PHLWINDOW pWindowOwner = nullptr);
+ void rawMonitorFocus(PHLMONITOR m);
+
+ SP<CWLSurfaceResource> surface();
+ PHLWINDOW window();
+ PHLMONITOR monitor();
+ const std::vector<PHLWINDOWREF>& windowHistory();
+
+ void addWindowToHistory(PHLWINDOW w);
+
+ private:
+ void removeWindowFromHistory(PHLWINDOW w);
+ void moveWindowToLatestInHistory(PHLWINDOW w);
+
+ WP<CWLSurfaceResource> m_focusSurface;
+ PHLWINDOWREF m_focusWindow;
+ PHLMONITORREF m_focusMonitor;
+ std::vector<PHLWINDOWREF> m_windowFocusHistory; // first element is the most recently focused
+
+ SP<HOOK_CALLBACK_FN> m_windowOpen, m_windowClose;
+ };
+
+ SP<CFocusState> focusState();
+};