summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornyx <nnyyxxxx@protonmail.com>2025-02-08 09:05:44 -0500
committerGitHub <noreply@github.com>2025-02-08 15:05:44 +0100
commitfeb8ad48f0153a15b96356f280dbd04849db0e04 (patch)
tree4eb8ef02ed1bec351b812ab80e0edd092fe04114 /src
parentf7fcbe32c9f66bcfc86853a5cda95edcf481f573 (diff)
groups: deactivate unfocused windows in groups (#9354)
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp3
-rw-r--r--src/desktop/Window.cpp16
-rw-r--r--src/desktop/Window.hpp1
3 files changed, 20 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index e460bbca..aebb0ac1 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -1189,6 +1189,9 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface
if (*PFOLLOWMOUSE == 0)
g_pInputManager->sendMotionEventsToFocused();
+
+ if (pWindow->m_sGroupData.pNextWindow)
+ pWindow->deactivateGroupMembers();
}
void CCompositor::focusSurface(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindowOwner) {
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index b0d7b58c..7c0cb741 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -1748,3 +1748,19 @@ void CWindow::setContentType(NContentType::eContentType contentType) {
Debug::log(INFO, "ContentType for window {}", (int)contentType);
m_pWLSurface->resource()->contentType->value = contentType;
}
+
+void CWindow::deactivateGroupMembers() {
+ auto curr = getGroupHead();
+ while (curr) {
+ if (curr != m_pSelf.lock()) {
+ if (curr->m_bIsX11)
+ curr->m_pXWaylandSurface->activate(false);
+ else if (curr->m_pXDGSurface && curr->m_pXDGSurface->toplevel)
+ curr->m_pXDGSurface->toplevel->setActive(false);
+ }
+
+ curr = curr->m_sGroupData.pNextWindow.lock();
+ if (curr == getGroupHead())
+ break;
+ }
+}
diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp
index 9a4a36c2..171a15f4 100644
--- a/src/desktop/Window.hpp
+++ b/src/desktop/Window.hpp
@@ -474,6 +474,7 @@ class CWindow {
void sendWindowSize(bool force = false);
NContentType::eContentType getContentType();
void setContentType(NContentType::eContentType contentType);
+ void deactivateGroupMembers();
CBox getWindowMainSurfaceBox() const {
return {m_vRealPosition->value().x, m_vRealPosition->value().y, m_vRealSize->value().x, m_vRealSize->value().y};