Module: wine Branch: master Commit: 34b8c639ceed76c894599a5b28cc457f88469c00 URL: http://source.winehq.org/git/wine.git/?a=commit;h=34b8c639ceed76c894599a5b28...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Apr 6 20:36:36 2011 +0200
server: Warp the mouse inside the clipping rectangle when it's set.
---
server/queue.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/server/queue.c b/server/queue.c index 0be102d..c4657e6 100644 --- a/server/queue.c +++ b/server/queue.c @@ -350,12 +350,18 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y ) static void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect ) { rectangle_t top_rect, new_rect; + int x, y;
get_top_window_rectangle( desktop, &top_rect ); if (!rect || !intersect_rect( &new_rect, &top_rect, rect )) new_rect = top_rect; if (!memcmp( &desktop->cursor.clip, &new_rect, sizeof(new_rect) )) return; desktop->cursor.clip = new_rect; if (desktop->cursor.clip_msg) post_desktop_message( desktop, desktop->cursor.clip_msg, 0, 0 ); + + /* warp the mouse to be inside the clip rect */ + x = min( max( desktop->cursor.x, desktop->cursor.clip.left ), desktop->cursor.clip.right-1 ); + y = min( max( desktop->cursor.y, desktop->cursor.clip.top ), desktop->cursor.clip.bottom-1 ); + if (x != desktop->cursor.x || y != desktop->cursor.y) set_cursor_pos( desktop, x, y ); }
/* change the foreground input and reset the cursor clip rect */