diff --git a/glfw/wl_init.c b/glfw/wl_init.c index 9069f4515..62c44e8f2 100644 --- a/glfw/wl_init.c +++ b/glfw/wl_init.c @@ -113,7 +113,7 @@ static void pointerHandleEnter(void* data UNUSED, } window->wl.decorations.focus = focus; - _glfw.wl.pointerSerial = serial; + _glfw.wl.serial = serial; _glfw.wl.pointerFocus = window; window->wl.hovered = true; @@ -134,7 +134,7 @@ static void pointerHandleLeave(void* data UNUSED, window->wl.hovered = false; - _glfw.wl.pointerSerial = serial; + _glfw.wl.serial = serial; _glfw.wl.pointerFocus = NULL; _glfwInputCursorEnter(window, false); _glfw.wl.cursorPreviousShape = GLFW_INVALID_CURSOR; @@ -164,7 +164,7 @@ static void setCursor(GLFWCursorShape shape, _GLFWwindow* window) buffer = wl_cursor_image_get_buffer(image); if (!buffer) return; - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, surface, image->hotspot_x / scale, image->hotspot_y / scale); @@ -308,7 +308,7 @@ static void pointerHandleButton(void* data UNUSED, if (window->wl.decorations.focus != mainWindow) return; - _glfw.wl.pointerSerial = serial; + _glfw.wl.serial = serial; /* Makes left, right and middle 0, 1 and 2. Overall order follows evdev * codes. */ @@ -379,7 +379,7 @@ static void keyboardHandleKeymap(void* data UNUSED, static void keyboardHandleEnter(void* data UNUSED, struct wl_keyboard* keyboard UNUSED, - uint32_t serial UNUSED, + uint32_t serial, struct wl_surface* surface, struct wl_array* keys) { @@ -395,6 +395,7 @@ static void keyboardHandleEnter(void* data UNUSED, return; } + _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = window; _glfwInputWindowFocus(window, true); uint32_t* key; @@ -410,7 +411,7 @@ static void keyboardHandleEnter(void* data UNUSED, static void keyboardHandleLeave(void* data UNUSED, struct wl_keyboard* keyboard UNUSED, - uint32_t serial UNUSED, + uint32_t serial, struct wl_surface* surface UNUSED) { _GLFWwindow* window = _glfw.wl.keyboardFocus; @@ -418,6 +419,7 @@ static void keyboardHandleLeave(void* data UNUSED, if (!window) return; + _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = NULL; _glfwInputWindowFocus(window, false); toggleTimer(&_glfw.wl.eventLoopData, _glfw.wl.keyRepeatInfo.keyRepeatTimer, 0); @@ -434,7 +436,7 @@ dispatchPendingKeyRepeats(id_type timer_id UNUSED, void *data UNUSED) { static void keyboardHandleKey(void* data UNUSED, struct wl_keyboard* keyboard UNUSED, - uint32_t serial UNUSED, + uint32_t serial, uint32_t time UNUSED, uint32_t key, uint32_t state) @@ -443,6 +445,8 @@ static void keyboardHandleKey(void* data UNUSED, if (!window) return; int action = state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE; + + _glfw.wl.serial = serial; glfw_xkb_handle_key_event(window, &_glfw.wl.xkb, key, action); bool repeatable = false; _glfw.wl.keyRepeatInfo.key = 0; @@ -461,12 +465,13 @@ static void keyboardHandleKey(void* data UNUSED, static void keyboardHandleModifiers(void* data UNUSED, struct wl_keyboard* keyboard UNUSED, - uint32_t serial UNUSED, + uint32_t serial, uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group) { + _glfw.wl.serial = serial; glfw_xkb_update_modifiers(&_glfw.wl.xkb, modsDepressed, modsLatched, modsLocked, 0, 0, group); } diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index 759d4c6ac..6d3d26ff3 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -228,7 +228,7 @@ typedef struct _GLFWlibraryWayland struct wl_surface* cursorSurface; GLFWCursorShape cursorPreviousShape; - uint32_t pointerSerial; + uint32_t serial; int32_t keyboardRepeatRate; monotonic_t keyboardRepeatDelay; diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 830d5dda4..a794b26cc 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -85,7 +85,7 @@ setCursorImage(_GLFWwindow* window) cursorWayland->yhot = image->hotspot_y; } - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, surface, cursorWayland->xhot / scale, cursorWayland->yhot / scale); @@ -1466,7 +1466,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.pointerSerial, + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0); } @@ -1502,8 +1502,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) } else if (window->cursorMode == GLFW_CURSOR_HIDDEN) { - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, - NULL, 0, 0); + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0); } }