Module: wine Branch: master Commit: 1604d8a2025bc56d9a5a7619294119fa2fa2015e URL: https://gitlab.winehq.org/wine/wine/-/commit/1604d8a2025bc56d9a5a7619294119f...
Author: Rémi Bernon rbernon@codeweavers.com Date: Thu Mar 14 16:22:21 2024 +0100
server: Send WM_WINE_CLIPCURSOR message only when necessary.
---
server/queue.c | 9 +++++++-- server/user.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/server/queue.c b/server/queue.c index 0e8653bedf0..5eb6c1edafb 100644 --- a/server/queue.c +++ b/server/queue.c @@ -527,6 +527,7 @@ static void get_message_defaults( struct msg_queue *queue, int *x, int *y, unsig void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, unsigned int flags, int reset ) { rectangle_t top_rect; + unsigned int old_flags; int x, y;
get_top_window_rectangle( desktop, &top_rect ); @@ -542,6 +543,9 @@ void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, unsig } else desktop->cursor.clip = top_rect;
+ old_flags = desktop->cursor.clip_flags; + desktop->cursor.clip_flags = flags; + /* warp the mouse to be inside the clip rect */ x = max( min( desktop->cursor.x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); y = max( min( desktop->cursor.y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top ); @@ -550,8 +554,9 @@ void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, unsig /* request clip cursor rectangle reset to the desktop thread */ if (reset) post_desktop_message( desktop, WM_WINE_CLIPCURSOR, flags, FALSE );
- /* notify foreground thread, of reset, or to apply new cursor clipping rect */ - queue_cursor_message( desktop, 0, WM_WINE_CLIPCURSOR, flags, reset ); + /* notify foreground thread of reset, clipped, or released cursor rect */ + if (reset || flags != SET_CURSOR_NOCLIP || old_flags != SET_CURSOR_NOCLIP) + queue_cursor_message( desktop, 0, WM_WINE_CLIPCURSOR, flags, reset ); }
/* change the foreground input and reset the cursor clip rect */ diff --git a/server/user.h b/server/user.h index 309a0966104..d805a179d16 100644 --- a/server/user.h +++ b/server/user.h @@ -59,6 +59,7 @@ struct global_cursor int x; /* cursor position */ int y; rectangle_t clip; /* cursor clip rectangle */ + unsigned int clip_flags; /* last cursor clip flags */ unsigned int last_change; /* time of last position change */ user_handle_t win; /* window that contains the cursor */ };