From 180ba49cee034801492044e6bcc9d04f4359f4e4 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 18 Nov 2024 21:32:53 +0100 Subject: [PATCH] server: Use an explicit union instead of a typedef for hardware input. --- include/wine/server_protocol.h | 6 +++--- server/protocol.def | 6 +++--- server/queue.c | 14 +++++++------- server/request_handlers.h | 2 +- server/request_trace.h | 2 +- server/trace.c | 2 +- server/user.h | 2 +- tools/make_requests | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index eaff2b66929..db96db10268 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -312,7 +312,7 @@ struct winevent_msg_data }; -typedef union +union hw_input { int type; struct @@ -342,7 +342,7 @@ typedef union lparam_t lparam; struct hid_input hid; } hw; -} hw_input_t; +}; union message_data { @@ -2970,7 +2970,7 @@ struct send_hardware_message_request { struct request_header __header; user_handle_t win; - hw_input_t input; + union hw_input input; unsigned int flags; /* VARARG(report,bytes); */ char __pad_60[4]; diff --git a/server/protocol.def b/server/protocol.def index c29a1ff9266..c8d59efe084 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -328,7 +328,7 @@ struct winevent_msg_data /* followed by module name if any */ }; -typedef union +union hw_input { int type; struct @@ -358,7 +358,7 @@ typedef union lparam_t lparam; /* parameters */ struct hid_input hid; /* defined in ntuser.h */ } hw; -} hw_input_t; +}; union message_data { @@ -2241,7 +2241,7 @@ enum message_type /* Send a hardware message to a thread queue */ @REQ(send_hardware_message) user_handle_t win; /* window handle */ - hw_input_t input; /* input data */ + union hw_input input; /* input data */ unsigned int flags; /* flags (see below) */ VARARG(report,bytes); /* HID report data */ @REPLY diff --git a/server/queue.c b/server/queue.c index 24c8cfb8385..18b08f1480b 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2106,7 +2106,7 @@ static void rawkeyboard_init( struct rawinput *rawinput, RAWKEYBOARD *keyboard, keyboard->ExtraInformation = info; } -static void rawhid_init( struct rawinput *rawinput, RAWHID *hid, const hw_input_t *input ) +static void rawhid_init( struct rawinput *rawinput, RAWHID *hid, const union hw_input *input ) { rawinput->type = RIM_TYPEHID; rawinput->device = input->hw.hid.device; @@ -2203,7 +2203,7 @@ static void dispatch_rawinput_message( struct desktop *desktop, struct rawinput_ } /* queue a hardware message for a mouse event */ -static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input, +static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const union hw_input *input, unsigned int origin, struct msg_queue *sender ) { const desktop_shm_t *desktop_shm = desktop->shared; @@ -2309,7 +2309,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons return wait; } -static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input, +static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const union hw_input *input, unsigned int origin, struct msg_queue *sender, int repeat ); static void key_repeat_timeout( void *private ) @@ -2329,7 +2329,7 @@ static void stop_key_repeat( struct desktop *desktop ) } /* queue a hardware message for a keyboard event */ -static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input, +static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const union hw_input *input, unsigned int origin, struct msg_queue *sender, int repeat ) { const desktop_shm_t *desktop_shm = desktop->shared; @@ -2502,7 +2502,7 @@ struct pointer struct desktop *desktop; user_handle_t win; int primary; - hw_input_t input; + union hw_input input; }; static void queue_pointer_message( struct pointer *pointer, int repeated ); @@ -2524,7 +2524,7 @@ static void queue_pointer_message( struct pointer *pointer, int repeated ) struct hw_msg_source source = { IMDT_UNAVAILABLE, IMDT_TOUCH }; struct desktop *desktop = pointer->desktop; const desktop_shm_t *desktop_shm = desktop->shared; - const hw_input_t *input = &pointer->input; + const union hw_input *input = &pointer->input; unsigned int i, wparam = input->hw.wparam; timeout_t time = get_tick_count(); user_handle_t win = pointer->win; @@ -2600,7 +2600,7 @@ static struct pointer *find_pointer_from_id( struct desktop *desktop, unsigned i /* queue a hardware message for a custom type of event */ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_t win, - unsigned int origin, const hw_input_t *input ) + unsigned int origin, const union hw_input *input ) { const desktop_shm_t *desktop_shm = desktop->shared; struct hw_msg_source source = { IMDT_UNAVAILABLE, origin }; diff --git a/server/request_handlers.h b/server/request_handlers.h index 76ff0abeca7..3b74497db9f 100644 --- a/server/request_handlers.h +++ b/server/request_handlers.h @@ -607,7 +607,6 @@ C_ASSERT( sizeof(data_size_t) == 4 ); C_ASSERT( sizeof(debug_event_t) == 160 ); C_ASSERT( sizeof(file_pos_t) == 8 ); C_ASSERT( sizeof(generic_map_t) == 16 ); -C_ASSERT( sizeof(hw_input_t) == 40 ); C_ASSERT( sizeof(int) == 4 ); C_ASSERT( sizeof(ioctl_code_t) == 4 ); C_ASSERT( sizeof(irp_params_t) == 32 ); @@ -641,6 +640,7 @@ C_ASSERT( sizeof(timeout_t) == 8 ); C_ASSERT( sizeof(udp_endpoint) == 32 ); C_ASSERT( sizeof(union apc_call) == 64 ); C_ASSERT( sizeof(union apc_result) == 40 ); +C_ASSERT( sizeof(union hw_input) == 40 ); C_ASSERT( sizeof(union message_data) == 48 ); C_ASSERT( sizeof(unsigned __int64) == 8 ); C_ASSERT( sizeof(unsigned char) == 1 ); diff --git a/server/request_trace.h b/server/request_trace.h index bd6d89f6205..06976f33f1b 100644 --- a/server/request_trace.h +++ b/server/request_trace.h @@ -9,7 +9,7 @@ static void dump_abstime( const char *prefix, const abstime_t *val ); static void dump_apc_result( const char *prefix, const union apc_result *val ); static void dump_async_data( const char *prefix, const struct async_data *val ); static void dump_generic_map( const char *prefix, const generic_map_t *val ); -static void dump_hw_input( const char *prefix, const hw_input_t *val ); +static void dump_hw_input( const char *prefix, const union hw_input *val ); static void dump_ioctl_code( const char *prefix, const ioctl_code_t *val ); static void dump_irp_params( const char *prefix, const irp_params_t *val ); static void dump_luid( const char *prefix, const struct luid *val ); diff --git a/server/trace.c b/server/trace.c index fbc3683208e..56576339eb8 100644 --- a/server/trace.c +++ b/server/trace.c @@ -449,7 +449,7 @@ static void dump_irp_params( const char *prefix, const irp_params_t *data ) } } -static void dump_hw_input( const char *prefix, const hw_input_t *input ) +static void dump_hw_input( const char *prefix, const union hw_input *input ) { switch (input->type) { diff --git a/server/user.h b/server/user.h index 208496b856a..c4778d810ec 100644 --- a/server/user.h +++ b/server/user.h @@ -62,7 +62,7 @@ struct key_repeat int enable; /* enable auto-repeat */ timeout_t delay; /* auto-repeat delay */ timeout_t period; /* auto-repeat period */ - hw_input_t input; /* the input to repeat */ + union hw_input input; /* the input to repeat */ user_handle_t win; /* target window for input event */ struct timeout_user *timeout; /* timeout for repeat */ }; diff --git a/tools/make_requests b/tools/make_requests index bd69742a9b4..7a700372b2d 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -41,7 +41,6 @@ my %formats = "irp_params_t" => [ 32, 8 ], "generic_map_t" => [ 16, 4 ], "ioctl_code_t" => [ 4, 4 ], - "hw_input_t" => [ 40, 8 ], "obj_locator_t" => [ 16, 8 ], # varargs-only structures "context_t" => [ 1728, 8 ], @@ -58,6 +57,7 @@ my %formats = "struct async_data" => [ 40, 8 ], "struct filesystem_event" => [ 12, 4 ], "struct handle_info" => [ 20, 4 ], + "union hw_input" => [ 40, 8 ], "struct luid" => [ 8, 4 ], "struct luid_attr" => [ 12, 4 ], "union message_data" => [ 48, 8 ],