aboutsummarylogtreecommitdiffstats
path: root/0009-Wayland-Fix-cursor-offset-when-shape-changes.patch
diff options
context:
space:
mode:
authorEncryptedCicada2021-12-29 11:37:25 +0530
committerEncryptedCicada2021-12-29 11:37:25 +0530
commitfe976390827d285132270188849f32e956524e1f (patch)
tree6acfd85f786f9eadc5cc26c8a583783a1f4d4171 /0009-Wayland-Fix-cursor-offset-when-shape-changes.patch
parent3c94b47ff80eb81fae96049b4ed1b26657afe390 (diff)
downloadaur-fe976390827d285132270188849f32e956524e1f.tar.gz
Merged Upstream
Diffstat (limited to '0009-Wayland-Fix-cursor-offset-when-shape-changes.patch')
-rw-r--r--0009-Wayland-Fix-cursor-offset-when-shape-changes.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/0009-Wayland-Fix-cursor-offset-when-shape-changes.patch b/0009-Wayland-Fix-cursor-offset-when-shape-changes.patch
new file mode 100644
index 000000000000..40f6b025badf
--- /dev/null
+++ b/0009-Wayland-Fix-cursor-offset-when-shape-changes.patch
@@ -0,0 +1,89 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Waris Boonyasiriwat <wboonyasiriwat@teradici.com>
+Date: Wed, 12 May 2021 00:30:14 -0700
+Subject: Wayland: Fix cursor offset when shape changes
+
+The Wayland protocol spec[1] states that set_cursor must be called
+with the serial number of the enter event. However, GLFW is passing in
+the serial number of the latest received event, which does not meet the
+protocol spec.
+
+[1] https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_pointer
+
+As a result, set_cursor calls were simply ignored by the compositor.
+
+This fix complies with the protocol more closely by specifically caching
+the enter event serial, and using it for all set_cursor calls.
+
+Fixes #1706
+Closes #1899
+---
+ src/wl_init.c | 3 ++-
+ src/wl_platform.h | 1 +
+ src/wl_window.c | 6 +++---
+ 3 files changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/src/wl_init.c b/src/wl_init.c
+index f43a0f82..cc355136 100644
+--- a/src/wl_init.c
++++ b/src/wl_init.c
+@@ -130,6 +130,7 @@ static void pointerHandleEnter(void* data,
+ #endif
+
+ _glfw.wl.serial = serial;
++ _glfw.wl.pointerEnterSerial = serial;
+ _glfw.wl.pointerFocus = window;
+
+ window->wl.hovered = GLFW_TRUE;
+@@ -189,7 +190,7 @@ static void setCursor(_GLFWwindow* window, const char* name)
+ buffer = wl_cursor_image_get_buffer(image);
+ if (!buffer)
+ return;
+- wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial,
++ wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
+ surface,
+ image->hotspot_x / scale,
+ image->hotspot_y / scale);
+diff --git a/src/wl_platform.h b/src/wl_platform.h
+index b6b3392e..18dbd60a 100644
+--- a/src/wl_platform.h
++++ b/src/wl_platform.h
+@@ -262,6 +262,7 @@ typedef struct _GLFWlibraryWayland
+ const char* cursorPreviousName;
+ int cursorTimerfd;
+ uint32_t serial;
++ uint32_t pointerEnterSerial;
+
+ int32_t keyboardRepeatRate;
+ int32_t keyboardRepeatDelay;
+diff --git a/src/wl_window.c b/src/wl_window.c
+index ddf5ad37..23762e08 100644
+--- a/src/wl_window.c
++++ b/src/wl_window.c
+@@ -767,7 +767,7 @@ static void setCursorImage(_GLFWwindow* window,
+ cursorWayland->yhot = image->hotspot_y;
+ }
+
+- wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial,
++ wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
+ surface,
+ cursorWayland->xhot / scale,
+ cursorWayland->yhot / scale);
+@@ -1598,7 +1598,7 @@ static void lockPointer(_GLFWwindow* window)
+ window->wl.pointerLock.relativePointer = relativePointer;
+ window->wl.pointerLock.lockedPointer = lockedPointer;
+
+- wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial,
++ wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
+ NULL, 0, 0);
+ }
+
+@@ -1666,7 +1666,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
+ }
+ else if (window->cursorMode == GLFW_CURSOR_HIDDEN)
+ {
+- wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0);
++ wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0);
+ }
+ }
+