From e5253ca7375fc59c07b3c7d1356ecff7fadf12b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 15 Feb 2020 19:02:43 +0100 Subject: [PATCH] input: fix xcursor getting stuck Apparently, a frame callback for the cursor surface is *never* triggered if we get a pointer-leave event *before* the callback is triggered. At least on Sway 1.4. This caused the cursor being stuck, and never updating once this state was reached. Fix by destroying the cursor frame callback on pointer-leave. --- input.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/input.c b/input.c index 77355918..c8f920b3 100644 --- a/input.c +++ b/input.c @@ -641,6 +641,14 @@ wl_pointer_leave(void *data, struct wl_pointer *wl_pointer, LOG_DBG("pointer-leave: surface = %p, old-moused = %p", surface, old_moused); + if (wayl->pointer.xcursor_callback != NULL) { + /* A cursor frame callback may never be called if the pointer leaves our surface */ + wl_callback_destroy(wayl->pointer.xcursor_callback); + wayl->pointer.xcursor_callback = NULL; + wayl->pointer.pending_terminal = NULL; + wayl->pointer.xcursor = NULL; + } + wayl->mouse_focus = NULL; if (old_moused == NULL) { LOG_WARN(