diff --git a/src/wl_init.c b/src/wl_init.c index 4a51f38c..6a10e14a 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -99,7 +99,7 @@ static void pointerHandleEnter(void* data, } window->wl.decorations.focus = focus; - _glfw.wl.pointerSerial = serial; + _glfw.wl.serial = serial; _glfw.wl.pointerFocus = window; window->wl.hovered = GLFW_TRUE; @@ -120,7 +120,7 @@ static void pointerHandleLeave(void* data, window->wl.hovered = GLFW_FALSE; - _glfw.wl.pointerSerial = serial; + _glfw.wl.serial = serial; _glfw.wl.pointerFocus = NULL; _glfwInputCursorEnter(window, GLFW_FALSE); } @@ -158,7 +158,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.pointerSerial, + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, surface, image->hotspot_x / scale, image->hotspot_y / scale); @@ -309,7 +309,7 @@ static void pointerHandleButton(void* data, 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. */ @@ -478,6 +478,7 @@ static void keyboardHandleEnter(void* data, return; } + _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = window; _glfwInputWindowFocus(window, GLFW_TRUE); } @@ -492,6 +493,7 @@ static void keyboardHandleLeave(void* data, if (!window) return; + _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = NULL; _glfwInputWindowFocus(window, GLFW_FALSE); } @@ -575,6 +577,7 @@ static void keyboardHandleKey(void* data, action = state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE; + _glfw.wl.serial = serial; _glfwInputKey(window, keyCode, key, action, _glfw.wl.xkb.modifiers); @@ -606,6 +609,8 @@ static void keyboardHandleModifiers(void* data, xkb_mod_mask_t mask; unsigned int modifiers = 0; + _glfw.wl.serial = serial; + if (!_glfw.wl.xkb.keymap) return; diff --git a/src/wl_platform.h b/src/wl_platform.h index 2cf64969..973013e2 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -247,7 +247,7 @@ typedef struct _GLFWlibraryWayland struct wl_cursor_theme* cursorThemeHiDPI; struct wl_surface* cursorSurface; int cursorTimerfd; - uint32_t pointerSerial; + uint32_t serial; int32_t keyboardRepeatRate; int32_t keyboardRepeatDelay; diff --git a/src/wl_window.c b/src/wl_window.c index c1d24f23..3cfc9f7f 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -779,7 +779,7 @@ static void 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); @@ -1501,7 +1501,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); } @@ -1565,8 +1565,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); } }