diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index 55b92ac79..64596b376 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -151,7 +151,7 @@ static void CharCallback(GLFWwindow *window, unsigned int codepoint); static void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods); // GLFW3 Mouse Button Callback, runs on mouse button pressed static void MouseCursorPosCallback(GLFWwindow *window, double x, double y); // GLFW3 Cursor Position Callback, runs on mouse move static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffset); // GLFW3 Scrolling Callback, runs on mouse wheel -static void CursorEnterCallback(GLFWwindow *window, int enter); // GLFW3 Cursor Enter Callback, cursor enters client area +static void CursorEnterCallback(GLFWwindow *window, int entered); // GLFW3 Cursor Enter Callback, cursor enters client area static void JoystickCallback(int jid, int event); // GLFW3 Joystick Connected/Disconnected Callback // Memory allocator wrappers [used by glfwInitAllocator()] @@ -2167,10 +2167,18 @@ static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffs } // GLFW3: Cursor ennter callback, when cursor enters the window -static void CursorEnterCallback(GLFWwindow *window, int enter) +static void CursorEnterCallback(GLFWwindow *window, int entered) { - if (enter) CORE.Input.Mouse.cursorOnScreen = true; - else CORE.Input.Mouse.cursorOnScreen = false; + if (entered) + { + // NOTE: Mouse position updated by MouseCursorPosCallback() + CORE.Input.Mouse.cursorOnScreen = true; + } + else + { + CORE.Input.Mouse.cursorOnScreen = false; + CORE.Input.Mouse.currentPosition = (Vector2){ 0 }; + } } // GLFW3: Joystick connected/disconnected callback