From 7b6690f4e6db751c3cff639e4afc1db34851facd Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Wed, 20 Nov 2024 20:52:44 +0100
Subject: [PATCH] server: Use an explicit struct instead of a typedef for
 cursor positions.

---
 dlls/win32u/input.c            | 2 +-
 include/wine/server_protocol.h | 4 ++--
 server/protocol.def            | 4 ++--
 server/queue.c                 | 6 +++---
 server/request_handlers.h      | 2 +-
 server/trace.c                 | 2 +-
 tools/make_requests            | 2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c
index 37d57a5787a..f42cc1dd047 100644
--- a/dlls/win32u/input.c
+++ b/dlls/win32u/input.c
@@ -1496,7 +1496,7 @@ BOOL WINAPI NtUserUnregisterHotKey( HWND hwnd, INT id )
 int WINAPI NtUserGetMouseMovePointsEx( UINT size, MOUSEMOVEPOINT *ptin, MOUSEMOVEPOINT *ptout,
                                        int count, DWORD resolution )
 {
-    cursor_pos_t *pos, positions[64];
+    struct cursor_pos *pos, positions[64];
     int copied;
     unsigned int i;
 
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 285521524b9..075d41b9467 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -863,14 +863,14 @@ struct rawinput_device
     user_handle_t  target;
 };
 
-typedef struct
+struct cursor_pos
 {
     int x;
     int y;
     unsigned int time;
     int __pad;
     lparam_t info;
-} cursor_pos_t;
+};
 
 struct directory_entry
 {
diff --git a/server/protocol.def b/server/protocol.def
index 95d9b09d61c..0abbb48f3b3 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -879,14 +879,14 @@ struct rawinput_device
     user_handle_t  target;
 };
 
-typedef struct
+struct cursor_pos
 {
     int x;
     int y;
     unsigned int time;
     int __pad;
     lparam_t info;
-} cursor_pos_t;
+};
 
 struct directory_entry
 {
diff --git a/server/queue.c b/server/queue.c
index 18b08f1480b..c7beebe037d 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -220,7 +220,7 @@ static const struct object_ops thread_input_ops =
 /* pointer to input structure of foreground thread */
 static unsigned int last_input_time;
 
-static cursor_pos_t cursor_history[64];
+static struct cursor_pos cursor_history[64];
 static unsigned int cursor_history_latest;
 
 static void queue_hardware_message( struct desktop *desktop, struct message *msg, int always_queue );
@@ -1865,7 +1865,7 @@ static struct rawinput_device *find_rawinput_device( struct process *process, un
 
 static void prepend_cursor_history( int x, int y, unsigned int time, lparam_t info )
 {
-    cursor_pos_t *pos = &cursor_history[--cursor_history_latest % ARRAY_SIZE(cursor_history)];
+    struct cursor_pos *pos = &cursor_history[--cursor_history_latest % ARRAY_SIZE(cursor_history)];
 
     pos->x = x;
     pos->y = y;
@@ -4035,7 +4035,7 @@ DECL_HANDLER(set_cursor)
 /* Get the history of the 64 last cursor positions */
 DECL_HANDLER(get_cursor_history)
 {
-    cursor_pos_t *pos;
+    struct cursor_pos *pos;
     unsigned int i, count = min( 64, get_reply_max_size() / sizeof(*pos) );
 
     if ((pos = set_reply_data_size( count * sizeof(*pos) )))
diff --git a/server/request_handlers.h b/server/request_handlers.h
index c3662e14598..c5c5b387946 100644
--- a/server/request_handlers.h
+++ b/server/request_handlers.h
@@ -600,7 +600,6 @@ C_ASSERT( sizeof(atom_t) == 4 );
 C_ASSERT( sizeof(char) == 1 );
 C_ASSERT( sizeof(client_ptr_t) == 8 );
 C_ASSERT( sizeof(context_t) == 1728 );
-C_ASSERT( sizeof(cursor_pos_t) == 24 );
 C_ASSERT( sizeof(data_size_t) == 4 );
 C_ASSERT( sizeof(file_pos_t) == 8 );
 C_ASSERT( sizeof(int) == 4 );
@@ -615,6 +614,7 @@ C_ASSERT( sizeof(process_id_t) == 4 );
 C_ASSERT( sizeof(rectangle_t) == 16 );
 C_ASSERT( sizeof(short int) == 2 );
 C_ASSERT( sizeof(struct async_data) == 40 );
+C_ASSERT( sizeof(struct cursor_pos) == 24 );
 C_ASSERT( sizeof(struct filesystem_event) == 12 );
 C_ASSERT( sizeof(struct generic_map) == 16 );
 C_ASSERT( sizeof(struct handle_info) == 20 );
diff --git a/server/trace.c b/server/trace.c
index d65faac64d4..ffa76d34e03 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1033,7 +1033,7 @@ static void dump_varargs_rectangles( const char *prefix, data_size_t size )
 
 static void dump_varargs_cursor_positions( const char *prefix, data_size_t size )
 {
-    const cursor_pos_t *pos = cur_data;
+    const struct cursor_pos *pos = cur_data;
     data_size_t len = size / sizeof(*pos);
 
     fprintf( stderr, "%s{", prefix );
diff --git a/tools/make_requests b/tools/make_requests
index e8633d7ac79..54b124442b0 100755
--- a/tools/make_requests
+++ b/tools/make_requests
@@ -42,12 +42,12 @@ my %formats =
     "obj_locator_t" => [  16,  8 ],
     # varargs-only structures
     "context_t"                => [  1728,  8 ],
-    "cursor_pos_t"             => [  24,  8 ],
     "tcp_connection"           => [  60, 4 ],
     "udp_endpoint"             => [  32, 4 ],
     "union apc_call"           => [ 64, 8 ],
     "union apc_result"         => [ 40, 8 ],
     "struct async_data"        => [ 40, 8 ],
+    "struct cursor_pos"        => [ 24, 8 ],
     "union debug_event_data"   => [ 160, 8 ],
     "struct filesystem_event"  => [ 12, 4 ],
     "struct generic_map"       => [ 16, 4 ],
-- 
GitLab