From: EBADBEEF errno@ebadf.com
The "noraw" flags are used to mask off the original event flags. They are applied to INPUT_MOUSE and INPUT_KEYBOARD events to prevent generating a rawinput. --- include/wine/server_protocol.h | 2 ++ server/protocol.def | 2 ++ server/queue.c | 23 +++++++++++++++++------ server/trace.c | 9 +++++---- 4 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index a392b532f4e..1ba7b3dd3c7 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -327,6 +327,7 @@ typedef union unsigned short vkey; unsigned short scan; unsigned int flags; + unsigned int noraw; unsigned int time; lparam_t info; } kbd; @@ -337,6 +338,7 @@ typedef union int y; unsigned int data; unsigned int flags; + unsigned int noraw; unsigned int time; lparam_t info; } mouse; diff --git a/server/protocol.def b/server/protocol.def index e9195df6b65..6c329c44e20 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -343,6 +343,7 @@ typedef union unsigned short vkey; /* virtual key code */ unsigned short scan; /* scan code */ unsigned int flags; /* event flags */ + unsigned int noraw; /* flags to suppress rawinput generation */ unsigned int time; /* event time */ lparam_t info; /* extra info */ } kbd; @@ -353,6 +354,7 @@ typedef union int y; unsigned int data; /* mouse data */ unsigned int flags; /* event flags */ + unsigned int noraw; /* flags to suppress rawinput generation */ unsigned int time; /* event time */ lparam_t info; /* extra info */ } mouse; diff --git a/server/queue.c b/server/queue.c index f609ce4478b..a49c47c346b 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1864,6 +1864,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons unsigned int i, time, flags; struct hw_msg_source source = { IMDT_MOUSE, origin }; int wait = 0, x, y; + unsigned int raw_flags;
static const unsigned int messages[] = { @@ -1884,6 +1885,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
desktop->cursor.last_change = get_tick_count(); flags = input->mouse.flags; + raw_flags = (input->mouse.flags & ~input->mouse.noraw); time = input->mouse.time; if (!time) time = desktop->cursor.last_change;
@@ -1896,6 +1898,10 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons if (flags & ~(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE) && x == desktop->cursor.x && y == desktop->cursor.y) flags &= ~MOUSEEVENTF_MOVE; + + /* rawinput does not currently support absolute events which + * use (65535,65535) coordinate space */ + raw_flags &= ~MOUSEEVENTF_ABSOLUTE; } else { @@ -1909,7 +1915,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons y = desktop->cursor.y; }
- if ((foreground = get_foreground_thread( desktop, win ))) + if (raw_flags && (foreground = get_foreground_thread( desktop, win ))) { memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; @@ -1921,10 +1927,13 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons msg_data = &raw_msg.data; msg_data->info = input->mouse.info; msg_data->size = sizeof(*msg_data); - msg_data->flags = flags; + msg_data->flags = raw_flags; + if (raw_flags & MOUSEEVENTF_MOVE) + { + msg_data->rawinput.mouse.x = x - desktop->cursor.x; + msg_data->rawinput.mouse.y = y - desktop->cursor.y; + } 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;
enum_processes( queue_rawinput_message, &raw_msg ); @@ -1980,6 +1989,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c unsigned char vkey = input->kbd.vkey; unsigned int message_code, time; int wait; + unsigned int raw_flags;
if (!(time = input->kbd.time)) time = get_tick_count();
@@ -2047,7 +2057,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c break; }
- if ((foreground = get_foreground_thread( desktop, win ))) + raw_flags = (input->kbd.flags & ~input->kbd.noraw); + if (raw_flags && (foreground = get_foreground_thread( desktop, win ))) { memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; @@ -2059,7 +2070,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c 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->flags = raw_flags; msg_data->rawinput.type = RIM_TYPEKEYBOARD; msg_data->rawinput.kbd.message = message_code; msg_data->rawinput.kbd.vkey = vkey; diff --git a/server/trace.c b/server/trace.c index 55ccefa1746..ecbd1735e62 100644 --- a/server/trace.c +++ b/server/trace.c @@ -449,15 +449,16 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input ) switch (input->type) { case INPUT_MOUSE: - fprintf( stderr, "%s{type=MOUSE,x=%d,y=%d,data=%08x,flags=%08x,time=%u", + fprintf( stderr, "%s{type=MOUSE,x=%d,y=%d,data=%08x,flags=%08x,noraw=%08x,time=%u", prefix, input->mouse.x, input->mouse.y, input->mouse.data, input->mouse.flags, - input->mouse.time ); + input->mouse.noraw, input->mouse.time ); dump_uint64( ",info=", &input->mouse.info ); fputc( '}', stderr ); break; case INPUT_KEYBOARD: - fprintf( stderr, "%s{type=KEYBOARD,vkey=%04hx,scan=%04hx,flags=%08x,time=%u", - prefix, input->kbd.vkey, input->kbd.scan, input->kbd.flags, input->kbd.time ); + fprintf( stderr, "%s{type=KEYBOARD,vkey=%04hx,scan=%04hx,flags=%08x,noraw=%08x,time=%u", + prefix, input->kbd.vkey, input->kbd.scan, input->kbd.flags, input->kbd.noraw, + input->kbd.time ); dump_uint64( ",info=", &input->kbd.info ); fputc( '}', stderr ); break;