summaryrefslogtreecommitdiff
path: root/src/managers/input/InputManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-02-28 23:06:46 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-02-28 23:06:46 +0000
commit07b98952bc09f61d85895c49504b681de8687975 (patch)
treee082e7146b06c4bd984bfb28d8b1a0c10e316255 /src/managers/input/InputManager.cpp
parentcd2399715d84ac4bfa07acc2afe1ade7a2fbb3a2 (diff)
Reset cursor to pointer on focus on interactable deco
Diffstat (limited to 'src/managers/input/InputManager.cpp')
-rw-r--r--src/managers/input/InputManager.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 70b42be3..e712f4af 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -308,6 +308,16 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
setCursorIconOnBorder(pFoundWindow);
}
+ // if we're on an input deco, reset cursor
+ if (!VECINRECT(m_vLastCursorPosFloored, pFoundWindow->m_vRealPosition.vec().x, pFoundWindow->m_vRealPosition.vec().y,
+ pFoundWindow->m_vRealPosition.vec().x + pFoundWindow->m_vRealSize.vec().x, pFoundWindow->m_vRealPosition.vec().y + pFoundWindow->m_vRealSize.vec().y)) {
+ wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", g_pCompositor->m_sWLRCursor);
+ cursorSurfaceInfo.bUsed = false;
+ } else if (!cursorSurfaceInfo.bUsed) {
+ cursorSurfaceInfo.bUsed = true;
+ wlr_cursor_set_surface(g_pCompositor->m_sWLRCursor, cursorSurfaceInfo.pSurface, cursorSurfaceInfo.vHotspot.x, cursorSurfaceInfo.vHotspot.y);
+ }
+
if (*PFOLLOWMOUSE != 1 && !refocus) {
if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow &&
((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) {
@@ -400,6 +410,15 @@ void CInputManager::processMouseRequest(wlr_seat_pointer_request_set_cursor_even
return;
}
+ cursorSurfaceInfo.pSurface = e->surface;
+
+ if (e->surface) {
+ hyprListener_CursorSurfaceDestroy.removeCallback();
+ hyprListener_CursorSurfaceDestroy.initCallback(
+ &e->surface->events.destroy, [&](void* owner, void* data) { cursorSurfaceInfo.pSurface = nullptr; }, this, "InputManager");
+ cursorSurfaceInfo.vHotspot = {e->hotspot_x, e->hotspot_y};
+ }
+
if (e->seat_client == g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
wlr_cursor_set_surface(g_pCompositor->m_sWLRCursor, e->surface, e->hotspot_x, e->hotspot_y);
}