Skip to content

Commit

Permalink
groups: deactivate unfocused windows in groups (#9354)
Browse files Browse the repository at this point in the history
  • Loading branch information
nnyyxxxx authored Feb 8, 2025
1 parent f7fcbe3 commit feb8ad4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
16 changes: 16 additions & 0 deletions src/desktop/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
1 change: 1 addition & 0 deletions src/desktop/Window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit feb8ad4

Please sign in to comment.