Module: wine Branch: master Commit: 10f5ff7f06595bf9d1f487f91dbbd869e5105d26 URL: https://gitlab.winehq.org/wine/wine/-/commit/10f5ff7f06595bf9d1f487f91dbbd86...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed May 10 18:12:13 2023 +0200
server: Update desktop cursor window when cursor pos changes.
---
server/queue.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/server/queue.c b/server/queue.c index 57067dd6f51..74462ebedee 100644 --- a/server/queue.c +++ b/server/queue.c @@ -404,8 +404,16 @@ static struct message *alloc_hardware_message( lparam_t info, struct hw_msg_sour return msg; }
-static int update_desktop_cursor_pos( struct desktop *desktop, int x, int y ) +static int update_desktop_cursor_window( struct desktop *desktop, user_handle_t win ) { + int updated = win != desktop->cursor.win; + desktop->cursor.win = win; + return updated; +} + +static int update_desktop_cursor_pos( struct desktop *desktop, user_handle_t win, int x, int y ) +{ + struct thread_input *input; int updated;
x = max( min( x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); @@ -415,6 +423,11 @@ static int update_desktop_cursor_pos( struct desktop *desktop, int x, int y ) desktop->cursor.y = y; desktop->cursor.last_change = get_tick_count();
+ if (!win && (input = desktop->foreground_input)) win = input->capture; + if (!win || !is_window_visible( win ) || is_window_transparent( win )) + win = shallow_window_from_point( desktop, x, y ); + if (update_desktop_cursor_window( desktop, win )) updated = 1; + return updated; }
@@ -427,7 +440,7 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y )
if ((device = current->process->rawinput_mouse) && (device->flags & RIDEV_NOLEGACY)) { - update_desktop_cursor_pos( desktop, x, y ); + update_desktop_cursor_pos( desktop, 0, x, y ); return; }
@@ -1457,11 +1470,8 @@ static void update_input_key_state( struct desktop *desktop, unsigned char *keys }
/* update the desktop key state according to a mouse message flags */ -static void update_desktop_mouse_state( struct desktop *desktop, unsigned int flags, - int x, int y, lparam_t wparam ) +static void update_desktop_mouse_state( struct desktop *desktop, unsigned int flags, lparam_t wparam ) { - if (flags & MOUSEEVENTF_MOVE) - update_desktop_cursor_pos( desktop, x, y ); if (flags & MOUSEEVENTF_LEFTDOWN) update_input_key_state( desktop, desktop->keystate, WM_LBUTTONDOWN, wparam ); if (flags & MOUSEEVENTF_LEFTUP) @@ -1630,7 +1640,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg break; case QS_MOUSEMOVE: prepend_cursor_history( msg->x, msg->y, msg->time, msg_data->info ); - if (update_desktop_cursor_pos( desktop, msg->x, msg->y )) always_queue = 1; + if (update_desktop_cursor_pos( desktop, msg->win, msg->x, msg->y )) always_queue = 1; /* fallthrough */ case QS_MOUSEBUTTON: if (desktop->keystate[VK_LBUTTON] & 0x80) msg->wparam |= MK_LBUTTON; @@ -1661,9 +1671,6 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg } input = thread->queue->input;
- if (win != desktop->cursor.win) always_queue = 1; - desktop->cursor.win = win; - if (!always_queue || merge_message( input, msg )) free_message( msg ); else { @@ -1887,7 +1894,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
if ((device = current->process->rawinput_mouse) && (device->flags & RIDEV_NOLEGACY)) { - update_desktop_mouse_state( desktop, flags, x, y, input->mouse.data << 16 ); + if (flags & MOUSEEVENTF_MOVE) update_desktop_cursor_pos( desktop, win, x, y ); + update_desktop_mouse_state( desktop, flags, input->mouse.data << 16 ); return 0; }