From 200196dac74647121a04d35a4abe082136ae7b46 Mon Sep 17 00:00:00 2001 From: Ricardo Vieira Date: Tue, 23 Sep 2014 18:24:33 +0100 Subject: [PATCH] wayland: save serial from all input sources --- src/wl_init.c | 12 ++++++++++-- src/wl_platform.h | 2 +- src/wl_window.c | 9 ++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 29509ae91..1923e28b6 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -50,7 +50,7 @@ static void pointerHandleEnter(void* data, { _GLFWwindow* window = wl_surface_get_user_data(surface); - _glfw.wl.pointerSerial = serial; + _glfw.wl.serial = serial; _glfw.wl.pointerFocus = window; _glfwPlatformSetCursor(window, window->wl.currentCursor); @@ -67,7 +67,7 @@ static void pointerHandleLeave(void* data, if (!window) return; - _glfw.wl.pointerSerial = serial; + _glfw.wl.serial = serial; _glfw.wl.pointerFocus = NULL; _glfwInputCursorEnter(window, GLFW_FALSE); } @@ -106,6 +106,8 @@ static void pointerHandleButton(void* data, _GLFWwindow* window = _glfw.wl.pointerFocus; int glfwButton; + _glfw.wl.serial = serial; + if (!window) return; @@ -232,6 +234,7 @@ static void keyboardHandleEnter(void* data, { _GLFWwindow* window = wl_surface_get_user_data(surface); + _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = window; _glfwInputWindowFocus(window, GLFW_TRUE); } @@ -246,6 +249,7 @@ static void keyboardHandleLeave(void* data, if (!window) return; + _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = NULL; _glfwInputWindowFocus(window, GLFW_FALSE); } @@ -272,6 +276,8 @@ static void keyboardHandleKey(void* data, const xkb_keysym_t *syms; _GLFWwindow* window = _glfw.wl.keyboardFocus; + _glfw.wl.serial = serial; + if (!window) return; @@ -308,6 +314,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 100b12bc0..dcb9ca4df 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -124,7 +124,7 @@ typedef struct _GLFWlibraryWayland struct wl_cursor_theme* cursorTheme; struct wl_surface* cursorSurface; - uint32_t pointerSerial; + uint32_t serial; _GLFWmonitor** monitors; int monitorsCount; diff --git a/src/wl_window.c b/src/wl_window.c index b3b9bea23..cff6b65ee 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -727,7 +727,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); } @@ -779,7 +779,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) 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, image->hotspot_y); @@ -790,7 +790,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) } else { - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, surface, cursor->wl.xhot, cursor->wl.yhot); @@ -807,8 +807,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); } }