summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-05-08 19:11:57 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-05-08 19:12:01 +0100
commite7c2ea9724ef11038b14367587d9b4987708b1d1 (patch)
treeb90f3edb8359145b91fa3e491753492d5c7e5c08 /src
parent826dc61e5cfe292a9967bd4397dcff37672fc194 (diff)
layershell: focus if changed keyboard mode
Diffstat (limited to 'src')
-rw-r--r--src/events/Layers.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp
index fa3e668c..56ab11ae 100644
--- a/src/events/Layers.cpp
+++ b/src/events/Layers.cpp
@@ -323,6 +323,20 @@ 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) {
+ g_pCompositor->focusSurface(layersurface->layerSurface->surface);
+
+ const auto LOCAL =
+ g_pInputManager->getMouseCoordsInternal() - Vector2D(layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y);
+ 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) {
+ g_pInputManager->refocus();
+ }
+
g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y);
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(layersurface->layerSurface->surface, PMONITOR->scale);