mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
x11 window: update cursor position on enter event
click events would have an incorrect position after changing workspace, if the mouse didn't move in between. (Another example where this matters is a new window, if it appears under the cursor, clicking would lead the application to think the user clicked at 0,0)
This commit is contained in:
parent
da8f3bc174
commit
62993d9391
@ -1455,12 +1455,20 @@ static void processEvent(XEvent *event)
|
|||||||
|
|
||||||
case EnterNotify:
|
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
|
// HACK: This is a workaround for WMs (KWM, Fluxbox) that otherwise
|
||||||
// ignore the defined cursor for hidden cursor mode
|
// ignore the defined cursor for hidden cursor mode
|
||||||
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
||||||
updateCursorImage(window);
|
updateCursorImage(window);
|
||||||
|
|
||||||
_glfwInputCursorEnter(window, GLFW_TRUE);
|
_glfwInputCursorEnter(window, GLFW_TRUE);
|
||||||
|
_glfwInputCursorPos(window, x, y);
|
||||||
|
|
||||||
|
window->x11.lastCursorPosX = x;
|
||||||
|
window->x11.lastCursorPosY = y;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user