diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index df31a957486..162d00bd65f 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -888,6 +888,7 @@ struct shared_cursor int x; int y; unsigned int last_change; + rectangle_t clip; }; typedef volatile struct @@ -6567,7 +6568,7 @@ union generic_reply /* ### protocol_version begin ### */ -#define SERVER_PROTOCOL_VERSION 813 +#define SERVER_PROTOCOL_VERSION 814 /* ### protocol_version end ### */ diff --git a/server/protocol.def b/server/protocol.def index 20ed82982dd..0592dddaa97 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -904,6 +904,7 @@ struct shared_cursor int x; /* cursor position */ int y; unsigned int last_change; /* time of last position change */ + rectangle_t clip; /* cursor clip rectangle */ }; typedef volatile struct diff --git a/server/queue.c b/server/queue.c index c2e957cfd21..e06f6afe0f7 100644 --- a/server/queue.c +++ b/server/queue.c @@ -410,7 +410,8 @@ static struct message *alloc_hardware_message( lparam_t info, struct hw_msg_sour static int is_cursor_clipped( struct desktop *desktop ) { - rectangle_t top_rect, clip_rect = desktop->cursor.clip; + const desktop_shm_t *desktop_shm = desktop->shared; + rectangle_t top_rect, clip_rect = desktop_shm->cursor.clip; get_top_window_rectangle( desktop, &top_rect ); return !is_rect_equal( &clip_rect, &top_rect ); } @@ -471,8 +472,8 @@ static int update_desktop_cursor_pos( struct desktop *desktop, user_handle_t win int updated; unsigned int time = get_tick_count(); - x = max( min( x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); - y = max( min( y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top ); + x = max( min( x, desktop_shm->cursor.clip.right - 1 ), desktop_shm->cursor.clip.left ); + y = max( min( y, desktop_shm->cursor.clip.bottom - 1 ), desktop_shm->cursor.clip.top ); SHARED_WRITE_BEGIN( desktop_shm, desktop_shm_t ) { @@ -537,29 +538,34 @@ 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 ) { const desktop_shm_t *desktop_shm = desktop->shared; - rectangle_t top_rect; + rectangle_t top_rect, new_rect; unsigned int old_flags; int x, y; get_top_window_rectangle( desktop, &top_rect ); if (rect) { - rectangle_t new_rect = *rect; + new_rect = *rect; if (new_rect.left < top_rect.left) new_rect.left = top_rect.left; if (new_rect.right > top_rect.right) new_rect.right = top_rect.right; if (new_rect.top < top_rect.top) new_rect.top = top_rect.top; if (new_rect.bottom > top_rect.bottom) new_rect.bottom = top_rect.bottom; if (new_rect.left > new_rect.right || new_rect.top > new_rect.bottom) new_rect = top_rect; - desktop->cursor.clip = new_rect; } - else desktop->cursor.clip = top_rect; + else new_rect = top_rect; + + SHARED_WRITE_BEGIN( desktop_shm, desktop_shm_t ) + { + shared->cursor.clip = new_rect; + } + SHARED_WRITE_END; old_flags = desktop->cursor.clip_flags; desktop->cursor.clip_flags = flags; /* warp the mouse to be inside the clip rect */ - x = max( min( desktop_shm->cursor.x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); - y = max( min( desktop_shm->cursor.y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top ); + x = max( min( desktop_shm->cursor.x, new_rect.right - 1 ), new_rect.left ); + y = max( min( desktop_shm->cursor.y, new_rect.bottom - 1 ), new_rect.top ); if (x != desktop_shm->cursor.x || y != desktop_shm->cursor.y) set_cursor_pos( desktop, x, y ); /* request clip cursor rectangle reset to the desktop thread */ @@ -3745,7 +3751,7 @@ DECL_HANDLER(set_cursor) reply->new_x = desktop_shm->cursor.x; reply->new_y = desktop_shm->cursor.y; - reply->new_clip = desktop->cursor.clip; + reply->new_clip = desktop_shm->cursor.clip; reply->last_change = desktop_shm->cursor.last_change; } diff --git a/server/user.h b/server/user.h index a20aff99284..7ad1e82ae54 100644 --- a/server/user.h +++ b/server/user.h @@ -56,7 +56,6 @@ struct winstation struct global_cursor { - rectangle_t clip; /* cursor clip rectangle */ unsigned int clip_flags; /* last cursor clip flags */ user_handle_t win; /* window that contains the cursor */ }; diff --git a/server/winstation.c b/server/winstation.c index 87981f64167..3e08f4b3337 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -310,6 +310,10 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned shared->cursor.x = 0; shared->cursor.y = 0; shared->cursor.last_change = 0; + shared->cursor.clip.left = 0; + shared->cursor.clip.top = 0; + shared->cursor.clip.right = 0; + shared->cursor.clip.bottom = 0; } SHARED_WRITE_END; }