chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / gl / glfw3 / 0009-Defer-setting-cursor-position-until-the-cursor-is-lo.patch
blob70cec99815e9b682a2409b221dc63095558debb6
1 From 9997ae55a47de469ea26f8437c30b51483abda5f Mon Sep 17 00:00:00 2001
2 From: Dan Klishch <danilklishch@gmail.com>
3 Date: Sat, 30 Sep 2023 23:38:05 -0400
4 Subject: Defer setting cursor position until the cursor is locked
6 ---
7 src/wl_platform.h | 3 +++
8 src/wl_window.c | 14 ++++++++++++--
9 2 files changed, 15 insertions(+), 2 deletions(-)
11 diff --git a/src/wl_platform.h b/src/wl_platform.h
12 index ca34f66e..cd1f227f 100644
13 --- a/src/wl_platform.h
14 +++ b/src/wl_platform.h
15 @@ -403,6 +403,9 @@ typedef struct _GLFWwindowWayland
16 int scaleSize;
17 int compositorPreferredScale;
19 + double askedCursorPosX, askedCursorPosY;
20 + GLFWbool didAskForSetCursorPos;
22 struct zwp_relative_pointer_v1* relativePointer;
23 struct zwp_locked_pointer_v1* lockedPointer;
24 struct zwp_confined_pointer_v1* confinedPointer;
25 diff --git a/src/wl_window.c b/src/wl_window.c
26 index 1de26558..0df16747 100644
27 --- a/src/wl_window.c
28 +++ b/src/wl_window.c
29 @@ -2586,8 +2586,9 @@ void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos)
31 void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y)
33 - _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
34 - "Wayland: The platform does not support setting the cursor position");
35 + window->wl.didAskForSetCursorPos = true;
36 + window->wl.askedCursorPosX = x;
37 + window->wl.askedCursorPosY = y;
40 void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode)
41 @@ -2819,6 +2820,15 @@ static const struct zwp_relative_pointer_v1_listener relativePointerListener =
42 static void lockedPointerHandleLocked(void* userData,
43 struct zwp_locked_pointer_v1* lockedPointer)
45 + _GLFWwindow* window = userData;
47 + if (window->wl.didAskForSetCursorPos)
48 + {
49 + window->wl.didAskForSetCursorPos = false;
50 + zwp_locked_pointer_v1_set_cursor_position_hint(window->wl.lockedPointer,
51 + wl_fixed_from_double(window->wl.askedCursorPosX),
52 + wl_fixed_from_double(window->wl.askedCursorPosY));
53 + }
56 static void lockedPointerHandleUnlocked(void* userData,
57 --
58 2.42.0