mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 23:47:16 +00:00
server: Support variable sized hardware_msg_data allocation.
The RIM_TYPEHID messages will have to carry the variable length HID report. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506 Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1128a37e77
commit
109de60873
|
@ -348,13 +348,13 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_
|
|||
|
||||
/* allocate a hardware message and its data */
|
||||
static struct message *alloc_hardware_message( lparam_t info, struct hw_msg_source source,
|
||||
unsigned int time )
|
||||
unsigned int time, data_size_t extra_size )
|
||||
{
|
||||
struct hardware_msg_data *msg_data;
|
||||
struct message *msg;
|
||||
|
||||
if (!(msg = mem_alloc( sizeof(*msg) ))) return NULL;
|
||||
if (!(msg_data = mem_alloc( sizeof(*msg_data) )))
|
||||
if (!(msg_data = mem_alloc( sizeof(*msg_data) + extra_size )))
|
||||
{
|
||||
free( msg );
|
||||
return NULL;
|
||||
|
@ -363,9 +363,9 @@ static struct message *alloc_hardware_message( lparam_t info, struct hw_msg_sour
|
|||
msg->type = MSG_HARDWARE;
|
||||
msg->time = time;
|
||||
msg->data = msg_data;
|
||||
msg->data_size = sizeof(*msg_data);
|
||||
msg->data_size = sizeof(*msg_data) + extra_size;
|
||||
|
||||
memset( msg_data, 0, sizeof(*msg_data) );
|
||||
memset( msg_data, 0, sizeof(*msg_data) + extra_size );
|
||||
msg_data->info = info;
|
||||
msg_data->size = msg->data_size;
|
||||
msg_data->source = source;
|
||||
|
@ -399,7 +399,7 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y )
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return;
|
||||
if (!(msg = alloc_hardware_message( 0, source, get_tick_count(), 0 ))) return;
|
||||
|
||||
msg->msg = WM_MOUSEMOVE;
|
||||
msg->x = x;
|
||||
|
@ -1665,6 +1665,7 @@ struct rawinput_message
|
|||
unsigned int time;
|
||||
unsigned int message;
|
||||
struct hardware_msg_data data;
|
||||
const void *hid_report;
|
||||
};
|
||||
|
||||
/* check if process is supposed to receive a WM_INPUT message and eventually queue it */
|
||||
|
@ -1676,6 +1677,7 @@ static int queue_rawinput_message( struct process* process, void *arg )
|
|||
struct desktop *target_desktop = NULL, *desktop = NULL;
|
||||
struct thread *target_thread = NULL, *foreground = NULL;
|
||||
struct message *msg;
|
||||
data_size_t report_size;
|
||||
int wparam = RIM_INPUT;
|
||||
|
||||
if (raw_msg->data.rawinput.type == RIM_TYPEMOUSE)
|
||||
|
@ -1703,7 +1705,10 @@ static int queue_rawinput_message( struct process* process, void *arg )
|
|||
wparam = RIM_INPUTSINK;
|
||||
}
|
||||
|
||||
if (!(msg = alloc_hardware_message( raw_msg->data.info, raw_msg->source, raw_msg->time )))
|
||||
if (raw_msg->data.rawinput.type != RIM_TYPEHID || !raw_msg->hid_report) report_size = 0;
|
||||
else report_size = raw_msg->data.size - sizeof(raw_msg->data);
|
||||
|
||||
if (!(msg = alloc_hardware_message( raw_msg->data.info, raw_msg->source, raw_msg->time, report_size )))
|
||||
goto done;
|
||||
|
||||
msg->win = device->target;
|
||||
|
@ -1711,6 +1716,7 @@ static int queue_rawinput_message( struct process* process, void *arg )
|
|||
msg->wparam = wparam;
|
||||
msg->lparam = 0;
|
||||
memcpy( msg->data, &raw_msg->data, sizeof(raw_msg->data) );
|
||||
if (report_size) memcpy( (struct hardware_msg_data *)msg->data + 1, raw_msg->hid_report, report_size );
|
||||
|
||||
if (raw_msg->message == WM_INPUT_DEVICE_CHANGE && raw_msg->data.rawinput.type == RIM_TYPEHID)
|
||||
{
|
||||
|
@ -1792,6 +1798,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
|||
raw_msg.source = source;
|
||||
raw_msg.time = time;
|
||||
raw_msg.message = WM_INPUT;
|
||||
raw_msg.hid_report = NULL;
|
||||
|
||||
msg_data = &raw_msg.data;
|
||||
msg_data->info = input->mouse.info;
|
||||
|
@ -1818,7 +1825,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
|||
if (!(flags & (1 << i))) continue;
|
||||
flags &= ~(1 << i);
|
||||
|
||||
if (!(msg = alloc_hardware_message( input->mouse.info, source, time ))) return 0;
|
||||
if (!(msg = alloc_hardware_message( input->mouse.info, source, time, 0 ))) return 0;
|
||||
msg_data = msg->data;
|
||||
|
||||
msg->win = get_user_full_handle( win );
|
||||
|
@ -1928,6 +1935,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
|||
raw_msg.source = source;
|
||||
raw_msg.time = time;
|
||||
raw_msg.message = WM_INPUT;
|
||||
raw_msg.hid_report = NULL;
|
||||
|
||||
msg_data = &raw_msg.data;
|
||||
msg_data->info = input->kbd.info;
|
||||
|
@ -1948,7 +1956,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
|
||||
if (!(msg = alloc_hardware_message( input->kbd.info, source, time, 0 ))) return 0;
|
||||
msg_data = msg->data;
|
||||
|
||||
msg->win = get_user_full_handle( win );
|
||||
|
@ -1997,6 +2005,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
|||
raw_msg.source = source;
|
||||
raw_msg.time = get_tick_count();
|
||||
raw_msg.message = input->hw.msg;
|
||||
raw_msg.hid_report = NULL;
|
||||
|
||||
msg_data = &raw_msg.data;
|
||||
msg_data->info = 0;
|
||||
|
@ -2010,7 +2019,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return;
|
||||
if (!(msg = alloc_hardware_message( 0, source, get_tick_count(), 0 ))) return;
|
||||
|
||||
msg->win = get_user_full_handle( win );
|
||||
msg->msg = input->hw.msg;
|
||||
|
|
Loading…
Reference in a new issue