diff options
author | MightyPlaza <[email protected]> | 2024-06-11 20:56:35 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-06-11 22:56:35 +0200 |
commit | b6bf4afb4861c7a7b41c6bf53daadf57a708e352 (patch) | |
tree | 4092fdd8efd14190ee49fba2dac406e54e483df6 /src | |
parent | e1b05f8eafd8cd3e7e9197fa1db92391174b9206 (diff) | |
download | Hyprland-b6bf4afb4861c7a7b41c6bf53daadf57a708e352.tar.gz Hyprland-b6bf4afb4861c7a7b41c6bf53daadf57a708e352.zip |
layer: don't close special ws when restoring focus (#6424)
modified: src/Compositor.cpp
modified: src/Compositor.hpp
modified: src/managers/input/InputManager.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/Compositor.cpp | 11 | ||||
-rw-r--r-- | src/Compositor.hpp | 1 | ||||
-rw-r--r-- | src/managers/input/InputManager.cpp | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 8b19f010..7d33889e 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1111,6 +1111,17 @@ bool CCompositor::isWorkspaceVisible(PHLWORKSPACE w) { return valid(w) && w->m_bVisible; } +bool CCompositor::isWorkspaceVisibleNotCovered(PHLWORKSPACE w) { + if (!valid(w)) + return false; + + const auto PMONITOR = getMonitorFromID(w->m_iMonitorID); + if (PMONITOR->activeSpecialWorkspace) + return PMONITOR->activeSpecialWorkspace->m_iID == w->m_iID; + + return PMONITOR->activeWorkspace->m_iID == w->m_iID; +} + PHLWORKSPACE CCompositor::getWorkspaceByID(const int& id) { for (auto& w : m_vWorkspaces) { if (w->m_iID == id && !w->inert()) diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 793899ee..458e37a7 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -118,6 +118,7 @@ class CCompositor { PHLWINDOW getWindowFromSurface(SP<CWLSurfaceResource>); PHLWINDOW getWindowFromHandle(uint32_t); bool isWorkspaceVisible(PHLWORKSPACE); + bool isWorkspaceVisibleNotCovered(PHLWORKSPACE); PHLWORKSPACE getWorkspaceByID(const int&); PHLWORKSPACE getWorkspaceByName(const std::string&); PHLWORKSPACE getWorkspaceByString(const std::string&); diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 3e412b27..033f4d6d 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1409,7 +1409,7 @@ void CInputManager::refocusLastWindow(CMonitor* pMonitor) { foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface); - if (!foundSurface && g_pCompositor->m_pLastWindow.lock() && g_pCompositor->isWorkspaceVisible(g_pCompositor->m_pLastWindow->m_pWorkspace)) { + if (!foundSurface && g_pCompositor->m_pLastWindow.lock() && g_pCompositor->isWorkspaceVisibleNotCovered(g_pCompositor->m_pLastWindow->m_pWorkspace)) { // then the last focused window if we're on the same workspace as it const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock(); g_pCompositor->focusWindow(PLASTWINDOW); |