From: Grigory Vasilyev h0tc0d3@gmail.com
--- dlls/win32u/message.c | 2 ++ include/wine/server_protocol.h | 3 ++- server/protocol.def | 1 + server/queue.c | 18 +++++++++++------- 4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index d1f49ca3ed9..22965835316 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3495,6 +3495,7 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA req->input.mouse.flags = input->mi.dwFlags; req->input.mouse.time = input->mi.time; req->input.mouse.info = input->mi.dwExtraInfo; + if (flags & SEND_HWMSG_RAWINPUT) req->flags |= SEND_HWMSG_RAWINPUT; affects_key_state = !!(input->mi.dwFlags & (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP | MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_MIDDLEDOWN | MOUSEEVENTF_MIDDLEUP | @@ -3523,6 +3524,7 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA req->input.kbd.flags = input->ki.dwFlags & ~KEYEVENTF_SCANCODE; req->input.kbd.time = input->ki.time; req->input.kbd.info = input->ki.dwExtraInfo; + if (flags & SEND_HWMSG_RAWINPUT) req->flags |= SEND_HWMSG_RAWINPUT; affects_key_state = TRUE; break; case INPUT_HARDWARE: diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 8a5ae71b856..a4d4480561c 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -2885,6 +2885,7 @@ struct send_hardware_message_reply char __pad_28[4]; }; #define SEND_HWMSG_INJECTED 0x01 +#define SEND_HWMSG_RAWINPUT 0x02
@@ -6534,7 +6535,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 806 +#define SERVER_PROTOCOL_VERSION 807
/* ### protocol_version end ### */
diff --git a/server/protocol.def b/server/protocol.def index 25184641082..0802dbcca13 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2161,6 +2161,7 @@ enum message_type int new_y; @END #define SEND_HWMSG_INJECTED 0x01 +#define SEND_HWMSG_RAWINPUT 0x02
/* Get a message from the current queue */ diff --git a/server/queue.c b/server/queue.c index 5a6f954bc4d..cf086ec729b 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1839,8 +1839,8 @@ static void rawmouse_init( struct rawinput *header, RAWMOUSE *rawmouse, int x, i }
rawmouse->ulRawButtons = 0; - rawmouse->lLastX = x; - rawmouse->lLastY = y; + rawmouse->lLastX = (flags & MOUSEEVENTF_MOVE) ? x : 0; + rawmouse->lLastY = (flags & MOUSEEVENTF_MOVE) ? y : 0; rawmouse->ulExtraInformation = info; }
@@ -1980,7 +1980,7 @@ static void dispatch_rawinput_message( struct desktop *desktop, struct rawinput_
/* queue a hardware message for a mouse event */ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input, - unsigned int origin, struct msg_queue *sender ) + unsigned int origin, struct msg_queue *sender, unsigned int req_flags ) { struct hardware_msg_data *msg_data; struct rawinput_message raw_msg; @@ -2043,8 +2043,13 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons raw_msg.time = time; raw_msg.message = WM_INPUT; raw_msg.flags = flags; - rawmouse_init( &raw_msg.rawinput, &raw_msg.data.mouse, x - desktop->cursor.x, y - desktop->cursor.y, - raw_msg.flags, input->mouse.data, input->mouse.info ); + + if(req_flags & SEND_HWMSG_RAWINPUT) + rawmouse_init( &raw_msg.rawinput, &raw_msg.data.mouse, input->mouse.x, input->mouse.y, + raw_msg.flags, input->mouse.data, input->mouse.info); + else + rawmouse_init( &raw_msg.rawinput, &raw_msg.data.mouse, x - desktop->cursor.x, y - desktop->cursor.y, + raw_msg.flags, input->mouse.data, input->mouse.info);
dispatch_rawinput_message( desktop, &raw_msg ); release_object( foreground ); @@ -2222,7 +2227,6 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c desktop->key_repeat.timeout = add_timeout_user( timeout, key_repeat_timeout, desktop ); } } - if (!unicode && (foreground = get_foreground_thread( desktop, win ))) { struct rawinput_message raw_msg = {0}; @@ -2981,7 +2985,7 @@ DECL_HANDLER(send_hardware_message) switch (req->input.type) { case INPUT_MOUSE: - wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender ); + wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender, req->flags ); break; case INPUT_KEYBOARD: wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender, 0 );