[PATCH 2/4] server: Add rawinput union to hw_input_t / INPUT_HARDWARE.
Rémi Bernon
rbernon at codeweavers.com
Thu May 6 05:57:31 CDT 2021
When msg is WM_INPUT_DEVICE_CHANGE.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
server/protocol.def | 39 +++++++++++++++++++++------------------
server/trace.c | 23 +++++++++++++++++++++++
2 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/server/protocol.def b/server/protocol.def
index 9361933d47c..6263f7a544e 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 645c183a52f..cddeaa2d769 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -394,6 +394,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)
@@ -414,6 +432,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:
--
2.31.0
More information about the wine-devel
mailing list