From b0d5e4008b96f2cdbb6f6c2449c790d921d1546b Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Tue, 12 Sep 2023 14:37:08 -0700 Subject: layout: Allow the layout to control how windows are raised in groups (#3275) * Allow the layout to control how windows are raised in groups Previously windows could only be focused if they weren't hidden or were part of a group. This shifts the logic for picking the window out of a group to the layout allowing for alternate group implementations to function normally. * Fix doc comment consistency * Fix tabs in comments --- src/layout/IHyprLayout.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/layout/IHyprLayout.cpp') diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index b0c1d50c..5466282f 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -535,12 +535,22 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) { return PWINDOWCANDIDATE; } -void IHyprLayout::requestFocusForWindow(CWindow* pWindow) { +bool IHyprLayout::isWindowReachable(CWindow* pWindow) { + return pWindow && (!pWindow->isHidden() || pWindow->m_sGroupData.pNextWindow); +} + +void IHyprLayout::bringWindowToTop(CWindow* pWindow) { + if (pWindow == nullptr) + return; + if (pWindow->isHidden() && pWindow->m_sGroupData.pNextWindow) { // grouped, change the current to this window pWindow->setGroupCurrent(pWindow); } +} +void IHyprLayout::requestFocusForWindow(CWindow* pWindow) { + bringWindowToTop(pWindow); g_pCompositor->focusWindow(pWindow); } -- cgit v1.2.3