summaryrefslogtreecommitdiff
path: root/src
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
parent92e17f29256af4db05ebd17b9f2d013ee3ca37ab (diff)
fixed layersurface focus quirks
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp3
-rw-r--r--src/events/Layers.cpp14
2 files changed, 14 insertions, 3 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index f359f577..e1c5ef55 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -619,6 +619,9 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
Debug::log(LOG, "Set keyboard focus to surface %x, with window name: %s", pSurface, pWindowOwner->m_szTitle.c_str());
else
Debug::log(LOG, "Set keyboard focus to surface %x", pSurface);
+
+ g_pXWaylandManager->activateSurface(pSurface, false);
+ m_pLastFocus = pSurface;
}
bool CCompositor::windowValidMapped(CWindow* pWindow) {
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);