Wayland: Don’t update cursor position in the frame

From upstream: a80788c17f.
This commit is contained in:
Luflosi 2019-11-22 12:38:56 +01:00
parent 1b4a6da577
commit 468468ab9f
No known key found for this signature in database
GPG Key ID: 4E41E29EDCC345D0

20
glfw/wl_init.c vendored
View File

@ -176,43 +176,45 @@ static void pointerHandleMotion(void* data UNUSED,
{ {
_GLFWwindow* window = _glfw.wl.pointerFocus; _GLFWwindow* window = _glfw.wl.pointerFocus;
GLFWCursorShape cursorShape = GLFW_ARROW_CURSOR; GLFWCursorShape cursorShape = GLFW_ARROW_CURSOR;
double x, y;
if (!window) if (!window)
return; return;
if (window->cursorMode == GLFW_CURSOR_DISABLED) if (window->cursorMode == GLFW_CURSOR_DISABLED)
return; return;
window->wl.cursorPosX = wl_fixed_to_double(sx); x = wl_fixed_to_double(sx);
window->wl.cursorPosY = wl_fixed_to_double(sy); y = wl_fixed_to_double(sy);
switch (window->wl.decorations.focus) switch (window->wl.decorations.focus)
{ {
case mainWindow: case mainWindow:
_glfwInputCursorPos(window, window->wl.cursorPosX = x;
window->wl.cursorPosX, window->wl.cursorPosY); window->wl.cursorPosY = y;
_glfwInputCursorPos(window, x, y);
return; return;
case topDecoration: case topDecoration:
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) if (y < _GLFW_DECORATION_WIDTH)
cursorShape = GLFW_VRESIZE_CURSOR; cursorShape = GLFW_VRESIZE_CURSOR;
else else
cursorShape = GLFW_ARROW_CURSOR; cursorShape = GLFW_ARROW_CURSOR;
break; break;
case leftDecoration: case leftDecoration:
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) if (y < _GLFW_DECORATION_WIDTH)
cursorShape = GLFW_NW_RESIZE_CURSOR; cursorShape = GLFW_NW_RESIZE_CURSOR;
else else
cursorShape = GLFW_HRESIZE_CURSOR; cursorShape = GLFW_HRESIZE_CURSOR;
break; break;
case rightDecoration: case rightDecoration:
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) if (y < _GLFW_DECORATION_WIDTH)
cursorShape = GLFW_NE_RESIZE_CURSOR; cursorShape = GLFW_NE_RESIZE_CURSOR;
else else
cursorShape = GLFW_HRESIZE_CURSOR; cursorShape = GLFW_HRESIZE_CURSOR;
break; break;
case bottomDecoration: case bottomDecoration:
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH) if (x < _GLFW_DECORATION_WIDTH)
cursorShape = GLFW_SW_RESIZE_CURSOR; cursorShape = GLFW_SW_RESIZE_CURSOR;
else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH) else if (x > window->wl.width + _GLFW_DECORATION_WIDTH)
cursorShape = GLFW_SE_RESIZE_CURSOR; cursorShape = GLFW_SE_RESIZE_CURSOR;
else else
cursorShape = GLFW_VRESIZE_CURSOR; cursorShape = GLFW_VRESIZE_CURSOR;