From 3a2c0aaa27666e5bd534c91787498a002fab93ed Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 15 Nov 2019 15:30:41 +0100 Subject: [PATCH] =?UTF-8?q?Wayland:=20Don=E2=80=99t=20reload=20the=20curso?= =?UTF-8?q?r=20on=20every=20pointer=20motion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, any pointer motion in the window decorations when using the fallback implementation would obtain the wl_cursor again, and do the attach danse for no benefit. This will ultimately allow animated cursors to not reset to the first frame on motion, once these will be implemented. (cherry picked from commit a9f674e719cd663560418de2a7fa1147ce6c6c9b) --- src/wl_init.c | 6 ++++-- src/wl_platform.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 292de1c3..74874692 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -169,6 +169,7 @@ static void setCursor(_GLFWwindow* window, const char* name) wl_surface_damage(surface, 0, 0, image->width, image->height); wl_surface_commit(surface); + _glfw.wl.cursorPreviousName = name; } static void pointerHandleMotion(void* data, @@ -178,7 +179,7 @@ static void pointerHandleMotion(void* data, wl_fixed_t sy) { _GLFWwindow* window = _glfw.wl.pointerFocus; - const char* cursorName; + const char* cursorName = NULL; if (!window) return; @@ -227,7 +228,8 @@ static void pointerHandleMotion(void* data, default: assert(0); } - setCursor(window, cursorName); + if (_glfw.wl.cursorPreviousName != cursorName) + setCursor(window, cursorName); } static void pointerHandleButton(void* data, diff --git a/src/wl_platform.h b/src/wl_platform.h index 940e57ee..41a7fdfa 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -249,6 +249,7 @@ typedef struct _GLFWlibraryWayland struct wl_cursor_theme* cursorTheme; struct wl_cursor_theme* cursorThemeHiDPI; struct wl_surface* cursorSurface; + const char* cursorPreviousName; int cursorTimerfd; uint32_t serial;