From 98059b52d759965916e0185ca35a01cc20a797b6 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 22 Oct 2023 23:32:37 +0100 Subject: [PATCH] layershell: support ON_DEMAND keyboard mode fixes #2264 --- src/events/Layers.cpp | 2 +- src/managers/input/InputManager.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp index a14ae3f9..5762e21a 100644 --- a/src/events/Layers.cpp +++ b/src/events/Layers.cpp @@ -142,7 +142,7 @@ void Events::listener_mapLayerSurface(void* owner, void* data) { wlr_surface_send_enter(layersurface->layerSurface->surface, layersurface->layerSurface->output); - const bool GRABSFOCUS = layersurface->layerSurface->current.keyboard_interactive && + const bool GRABSFOCUS = layersurface->layerSurface->current.keyboard_interactive != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE && // don't focus if constrained (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint); diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 1d8b5135..3fe892c1 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -335,12 +335,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { bool allowKeyboardRefocus = true; - if (*PHOGFOCUS && !refocus && g_pCompositor->m_pLastFocus) { + if (!refocus && g_pCompositor->m_pLastFocus) { const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus); - if (PLS && PLS->layerSurface->current.keyboard_interactive) { + if (PLS && PLS->layerSurface->current.keyboard_interactive == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE) allowKeyboardRefocus = false; - } } // set the values for use @@ -407,7 +406,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { } if (pFoundLayerSurface && - (pFoundLayerSurface->layerSurface->current.keyboard_interactive || (pFoundLayerSurface->layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP && !g_pCompositor->m_pLastWindow)) && + (pFoundLayerSurface->layerSurface->current.keyboard_interactive != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE || + (pFoundLayerSurface->layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP && !g_pCompositor->m_pLastWindow)) && FOLLOWMOUSE != 3 && allowKeyboardRefocus) { g_pCompositor->focusSurface(foundSurface); }