Module: wine Branch: master Commit: 9dc80b13bec0b482150dbd8c9236dbb8b6a31ccd URL: https://gitlab.winehq.org/wine/wine/-/commit/9dc80b13bec0b482150dbd8c9236dbb...
Author: Rémi Bernon rbernon@codeweavers.com Date: Thu Dec 21 11:44:39 2023 +0100
server: Introduce a new get_desktop_cursor_thread_input helper.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55961
---
server/queue.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/server/queue.c b/server/queue.c index ee8bdf34b7f..d2cf9800258 100644 --- a/server/queue.c +++ b/server/queue.c @@ -429,26 +429,34 @@ static void queue_cursor_message( struct desktop *desktop, user_handle_t win, un queue_hardware_message( desktop, msg, 1 ); }
+static struct thread_input *get_desktop_cursor_thread_input( struct desktop *desktop ) +{ + struct thread_input *input = NULL; + struct thread *thread; + + if ((thread = get_window_thread( desktop->cursor.win ))) + { + if (thread->queue) input = thread->queue->input; + release_object( thread ); + } + + return input; +} + static int update_desktop_cursor_window( struct desktop *desktop, user_handle_t win ) { int updated = win != desktop->cursor.win; - user_handle_t handle = desktop->cursor.handle; + struct thread_input *input; desktop->cursor.win = win; - if (updated) - { - struct thread *thread; - - if ((thread = get_window_thread( win ))) - { - struct thread_input *input = thread->queue->input; - if (input) handle = input->cursor_count < 0 ? 0 : input->cursor; - release_object( thread ); - }
+ if (updated && (input = get_desktop_cursor_thread_input( desktop ))) + { + user_handle_t handle = input->cursor_count < 0 ? 0 : input->cursor; /* when clipping send the message to the foreground window as well, as some driver have an artificial overlay window */ if (is_cursor_clipped( desktop )) queue_cursor_message( desktop, 0, WM_WINE_SETCURSOR, win, handle ); queue_cursor_message( desktop, win, WM_WINE_SETCURSOR, win, handle ); } + return updated; }