Module: wine Branch: master Commit: c8bf3ba2daebc667344f36559859c4815273c988 URL: https://gitlab.winehq.org/wine/wine/-/commit/c8bf3ba2daebc667344f36559859c48...
Author: Rémi Bernon rbernon@codeweavers.com Date: Sun Jan 28 13:35:35 2024 +0100
server: Stop using hardware_msg_data in rawinput_message.
---
include/wine/server_protocol.h | 4 +-- server/protocol.def | 2 +- server/queue.c | 79 ++++++++++++++++++++---------------------- 3 files changed, 40 insertions(+), 45 deletions(-)
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 96a21e25e09..80cc8bd3bd5 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -284,7 +284,7 @@ union rawinput { int type; unsigned int device; - unsigned int param; + unsigned int wparam; unsigned int usage; unsigned int count; unsigned int length; @@ -6512,7 +6512,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 790 +#define SERVER_PROTOCOL_VERSION 791
/* ### protocol_version end ### */
diff --git a/server/protocol.def b/server/protocol.def index 6ffed5deb01..e896f6cb72a 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -300,7 +300,7 @@ union rawinput { int type; /* RIM_TYPEHID */ unsigned int device; /* rawinput device index */ - unsigned int param; /* rawinput message param */ + unsigned int wparam; /* rawinput message wparam */ unsigned int usage; /* HID device usage */ unsigned int count; /* HID report count */ unsigned int length; /* HID report length */ diff --git a/server/queue.c b/server/queue.c index dad51e06ceb..07870f98711 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1789,7 +1789,9 @@ struct rawinput_message struct hw_msg_source source; unsigned int time; unsigned int message; - struct hardware_msg_data data; + lparam_t info; + unsigned int flags; + union rawinput rawinput; const void *hid_report; };
@@ -1800,16 +1802,17 @@ static int queue_rawinput_message( struct process* process, void *arg ) const struct rawinput_device *device = NULL; struct desktop *target_desktop = NULL, *desktop = NULL; struct thread *target_thread = NULL, *foreground = NULL; + struct hardware_msg_data *msg_data; struct message *msg; data_size_t report_size; int wparam = RIM_INPUT;
- if (raw_msg->data.rawinput.type == RIM_TYPEMOUSE) + if (raw_msg->rawinput.type == RIM_TYPEMOUSE) device = process->rawinput_mouse; - else if (raw_msg->data.rawinput.type == RIM_TYPEKEYBOARD) + else if (raw_msg->rawinput.type == RIM_TYPEKEYBOARD) device = process->rawinput_kbd; else - device = find_rawinput_device( process, raw_msg->data.rawinput.hid.usage ); + device = find_rawinput_device( process, raw_msg->rawinput.hid.usage ); if (!device) return 0;
if (raw_msg->message == WM_INPUT_DEVICE_CHANGE && !(device->flags & RIDEV_DEVNOTIFY)) return 0; @@ -1829,23 +1832,24 @@ static int queue_rawinput_message( struct process* process, void *arg ) wparam = RIM_INPUTSINK; }
- 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; + if (raw_msg->rawinput.type != RIM_TYPEHID || !raw_msg->hid_report) report_size = 0; + else report_size = raw_msg->rawinput.hid.count * raw_msg->rawinput.hid.length;
+ if (!(msg = alloc_hardware_message( raw_msg->info, raw_msg->source, raw_msg->time, report_size ))) goto done; msg->win = device->target; msg->msg = raw_msg->message; 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) + msg_data = msg->data; + msg_data->flags = raw_msg->flags; + msg_data->rawinput = raw_msg->rawinput; + if (report_size) memcpy( msg_data + 1, raw_msg->hid_report, report_size ); + + if (raw_msg->message == WM_INPUT_DEVICE_CHANGE && raw_msg->rawinput.type == RIM_TYPEHID) { - msg->wparam = raw_msg->data.rawinput.hid.param; - msg->lparam = raw_msg->data.rawinput.hid.device; + msg->wparam = raw_msg->rawinput.hid.wparam; + msg->lparam = raw_msg->rawinput.hid.device; }
queue_hardware_message( desktop, msg, 1 ); @@ -1924,14 +1928,12 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons raw_msg.time = time; raw_msg.message = WM_INPUT;
- msg_data = &raw_msg.data; - msg_data->info = input->mouse.info; - msg_data->size = sizeof(*msg_data); - msg_data->flags = flags; - msg_data->rawinput.type = RIM_TYPEMOUSE; - msg_data->rawinput.mouse.x = x - desktop->cursor.x; - msg_data->rawinput.mouse.y = y - desktop->cursor.y; - msg_data->rawinput.mouse.data = input->mouse.data; + raw_msg.info = input->mouse.info; + raw_msg.flags = flags; + raw_msg.rawinput.type = RIM_TYPEMOUSE; + raw_msg.rawinput.mouse.x = x - desktop->cursor.x; + raw_msg.rawinput.mouse.y = y - desktop->cursor.y; + raw_msg.rawinput.mouse.data = input->mouse.data;
enum_processes( queue_rawinput_message, &raw_msg ); release_object( foreground ); @@ -2062,14 +2064,12 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c raw_msg.time = time; raw_msg.message = WM_INPUT;
- msg_data = &raw_msg.data; - msg_data->info = input->kbd.info; - msg_data->size = sizeof(*msg_data); - msg_data->flags = input->kbd.flags; - msg_data->rawinput.type = RIM_TYPEKEYBOARD; - msg_data->rawinput.kbd.message = message_code; - msg_data->rawinput.kbd.vkey = vkey; - msg_data->rawinput.kbd.scan = input->kbd.scan; + raw_msg.info = input->kbd.info; + raw_msg.flags = input->kbd.flags; + raw_msg.rawinput.type = RIM_TYPEKEYBOARD; + raw_msg.rawinput.kbd.message = message_code; + raw_msg.rawinput.kbd.vkey = vkey; + raw_msg.rawinput.kbd.scan = input->kbd.scan;
enum_processes( queue_rawinput_message, &raw_msg ); release_object( foreground ); @@ -2117,10 +2117,8 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ unsigned int origin, const hw_input_t *input ) { struct hw_msg_source source = { IMDT_UNAVAILABLE, origin }; - struct hardware_msg_data *msg_data; struct rawinput_message raw_msg; struct message *msg; - data_size_t report_size = 0;
switch (input->hw.msg) { @@ -2131,21 +2129,18 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ raw_msg.time = get_tick_count(); raw_msg.message = input->hw.msg; raw_msg.hid_report = get_req_data(); - report_size = input->hw.hid.length * input->hw.hid.count; - if (report_size != get_req_data_size()) + if (input->hw.hid.length * input->hw.hid.count != get_req_data_size()) { set_error( STATUS_INVALID_PARAMETER ); return; }
- msg_data = &raw_msg.data; - msg_data->size = sizeof(*msg_data) + report_size; - msg_data->rawinput.hid.type = RIM_TYPEHID; - msg_data->rawinput.hid.device = input->hw.hid.device; - msg_data->rawinput.hid.param = input->hw.wparam; - msg_data->rawinput.hid.usage = input->hw.hid.usage; - msg_data->rawinput.hid.count = input->hw.hid.count; - msg_data->rawinput.hid.length = input->hw.hid.length; + raw_msg.rawinput.hid.type = RIM_TYPEHID; + raw_msg.rawinput.hid.device = input->hw.hid.device; + raw_msg.rawinput.hid.wparam = input->hw.wparam; + raw_msg.rawinput.hid.usage = input->hw.hid.usage; + raw_msg.rawinput.hid.count = input->hw.hid.count; + raw_msg.rawinput.hid.length = input->hw.hid.length;
enum_processes( queue_rawinput_message, &raw_msg ); return;