From ec51a219a7a14e757dfcddc6c8e7c80202ca2187 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 26 Oct 2018 13:18:45 +0900 Subject: [PATCH] glfw x11: update cursor position on enter event kitty would have an incorrect position when clicking after changing window without moving (e.g. change workspace, create new kitty etc) For new kitty window, initial position would be 0 and selection paste would not work because of this --- glfw/x11_window.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/glfw/x11_window.c b/glfw/x11_window.c index a11386d32..53fa8fc88 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -1291,12 +1291,20 @@ static void processEvent(XEvent *event) case EnterNotify: { + // XEnterWindowEvent is XCrossingEvent + const int x = event->xcrossing.x; + const int y = event->xcrossing.y; + // HACK: This is a workaround for WMs (KWM, Fluxbox) that otherwise // ignore the defined cursor for hidden cursor mode if (window->cursorMode == GLFW_CURSOR_HIDDEN) updateCursorImage(window); _glfwInputCursorEnter(window, GLFW_TRUE); + _glfwInputCursorPos(window, x, y); + + window->x11.lastCursorPosX = x; + window->x11.lastCursorPosY = y; return; }