Merge branch 'glfw_upstream' of https://github.com/Luflosi/kitty

This commit is contained in:
Kovid Goyal 2019-11-22 20:16:22 +05:30
commit 4f85d4db71
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

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;