From 23e8bf842a44c5aca755469610afb3decf967d7d Mon Sep 17 00:00:00 2001 From: Trianta <56975502+Trimutex@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:10:55 -0500 Subject: [PATCH 1/2] xwayland: deactivate xwayland focus if wayland is focused --- src/xwayland/XWM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp index f6b6864c639..647a966f37e 100644 --- a/src/xwayland/XWM.cpp +++ b/src/xwayland/XWM.cpp @@ -897,7 +897,7 @@ void CXWM::activateSurface(SP surf, bool activate) { if ((surf == focusedSurface && activate) || (surf && surf->overrideRedirect)) return; - if (!surf) { + if (!surf || !activate) { setActiveWindow((uint32_t)XCB_WINDOW_NONE); focusWindow(nullptr); } else { From dc3aa969d31f7779057cddadc377fc8780980931 Mon Sep 17 00:00:00 2001 From: Trianta <56975502+Trimutex@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:35:22 -0500 Subject: [PATCH 2/2] xwayland: deactivate last xwayland surface after focusing wayland --- src/managers/XWaylandManager.cpp | 5 ++++- src/xwayland/XWM.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index f329dbe16f0..2f0632e0510 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -43,8 +43,11 @@ void CHyprXWaylandManager::activateSurface(SP pSurface, bool w->m_pXWaylandSurface->restackToTop(); } w->m_pXWaylandSurface->activate(activate); - } else + } else { w->m_pXDGSurface->toplevel->setActive(activate); + if (g_pCompositor->m_pLastFocus && g_pCompositor->m_pLastWindow->m_bIsX11) + activateSurface(g_pCompositor->m_pLastFocus.lock(), false); + } } } diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp index 647a966f37e..a409b440715 100644 --- a/src/xwayland/XWM.cpp +++ b/src/xwayland/XWM.cpp @@ -897,7 +897,7 @@ void CXWM::activateSurface(SP surf, bool activate) { if ((surf == focusedSurface && activate) || (surf && surf->overrideRedirect)) return; - if (!surf || !activate) { + if (!surf || (!activate && g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsX11)) { setActiveWindow((uint32_t)XCB_WINDOW_NONE); focusWindow(nullptr); } else {