From a80788c17f3376177b45d52f983d4d98f1175af2 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 21 Nov 2019 13:46:18 +0100 Subject: [PATCH] =?UTF-8?q?Wayland:=20Don=E2=80=99t=20update=20cursor=20po?= =?UTF-8?q?sition=20in=20the=20frame?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That way the application only sees the cursor moving when it is inside of its area, it won’t go back to the top or left side when trying to resize the window or just hovering the fallback decorations. --- src/wl_init.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 40643766..9e692f0e 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -180,47 +180,45 @@ static void pointerHandleMotion(void* data, { _GLFWwindow* window = _glfw.wl.pointerFocus; const char* cursorName = NULL; + double x, y; if (!window) return; if (window->cursorMode == GLFW_CURSOR_DISABLED) return; - else - { - window->wl.cursorPosX = wl_fixed_to_double(sx); - window->wl.cursorPosY = wl_fixed_to_double(sy); - } + x = wl_fixed_to_double(sx); + y = wl_fixed_to_double(sy); switch (window->wl.decorations.focus) { case mainWindow: - _glfwInputCursorPos(window, - wl_fixed_to_double(sx), - wl_fixed_to_double(sy)); + window->wl.cursorPosX = x; + window->wl.cursorPosY = y; + _glfwInputCursorPos(window, x, y); return; case topDecoration: - if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) + if (y < _GLFW_DECORATION_WIDTH) cursorName = "n-resize"; else cursorName = "left_ptr"; break; case leftDecoration: - if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) + if (y < _GLFW_DECORATION_WIDTH) cursorName = "nw-resize"; else cursorName = "w-resize"; break; case rightDecoration: - if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) + if (y < _GLFW_DECORATION_WIDTH) cursorName = "ne-resize"; else cursorName = "e-resize"; break; case bottomDecoration: - if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH) + if (x < _GLFW_DECORATION_WIDTH) cursorName = "sw-resize"; - else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH) + else if (x > window->wl.width + _GLFW_DECORATION_WIDTH) cursorName = "se-resize"; else cursorName = "s-resize";