From 7a2027d1fd5d447a6e0f8af8b7d2f8c2e82da7c4 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 3 Aug 2023 18:44:07 +0200 Subject: [PATCH] input: fix and unify client checking in mouseRequests --- src/managers/input/InputManager.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index ca659d6a..1df5acb3 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -470,7 +470,7 @@ void CInputManager::processMouseRequest(wlr_seat_pointer_request_set_cursor_even else g_pHyprRenderer->m_bWindowRequestedCursorHide = false; - if (!cursorImageUnlocked()) + if (!cursorImageUnlocked() || !g_pHyprRenderer->shouldRenderCursor()) return; // cursorSurfaceInfo.pSurface = e->surface; @@ -487,18 +487,11 @@ void CInputManager::processMouseRequest(wlr_seat_pointer_request_set_cursor_even } void CInputManager::processMouseRequest(wlr_cursor_shape_manager_v1_request_set_shape_event* e) { - if (!g_pHyprRenderer->shouldRenderCursor()) + if (!g_pHyprRenderer->shouldRenderCursor() || !cursorImageUnlocked()) return; - if (!g_pCompositor->m_pLastFocus) - return; - - if (wl_resource_get_client(g_pCompositor->m_pLastFocus->resource) != e->seat_client->client) { - Debug::log(ERR, "Disallowing cursor shape request from unfocused"); - return; - } - - wlr_cursor_set_xcursor(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sWLRXCursorMgr, wlr_cursor_shape_v1_name(e->shape)); + if (e->seat_client == g_pCompositor->m_sSeat.seat->pointer_state.focused_client) + wlr_cursor_set_xcursor(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sWLRXCursorMgr, wlr_cursor_shape_v1_name(e->shape)); } bool CInputManager::cursorImageUnlocked() {