1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-10-08 07:07:25 -04:00

wayland: save serial from all input sources

This commit is contained in:
Ricardo Vieira 2014-09-23 18:24:33 +01:00 committed by linkmauve
parent 2de2589f91
commit 92b3fd02e5
3 changed files with 13 additions and 9 deletions

View File

@ -99,7 +99,7 @@ static void pointerHandleEnter(void* data,
} }
window->wl.decorations.focus = focus; window->wl.decorations.focus = focus;
_glfw.wl.pointerSerial = serial; _glfw.wl.serial = serial;
_glfw.wl.pointerFocus = window; _glfw.wl.pointerFocus = window;
window->wl.hovered = GLFW_TRUE; window->wl.hovered = GLFW_TRUE;
@ -120,7 +120,7 @@ static void pointerHandleLeave(void* data,
window->wl.hovered = GLFW_FALSE; window->wl.hovered = GLFW_FALSE;
_glfw.wl.pointerSerial = serial; _glfw.wl.serial = serial;
_glfw.wl.pointerFocus = NULL; _glfw.wl.pointerFocus = NULL;
_glfwInputCursorEnter(window, GLFW_FALSE); _glfwInputCursorEnter(window, GLFW_FALSE);
} }
@ -158,7 +158,7 @@ static void setCursor(_GLFWwindow* window, const char* name)
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 / scale, image->hotspot_x / scale,
image->hotspot_y / scale); image->hotspot_y / scale);
@ -309,7 +309,7 @@ static void pointerHandleButton(void* data,
if (window->wl.decorations.focus != mainWindow) if (window->wl.decorations.focus != mainWindow)
return; return;
_glfw.wl.pointerSerial = serial; _glfw.wl.serial = serial;
/* Makes left, right and middle 0, 1 and 2. Overall order follows evdev /* Makes left, right and middle 0, 1 and 2. Overall order follows evdev
* codes. */ * codes. */
@ -478,6 +478,7 @@ static void keyboardHandleEnter(void* data,
return; return;
} }
_glfw.wl.serial = serial;
_glfw.wl.keyboardFocus = window; _glfw.wl.keyboardFocus = window;
_glfwInputWindowFocus(window, GLFW_TRUE); _glfwInputWindowFocus(window, GLFW_TRUE);
} }
@ -492,6 +493,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);
} }
@ -575,6 +577,7 @@ static void keyboardHandleKey(void* data,
action = state == WL_KEYBOARD_KEY_STATE_PRESSED action = state == WL_KEYBOARD_KEY_STATE_PRESSED
? GLFW_PRESS : GLFW_RELEASE; ? GLFW_PRESS : GLFW_RELEASE;
_glfw.wl.serial = serial;
_glfwInputKey(window, keyCode, key, action, _glfwInputKey(window, keyCode, key, action,
_glfw.wl.xkb.modifiers); _glfw.wl.xkb.modifiers);
@ -606,6 +609,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

@ -247,7 +247,7 @@ typedef struct _GLFWlibraryWayland
struct wl_cursor_theme* cursorThemeHiDPI; struct wl_cursor_theme* cursorThemeHiDPI;
struct wl_surface* cursorSurface; struct wl_surface* cursorSurface;
int cursorTimerfd; int cursorTimerfd;
uint32_t pointerSerial; uint32_t serial;
int32_t keyboardRepeatRate; int32_t keyboardRepeatRate;
int32_t keyboardRepeatDelay; int32_t keyboardRepeatDelay;

View File

@ -779,7 +779,7 @@ static void setCursorImage(_GLFWwindow* window,
cursorWayland->yhot = image->hotspot_y; 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, surface,
cursorWayland->xhot / scale, cursorWayland->xhot / scale,
cursorWayland->yhot / scale); cursorWayland->yhot / scale);
@ -1501,7 +1501,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);
} }
@ -1565,8 +1565,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);
} }
} }