Module: wine Branch: master Commit: 994021da996f06f3fd65670b19c301ed77441c5c URL: https://gitlab.winehq.org/wine/wine/-/commit/994021da996f06f3fd65670b19c301e...
Author: Rémi Bernon rbernon@codeweavers.com Date: Thu Mar 14 18:09:17 2024 +0100
server: Send WM_WINE_SETCURSOR message only when necessary.
---
server/queue.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/server/queue.c b/server/queue.c index 5eb6c1edafb..5ae54e743a4 100644 --- a/server/queue.c +++ b/server/queue.c @@ -481,11 +481,11 @@ static int update_desktop_cursor_pos( struct desktop *desktop, user_handle_t win return updated; }
-static void update_desktop_cursor_handle( struct desktop *desktop, struct thread_input *input ) +static void update_desktop_cursor_handle( struct desktop *desktop, struct thread_input *input, user_handle_t handle ) { if (input == get_desktop_cursor_thread_input( desktop )) { - user_handle_t handle = input->cursor_count < 0 ? 0 : input->cursor, win = desktop->cursor.win; + user_handle_t win = desktop->cursor.win; /* 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 ); @@ -3636,12 +3636,14 @@ DECL_HANDLER(get_last_input_time) DECL_HANDLER(set_cursor) { struct msg_queue *queue = get_current_queue(); + user_handle_t prev_cursor, new_cursor; struct thread_input *input; struct desktop *desktop;
if (!queue) return; input = queue->input; desktop = input->desktop; + prev_cursor = input->cursor_count < 0 ? 0 : input->cursor;
reply->prev_handle = input->cursor; reply->prev_count = input->cursor_count; @@ -3666,8 +3668,8 @@ DECL_HANDLER(set_cursor) if (req->flags & SET_CURSOR_CLIP) set_clip_rectangle( desktop, &req->clip, req->flags, 0 ); if (req->flags & SET_CURSOR_NOCLIP) set_clip_rectangle( desktop, NULL, SET_CURSOR_NOCLIP, 0 );
- if (req->flags & (SET_CURSOR_HANDLE | SET_CURSOR_COUNT)) - update_desktop_cursor_handle( desktop, input ); + new_cursor = input->cursor_count < 0 ? 0 : input->cursor; + if (prev_cursor != new_cursor) update_desktop_cursor_handle( desktop, input, new_cursor );
reply->new_x = desktop->cursor.x; reply->new_y = desktop->cursor.y;