diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp index 56ab11ae..32c58f5d 100644 --- a/src/events/Layers.cpp +++ b/src/events/Layers.cpp @@ -111,8 +111,8 @@ void Events::listener_mapLayerSurface(void* owner, void* data) { layersurface->layerSurface->mapped = true; layersurface->mapped = true; - - layersurface->surface = layersurface->layerSurface->surface; + layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive; + layersurface->surface = layersurface->layerSurface->surface; // anim layersurface->alpha.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn")); @@ -325,7 +325,7 @@ void Events::listener_commitLayerSurface(void* owner, void* data) { if (layersurface->layerSurface->current.keyboard_interactive && (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) // don't focus if constrained - && g_pCompositor->m_pLastFocus != layersurface->layerSurface->surface) { + && !layersurface->keyboardExclusive) { g_pCompositor->focusSurface(layersurface->layerSurface->surface); const auto LOCAL = @@ -333,10 +333,12 @@ void Events::listener_commitLayerSurface(void* owner, void* data) { wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layersurface->layerSurface->surface, LOCAL.x, LOCAL.y); wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y); } else if (!layersurface->layerSurface->current.keyboard_interactive && (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) && - g_pCompositor->m_pLastFocus == layersurface->layerSurface->surface) { + layersurface->keyboardExclusive) { g_pInputManager->refocus(); } + layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive; + g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y); g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(layersurface->layerSurface->surface, PMONITOR->scale); diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp index 0e5138b3..c70c8406 100644 --- a/src/helpers/WLClasses.hpp +++ b/src/helpers/WLClasses.hpp @@ -21,6 +21,8 @@ struct SLayerSurface { wlr_layer_surface_v1* layerSurface; wl_list link; + bool keyboardExclusive = false; + CWLSurface surface; std::list popupSurfaces;