wayland: save serial from all input sources

This commit is contained in:
Ricardo Vieira 2014-09-23 18:24:33 +01:00
parent de3e413aab
commit 200196dac7
3 changed files with 15 additions and 8 deletions

View File

@ -50,7 +50,7 @@ static void pointerHandleEnter(void* data,
{ {
_GLFWwindow* window = wl_surface_get_user_data(surface); _GLFWwindow* window = wl_surface_get_user_data(surface);
_glfw.wl.pointerSerial = serial; _glfw.wl.serial = serial;
_glfw.wl.pointerFocus = window; _glfw.wl.pointerFocus = window;
_glfwPlatformSetCursor(window, window->wl.currentCursor); _glfwPlatformSetCursor(window, window->wl.currentCursor);
@ -67,7 +67,7 @@ static void pointerHandleLeave(void* data,
if (!window) if (!window)
return; return;
_glfw.wl.pointerSerial = serial; _glfw.wl.serial = serial;
_glfw.wl.pointerFocus = NULL; _glfw.wl.pointerFocus = NULL;
_glfwInputCursorEnter(window, GLFW_FALSE); _glfwInputCursorEnter(window, GLFW_FALSE);
} }
@ -106,6 +106,8 @@ static void pointerHandleButton(void* data,
_GLFWwindow* window = _glfw.wl.pointerFocus; _GLFWwindow* window = _glfw.wl.pointerFocus;
int glfwButton; int glfwButton;
_glfw.wl.serial = serial;
if (!window) if (!window)
return; return;
@ -232,6 +234,7 @@ static void keyboardHandleEnter(void* data,
{ {
_GLFWwindow* window = wl_surface_get_user_data(surface); _GLFWwindow* window = wl_surface_get_user_data(surface);
_glfw.wl.serial = serial;
_glfw.wl.keyboardFocus = window; _glfw.wl.keyboardFocus = window;
_glfwInputWindowFocus(window, GLFW_TRUE); _glfwInputWindowFocus(window, GLFW_TRUE);
} }
@ -246,6 +249,7 @@ static void keyboardHandleLeave(void* data,
if (!window) if (!window)
return; return;
_glfw.wl.serial = serial;
_glfw.wl.keyboardFocus = NULL; _glfw.wl.keyboardFocus = NULL;
_glfwInputWindowFocus(window, GLFW_FALSE); _glfwInputWindowFocus(window, GLFW_FALSE);
} }
@ -272,6 +276,8 @@ static void keyboardHandleKey(void* data,
const xkb_keysym_t *syms; const xkb_keysym_t *syms;
_GLFWwindow* window = _glfw.wl.keyboardFocus; _GLFWwindow* window = _glfw.wl.keyboardFocus;
_glfw.wl.serial = serial;
if (!window) if (!window)
return; return;
@ -308,6 +314,8 @@ static void keyboardHandleModifiers(void* data,
xkb_mod_mask_t mask; xkb_mod_mask_t mask;
unsigned int modifiers = 0; unsigned int modifiers = 0;
_glfw.wl.serial = serial;
if (!_glfw.wl.xkb.keymap) if (!_glfw.wl.xkb.keymap)
return; return;

View File

@ -124,7 +124,7 @@ typedef struct _GLFWlibraryWayland
struct wl_cursor_theme* cursorTheme; struct wl_cursor_theme* cursorTheme;
struct wl_surface* cursorSurface; struct wl_surface* cursorSurface;
uint32_t pointerSerial; uint32_t serial;
_GLFWmonitor** monitors; _GLFWmonitor** monitors;
int monitorsCount; int monitorsCount;

View File

@ -727,7 +727,7 @@ static void lockPointer(_GLFWwindow* window)
window->wl.pointerLock.relativePointer = relativePointer; window->wl.pointerLock.relativePointer = relativePointer;
window->wl.pointerLock.lockedPointer = lockedPointer; 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); NULL, 0, 0);
} }
@ -779,7 +779,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
buffer = wl_cursor_image_get_buffer(image); buffer = wl_cursor_image_get_buffer(image);
if (!buffer) if (!buffer)
return; return;
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial,
surface, surface,
image->hotspot_x, image->hotspot_x,
image->hotspot_y); image->hotspot_y);
@ -790,7 +790,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
} }
else else
{ {
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial,
surface, surface,
cursor->wl.xhot, cursor->wl.xhot,
cursor->wl.yhot); cursor->wl.yhot);
@ -807,8 +807,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
} }
else if (window->cursorMode == GLFW_CURSOR_HIDDEN) else if (window->cursorMode == GLFW_CURSOR_HIDDEN)
{ {
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0);
NULL, 0, 0);
} }
} }