summaryrefslogtreecommitdiff
path: root/src/events/Layers.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-08 13:19:57 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-08 13:19:57 +0200
commit84820631579178854db2ed5bce064bcfe8490ed9 (patch)
treea193abd8776e232134eedb3f9ccb50a887ea2651 /src/events/Layers.cpp
parent92e17f29256af4db05ebd17b9f2d013ee3ca37ab (diff)
fixed layersurface focus quirks
Diffstat (limited to 'src/events/Layers.cpp')
-rw-r--r--src/events/Layers.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp
index d924935b..8bbb2bf6 100644
--- a/src/events/Layers.cpp
+++ b/src/events/Layers.cpp
@@ -121,6 +121,11 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
if (layersurface->layerSurface->current.keyboard_interactive)
g_pCompositor->focusSurface(layersurface->layerSurface->surface);
+ // mouse enter always, keeb only when needed
+ 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);
+
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
@@ -153,14 +158,17 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
if (layersurface->layerSurface->mapped)
layersurface->layerSurface->mapped = false;
- if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus)
- g_pCompositor->m_pLastFocus = nullptr;
-
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
if (!PMONITOR)
return;
+ // refocus if needed
+ if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus) {
+ g_pCompositor->m_pLastFocus = nullptr;
+ g_pInputManager->refocus();
+ }
+
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed);