From 58db6f753b4281d39be5e423f453891bf9afc6f6 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Mon, 10 Jun 2024 16:54:49 -0700 Subject: [PATCH] layerSurface: forcibly unfocus surfaces when made non interactive --- src/desktop/LayerSurface.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp index d30235a198b..0b2e23a38f3 100644 --- a/src/desktop/LayerSurface.cpp +++ b/src/desktop/LayerSurface.cpp @@ -297,10 +297,13 @@ void CLayerSurface::onCommit() { std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == self.lock(); }); // if the surface was focused and interactive but now isn't, refocus - if (WASLASTFOCUS && !layerSurface->current.interactivity) + if (WASLASTFOCUS && !layerSurface->current.interactivity) { + // moveMouseUnified won't focus non interactive layers but it won't unfocus them either, + // so unfocus the surface here. + g_pCompositor->focusSurface(nullptr); g_pInputManager->refocusLastWindow(g_pCompositor->getMonitorFromID(monitorID)); - else if (!WASEXCLUSIVE && !WASLASTFOCUS && - (ISEXCLUSIVE || (layerSurface->current.interactivity && (g_pSeatManager->mouse.expired() || !g_pInputManager->isConstrained())))) { + } else if (!WASEXCLUSIVE && !WASLASTFOCUS && + (ISEXCLUSIVE || (layerSurface->current.interactivity && (g_pSeatManager->mouse.expired() || !g_pInputManager->isConstrained())))) { // if not focused last and exclusive or accepting input + unconstrained g_pSeatManager->setGrab(nullptr); g_pInputManager->releaseAllMouseButtons();