From: Conor McCarthy cmccarthy@codeweavers.com
Reduces the request size, which will allow rational numbers to be used for cursor position without increasing the maximum request size. --- dlls/win32u/input.c | 7 +++---- include/wine/server_protocol.h | 6 ++---- server/protocol.def | 3 +-- server/queue.c | 6 ++++-- server/request_handlers.h | 13 ++++++------- server/request_trace.h | 3 +-- 6 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 252ae78e6a0..59239eb0dd4 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -708,7 +708,7 @@ BOOL WINAPI NtUserSetCursorPos( INT x, INT y ) { RECT rect = {x, y, x, y}; BOOL ret; - INT prev_x, prev_y, new_x, new_y; + INT new_x, new_y, moved;
rect = map_rect_virt_to_raw( rect, get_thread_dpi() ); SERVER_START_REQ( set_cursor ) @@ -718,14 +718,13 @@ BOOL WINAPI NtUserSetCursorPos( INT x, INT y ) req->y = rect.top; if ((ret = !wine_server_call( req ))) { - prev_x = reply->prev_x; - prev_y = reply->prev_y; + moved = reply->moved; new_x = reply->new_x; new_y = reply->new_y; } } SERVER_END_REQ; - if (ret && (prev_x != new_x || prev_y != new_y)) user_driver->pSetCursorPos( new_x, new_y ); + if (ret && moved) user_driver->pSetCursorPos( new_x, new_y ); return ret; }
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index d9f1099f154..7574a52d106 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -5722,13 +5722,11 @@ struct set_cursor_reply struct reply_header __header; user_handle_t prev_handle; int prev_count; - int prev_x; - int prev_y; + int moved; int new_x; int new_y; struct rectangle new_clip; unsigned int last_change; - char __pad_52[4]; }; #define SET_CURSOR_HANDLE 0x01 #define SET_CURSOR_COUNT 0x02 @@ -7040,6 +7038,6 @@ union generic_reply struct d3dkmt_object_open_name_reply d3dkmt_object_open_name_reply; };
-#define SERVER_PROTOCOL_VERSION 921 +#define SERVER_PROTOCOL_VERSION 922
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/protocol.def b/server/protocol.def index 87b8730f92a..8f16f3812c4 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -4003,8 +4003,7 @@ struct handle_info @REPLY user_handle_t prev_handle; /* previous handle */ int prev_count; /* previous show count */ - int prev_x; /* previous position */ - int prev_y; + int moved; /* previous position != new position */ int new_x; /* new position */ int new_y; struct rectangle new_clip; /* new clip rectangle */ diff --git a/server/queue.c b/server/queue.c index 6b48a5dfdc8..b77cd309a06 100644 --- a/server/queue.c +++ b/server/queue.c @@ -4010,6 +4010,7 @@ DECL_HANDLER(set_cursor) input_shm_t *input_shm; struct desktop *desktop; desktop_shm_t *desktop_shm; + int prev_x, prev_y;
if (!queue) return; input = queue->input; @@ -4017,11 +4018,11 @@ DECL_HANDLER(set_cursor) desktop = input->desktop; desktop_shm = desktop->shared; prev_cursor = input_shm->cursor_count < 0 ? 0 : input_shm->cursor; + prev_x = desktop_shm->cursor.x; + prev_y = desktop_shm->cursor.y;
reply->prev_handle = input_shm->cursor; reply->prev_count = input_shm->cursor_count; - reply->prev_x = desktop_shm->cursor.x; - reply->prev_y = desktop_shm->cursor.y;
if ((req->flags & SET_CURSOR_HANDLE) && req->handle && !get_user_object( req->handle, NTUSER_OBJ_ICON )) @@ -4051,6 +4052,7 @@ DECL_HANDLER(set_cursor)
reply->new_x = desktop_shm->cursor.x; reply->new_y = desktop_shm->cursor.y; + reply->moved = prev_x != reply->new_x || prev_y != reply->new_y; reply->new_clip = desktop_shm->cursor.clip; reply->last_change = desktop_shm->cursor.last_change; } diff --git a/server/request_handlers.h b/server/request_handlers.h index 6bef45d4ff9..c84be18f4fc 100644 --- a/server/request_handlers.h +++ b/server/request_handlers.h @@ -2228,13 +2228,12 @@ C_ASSERT( offsetof(struct set_cursor_request, clip) == 32 ); C_ASSERT( sizeof(struct set_cursor_request) == 48 ); C_ASSERT( offsetof(struct set_cursor_reply, prev_handle) == 8 ); C_ASSERT( offsetof(struct set_cursor_reply, prev_count) == 12 ); -C_ASSERT( offsetof(struct set_cursor_reply, prev_x) == 16 ); -C_ASSERT( offsetof(struct set_cursor_reply, prev_y) == 20 ); -C_ASSERT( offsetof(struct set_cursor_reply, new_x) == 24 ); -C_ASSERT( offsetof(struct set_cursor_reply, new_y) == 28 ); -C_ASSERT( offsetof(struct set_cursor_reply, new_clip) == 32 ); -C_ASSERT( offsetof(struct set_cursor_reply, last_change) == 48 ); -C_ASSERT( sizeof(struct set_cursor_reply) == 56 ); +C_ASSERT( offsetof(struct set_cursor_reply, moved) == 16 ); +C_ASSERT( offsetof(struct set_cursor_reply, new_x) == 20 ); +C_ASSERT( offsetof(struct set_cursor_reply, new_y) == 24 ); +C_ASSERT( offsetof(struct set_cursor_reply, new_clip) == 28 ); +C_ASSERT( offsetof(struct set_cursor_reply, last_change) == 44 ); +C_ASSERT( sizeof(struct set_cursor_reply) == 48 ); C_ASSERT( sizeof(struct get_cursor_history_request) == 16 ); C_ASSERT( sizeof(struct get_cursor_history_reply) == 8 ); C_ASSERT( offsetof(struct get_rawinput_buffer_request, header_size) == 12 ); diff --git a/server/request_trace.h b/server/request_trace.h index 8090f80eb76..106c722ce6b 100644 --- a/server/request_trace.h +++ b/server/request_trace.h @@ -3221,8 +3221,7 @@ static void dump_set_cursor_reply( const struct set_cursor_reply *req ) { fprintf( stderr, " prev_handle=%08x", req->prev_handle ); fprintf( stderr, ", prev_count=%d", req->prev_count ); - fprintf( stderr, ", prev_x=%d", req->prev_x ); - fprintf( stderr, ", prev_y=%d", req->prev_y ); + fprintf( stderr, ", moved=%d", req->moved ); fprintf( stderr, ", new_x=%d", req->new_x ); fprintf( stderr, ", new_y=%d", req->new_y ); dump_rectangle( ", new_clip=", &req->new_clip );