server: Use an explicit union instead of a typedef for hardware input.

This commit is contained in:
Alexandre Julliard 2024-11-18 21:32:53 +01:00
parent ce946e57db
commit 180ba49cee
8 changed files with 18 additions and 18 deletions

View file

@ -312,7 +312,7 @@ struct winevent_msg_data
}; };
typedef union union hw_input
{ {
int type; int type;
struct struct
@ -342,7 +342,7 @@ typedef union
lparam_t lparam; lparam_t lparam;
struct hid_input hid; struct hid_input hid;
} hw; } hw;
} hw_input_t; };
union message_data union message_data
{ {
@ -2970,7 +2970,7 @@ struct send_hardware_message_request
{ {
struct request_header __header; struct request_header __header;
user_handle_t win; user_handle_t win;
hw_input_t input; union hw_input input;
unsigned int flags; unsigned int flags;
/* VARARG(report,bytes); */ /* VARARG(report,bytes); */
char __pad_60[4]; char __pad_60[4];

View file

@ -328,7 +328,7 @@ struct winevent_msg_data
/* followed by module name if any */ /* followed by module name if any */
}; };
typedef union union hw_input
{ {
int type; int type;
struct struct
@ -358,7 +358,7 @@ typedef union
lparam_t lparam; /* parameters */ lparam_t lparam; /* parameters */
struct hid_input hid; /* defined in ntuser.h */ struct hid_input hid; /* defined in ntuser.h */
} hw; } hw;
} hw_input_t; };
union message_data union message_data
{ {
@ -2241,7 +2241,7 @@ enum message_type
/* Send a hardware message to a thread queue */ /* Send a hardware message to a thread queue */
@REQ(send_hardware_message) @REQ(send_hardware_message)
user_handle_t win; /* window handle */ user_handle_t win; /* window handle */
hw_input_t input; /* input data */ union hw_input input; /* input data */
unsigned int flags; /* flags (see below) */ unsigned int flags; /* flags (see below) */
VARARG(report,bytes); /* HID report data */ VARARG(report,bytes); /* HID report data */
@REPLY @REPLY

View file

@ -2106,7 +2106,7 @@ static void rawkeyboard_init( struct rawinput *rawinput, RAWKEYBOARD *keyboard,
keyboard->ExtraInformation = info; 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->type = RIM_TYPEHID;
rawinput->device = input->hw.hid.device; 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 */ /* 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 ) unsigned int origin, struct msg_queue *sender )
{ {
const desktop_shm_t *desktop_shm = desktop->shared; 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; 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 ); unsigned int origin, struct msg_queue *sender, int repeat );
static void key_repeat_timeout( void *private ) 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 */ /* 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 ) unsigned int origin, struct msg_queue *sender, int repeat )
{ {
const desktop_shm_t *desktop_shm = desktop->shared; const desktop_shm_t *desktop_shm = desktop->shared;
@ -2502,7 +2502,7 @@ struct pointer
struct desktop *desktop; struct desktop *desktop;
user_handle_t win; user_handle_t win;
int primary; int primary;
hw_input_t input; union hw_input input;
}; };
static void queue_pointer_message( struct pointer *pointer, int repeated ); 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 hw_msg_source source = { IMDT_UNAVAILABLE, IMDT_TOUCH };
struct desktop *desktop = pointer->desktop; struct desktop *desktop = pointer->desktop;
const desktop_shm_t *desktop_shm = desktop->shared; 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; unsigned int i, wparam = input->hw.wparam;
timeout_t time = get_tick_count(); timeout_t time = get_tick_count();
user_handle_t win = pointer->win; 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 */ /* queue a hardware message for a custom type of event */
static void queue_custom_hardware_message( struct desktop *desktop, user_handle_t win, 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; const desktop_shm_t *desktop_shm = desktop->shared;
struct hw_msg_source source = { IMDT_UNAVAILABLE, origin }; struct hw_msg_source source = { IMDT_UNAVAILABLE, origin };

View file

@ -607,7 +607,6 @@ C_ASSERT( sizeof(data_size_t) == 4 );
C_ASSERT( sizeof(debug_event_t) == 160 ); C_ASSERT( sizeof(debug_event_t) == 160 );
C_ASSERT( sizeof(file_pos_t) == 8 ); C_ASSERT( sizeof(file_pos_t) == 8 );
C_ASSERT( sizeof(generic_map_t) == 16 ); C_ASSERT( sizeof(generic_map_t) == 16 );
C_ASSERT( sizeof(hw_input_t) == 40 );
C_ASSERT( sizeof(int) == 4 ); C_ASSERT( sizeof(int) == 4 );
C_ASSERT( sizeof(ioctl_code_t) == 4 ); C_ASSERT( sizeof(ioctl_code_t) == 4 );
C_ASSERT( sizeof(irp_params_t) == 32 ); 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(udp_endpoint) == 32 );
C_ASSERT( sizeof(union apc_call) == 64 ); C_ASSERT( sizeof(union apc_call) == 64 );
C_ASSERT( sizeof(union apc_result) == 40 ); C_ASSERT( sizeof(union apc_result) == 40 );
C_ASSERT( sizeof(union hw_input) == 40 );
C_ASSERT( sizeof(union message_data) == 48 ); C_ASSERT( sizeof(union message_data) == 48 );
C_ASSERT( sizeof(unsigned __int64) == 8 ); C_ASSERT( sizeof(unsigned __int64) == 8 );
C_ASSERT( sizeof(unsigned char) == 1 ); C_ASSERT( sizeof(unsigned char) == 1 );

View file

@ -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_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_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_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_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_irp_params( const char *prefix, const irp_params_t *val );
static void dump_luid( const char *prefix, const struct luid *val ); static void dump_luid( const char *prefix, const struct luid *val );

View file

@ -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) switch (input->type)
{ {

View file

@ -62,7 +62,7 @@ struct key_repeat
int enable; /* enable auto-repeat */ int enable; /* enable auto-repeat */
timeout_t delay; /* auto-repeat delay */ timeout_t delay; /* auto-repeat delay */
timeout_t period; /* auto-repeat period */ 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 */ user_handle_t win; /* target window for input event */
struct timeout_user *timeout; /* timeout for repeat */ struct timeout_user *timeout; /* timeout for repeat */
}; };

View file

@ -41,7 +41,6 @@ my %formats =
"irp_params_t" => [ 32, 8 ], "irp_params_t" => [ 32, 8 ],
"generic_map_t" => [ 16, 4 ], "generic_map_t" => [ 16, 4 ],
"ioctl_code_t" => [ 4, 4 ], "ioctl_code_t" => [ 4, 4 ],
"hw_input_t" => [ 40, 8 ],
"obj_locator_t" => [ 16, 8 ], "obj_locator_t" => [ 16, 8 ],
# varargs-only structures # varargs-only structures
"context_t" => [ 1728, 8 ], "context_t" => [ 1728, 8 ],
@ -58,6 +57,7 @@ my %formats =
"struct async_data" => [ 40, 8 ], "struct async_data" => [ 40, 8 ],
"struct filesystem_event" => [ 12, 4 ], "struct filesystem_event" => [ 12, 4 ],
"struct handle_info" => [ 20, 4 ], "struct handle_info" => [ 20, 4 ],
"union hw_input" => [ 40, 8 ],
"struct luid" => [ 8, 4 ], "struct luid" => [ 8, 4 ],
"struct luid_attr" => [ 12, 4 ], "struct luid_attr" => [ 12, 4 ],
"union message_data" => [ 48, 8 ], "union message_data" => [ 48, 8 ],