This commit is contained in:
Kovid Goyal 2025-03-04 09:49:34 +05:30
parent 0339d59851
commit ac6c652a4d
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 4 deletions

6
glfw/input.c vendored
View file

@ -728,10 +728,10 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
window->cursorMode = value;
_glfwPlatformGetCursorPos(window,
&window->virtualCursorPosX,
&window->virtualCursorPosY);
double x, y;
_glfwPlatformGetCursorPos(window, &x, &y);
_glfwPlatformSetCursorMode(window, value);
_glfwInputCursorPos(window, x, y);
}
else if (mode == GLFW_STICKY_KEYS)
{

View file

@ -446,12 +446,12 @@ cursor_enter_callback(GLFWwindow *w, int entered) {
double x, y;
glfwGetCursorPos(w, &x, &y);
debug_input("Mouse cursor entered window: %llu at %fx%f\n", global_state.callback_os_window->id, x, y);
show_mouse_cursor(w);
monotonic_t now = monotonic();
global_state.callback_os_window->last_mouse_activity_at = now;
global_state.callback_os_window->mouse_x = x * global_state.callback_os_window->viewport_x_ratio;
global_state.callback_os_window->mouse_y = y * global_state.callback_os_window->viewport_y_ratio;
if (is_window_ready_for_callbacks()) enter_event();
show_mouse_cursor(w); // might result in a call to cursor_pos_callback which will set callback_os_window to NULL
request_tick_callback();
} else debug_input("Mouse cursor left window: %llu\n", global_state.callback_os_window->id);
global_state.callback_os_window = NULL;