From 6d167b91ad0a62c2f0f2aa377b0a321414158463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 6 May 2021 12:57:31 +0200 Subject: [PATCH] server: Add rawinput union to hw_input_t / INPUT_HARDWARE. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When msg is WM_INPUT_DEVICE_CHANGE. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506 Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- include/wine/server_protocol.h | 41 ++++++++++++++++++---------------- server/protocol.def | 39 +++++++++++++++++--------------- server/trace.c | 23 +++++++++++++++++++ 3 files changed, 66 insertions(+), 37 deletions(-) diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index f326d78bc3c..139aebc722a 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -262,30 +262,32 @@ struct hw_msg_source unsigned int origin; }; +union rawinput +{ + int type; + struct + { + int type; + unsigned int message; + unsigned short vkey; + unsigned short scan; + } kbd; + struct + { + int type; + int x; + int y; + unsigned int data; + } mouse; +}; + struct hardware_msg_data { lparam_t info; unsigned int hw_id; unsigned int flags; struct hw_msg_source source; - union - { - int type; - struct - { - int type; - unsigned int message; - unsigned short vkey; - unsigned short scan; - } kbd; - struct - { - int type; - int x; - int y; - unsigned int data; - } mouse; - } rawinput; + union rawinput rawinput; }; struct callback_msg_data @@ -330,6 +332,7 @@ typedef union int type; unsigned int msg; lparam_t lparam; + union rawinput rawinput; } hw; } hw_input_t; @@ -6233,7 +6236,7 @@ union generic_reply /* ### protocol_version begin ### */ -#define SERVER_PROTOCOL_VERSION 698 +#define SERVER_PROTOCOL_VERSION 699 /* ### protocol_version end ### */ diff --git a/server/protocol.def b/server/protocol.def index abfd6d70240..10c5943a189 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -278,30 +278,32 @@ struct hw_msg_source unsigned int origin; /* source origin (IMO_* values) */ }; +union rawinput +{ + int type; + struct + { + int type; /* RIM_TYPEKEYBOARD */ + unsigned int message; /* message generated by this rawinput event */ + unsigned short vkey; /* virtual key code */ + unsigned short scan; /* scan code */ + } kbd; + struct + { + int type; /* RIM_TYPEMOUSE */ + int x; /* x coordinate */ + int y; /* y coordinate */ + unsigned int data; /* mouse data */ + } mouse; +}; + struct hardware_msg_data { lparam_t info; /* extra info */ unsigned int hw_id; /* unique id */ unsigned int flags; /* hook flags */ struct hw_msg_source source; /* message source */ - union - { - int type; - struct - { - int type; /* RIM_TYPEKEYBOARD */ - unsigned int message; /* message generated by this rawinput event */ - unsigned short vkey; /* virtual key code */ - unsigned short scan; /* scan code */ - } kbd; - struct - { - int type; /* RIM_TYPEMOUSE */ - int x; /* x coordinate */ - int y; /* y coordinate */ - unsigned int data; /* mouse data */ - } mouse; - } rawinput; + union rawinput rawinput; /* rawinput message data */ }; struct callback_msg_data @@ -346,6 +348,7 @@ typedef union int type; /* INPUT_HARDWARE */ unsigned int msg; /* message code */ lparam_t lparam; /* message param */ + union rawinput rawinput;/* rawinput message data */ } hw; } hw_input_t; diff --git a/server/trace.c b/server/trace.c index 6b8c1ad3342..3cbdaf78185 100644 --- a/server/trace.c +++ b/server/trace.c @@ -395,6 +395,24 @@ static void dump_irp_params( const char *prefix, const irp_params_t *data ) } } +static void dump_rawinput( const char *prefix, const union rawinput *rawinput ) +{ + switch (rawinput->type) + { + case RIM_TYPEMOUSE: + fprintf( stderr, "%s{type=MOUSE,x=%d,y=%d,data=%08x}", prefix, rawinput->mouse.x, + rawinput->mouse.y, rawinput->mouse.data ); + break; + case RIM_TYPEKEYBOARD: + fprintf( stderr, "%s{type=KEYBOARD,message=%04x,vkey=%04hx,scan=%04hx}", prefix, + rawinput->kbd.message, rawinput->kbd.vkey, rawinput->kbd.scan ); + break; + default: + fprintf( stderr, "%s{type=%04x}", prefix, rawinput->type ); + break; + } +} + static void dump_hw_input( const char *prefix, const hw_input_t *input ) { switch (input->type) @@ -415,6 +433,11 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input ) case INPUT_HARDWARE: fprintf( stderr, "%s{type=HARDWARE,msg=%04x", prefix, input->hw.msg ); dump_uint64( ",lparam=", &input->hw.lparam ); + switch (input->hw.msg) + { + case WM_INPUT_DEVICE_CHANGE: + dump_rawinput( ",rawinput=", &input->hw.rawinput ); + } fputc( '}', stderr ); break; default: