Commit bd2410d7 authored by Rémi Bernon's avatar Rémi Bernon Committed by Vitaly Lipatov

user32: Set SEND_HWMSG_RAWINPUT flags only when RAWINPUT is set.

So we can generate legacy messages only by calling __wine_send_input with NULL rawinput, and generate WM_INPUT messages only by calling __wine_send_input with INPUT_HARDWARE input type and a rawinput.
parent d71e828a
...@@ -131,6 +131,7 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size ) ...@@ -131,6 +131,7 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size )
{ {
UINT i; UINT i;
NTSTATUS status = STATUS_SUCCESS; NTSTATUS status = STATUS_SUCCESS;
RAWINPUT rawinput;
if (size != sizeof(INPUT)) if (size != sizeof(INPUT))
{ {
...@@ -160,7 +161,7 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size ) ...@@ -160,7 +161,7 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size )
update_mouse_coords( &input ); update_mouse_coords( &input );
/* fallthrough */ /* fallthrough */
case INPUT_KEYBOARD: case INPUT_KEYBOARD:
status = send_hardware_message( 0, &input, NULL, SEND_HWMSG_INJECTED ); status = send_hardware_message( 0, &input, &rawinput, SEND_HWMSG_INJECTED );
break; break;
case INPUT_HARDWARE: case INPUT_HARDWARE:
SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
......
...@@ -2432,7 +2432,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r ...@@ -2432,7 +2432,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
req->input.mouse.flags = input->mi.dwFlags; req->input.mouse.flags = input->mi.dwFlags;
req->input.mouse.time = input->mi.time; req->input.mouse.time = input->mi.time;
req->input.mouse.info = input->mi.dwExtraInfo; req->input.mouse.info = input->mi.dwExtraInfo;
req->flags |= SEND_HWMSG_RAWINPUT; if (rawinput) req->flags |= SEND_HWMSG_RAWINPUT;
break; break;
case INPUT_KEYBOARD: case INPUT_KEYBOARD:
req->input.kbd.vkey = input->ki.wVk; req->input.kbd.vkey = input->ki.wVk;
...@@ -2440,7 +2440,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r ...@@ -2440,7 +2440,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
req->input.kbd.flags = input->ki.dwFlags; req->input.kbd.flags = input->ki.dwFlags;
req->input.kbd.time = input->ki.time; req->input.kbd.time = input->ki.time;
req->input.kbd.info = input->ki.dwExtraInfo; req->input.kbd.info = input->ki.dwExtraInfo;
req->flags |= SEND_HWMSG_RAWINPUT; if (rawinput) req->flags |= SEND_HWMSG_RAWINPUT;
break; break;
case INPUT_HARDWARE: case INPUT_HARDWARE:
req->input.hw.msg = input->hi.uMsg; req->input.hw.msg = input->hi.uMsg;
......
...@@ -674,6 +674,7 @@ static BOOL get_async_key_state( BYTE state[256] ) ...@@ -674,6 +674,7 @@ static BOOL get_async_key_state( BYTE state[256] )
static void send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags ) static void send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags )
{ {
RAWINPUT rawinput;
INPUT input; INPUT input;
input.type = INPUT_KEYBOARD; input.type = INPUT_KEYBOARD;
...@@ -683,7 +684,7 @@ static void send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags ) ...@@ -683,7 +684,7 @@ static void send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags )
input.u.ki.time = 0; input.u.ki.time = 0;
input.u.ki.dwExtraInfo = 0; input.u.ki.dwExtraInfo = 0;
__wine_send_input( hwnd, &input, NULL ); __wine_send_input( hwnd, &input, &rawinput );
} }
/*********************************************************************** /***********************************************************************
......
...@@ -424,6 +424,7 @@ static int process_events( DWORD mask ) ...@@ -424,6 +424,7 @@ static int process_events( DWORD mask )
DPI_AWARENESS_CONTEXT context; DPI_AWARENESS_CONTEXT context;
struct java_event *event, *next, *previous; struct java_event *event, *next, *previous;
unsigned int count = 0; unsigned int count = 0;
RAWINPUT rawinput;
assert( GetCurrentThreadId() == desktop_tid ); assert( GetCurrentThreadId() == desktop_tid );
...@@ -517,7 +518,7 @@ static int process_events( DWORD mask ) ...@@ -517,7 +518,7 @@ static int process_events( DWORD mask )
} }
SERVER_END_REQ; SERVER_END_REQ;
} }
__wine_send_input( capture ? capture : event->data.motion.hwnd, &event->data.motion.input, NULL ); __wine_send_input( capture ? capture : event->data.motion.hwnd, &event->data.motion.input, &rawinput );
} }
break; break;
...@@ -531,7 +532,7 @@ static int process_events( DWORD mask ) ...@@ -531,7 +532,7 @@ static int process_events( DWORD mask )
event->data.kbd.input.u.ki.wVk, event->data.kbd.input.u.ki.wVk, event->data.kbd.input.u.ki.wVk, event->data.kbd.input.u.ki.wVk,
event->data.kbd.input.u.ki.wScan ); event->data.kbd.input.u.ki.wScan );
update_keyboard_lock_state( event->data.kbd.input.u.ki.wVk, event->data.kbd.lock_state ); update_keyboard_lock_state( event->data.kbd.input.u.ki.wVk, event->data.kbd.lock_state );
__wine_send_input( 0, &event->data.kbd.input, NULL ); __wine_send_input( 0, &event->data.kbd.input, &rawinput );
break; break;
default: default:
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "imm.h" #include "imm.h"
#include "ddk/imm.h" #include "ddk/imm.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/server.h"
WINE_DEFAULT_DEBUG_CHANNEL(imm); WINE_DEFAULT_DEBUG_CHANNEL(imm);
...@@ -1408,6 +1409,7 @@ NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size) ...@@ -1408,6 +1409,7 @@ NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size)
params->cursor_pos, !params->complete); params->cursor_pos, !params->complete);
else else
{ {
RAWINPUT rawinput;
INPUT input; INPUT input;
unsigned int i; unsigned int i;
...@@ -1420,10 +1422,10 @@ NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size) ...@@ -1420,10 +1422,10 @@ NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size)
{ {
input.ki.wScan = params->text[i]; input.ki.wScan = params->text[i];
input.ki.dwFlags = KEYEVENTF_UNICODE; input.ki.dwFlags = KEYEVENTF_UNICODE;
__wine_send_input(params->hwnd, &input, NULL); __wine_send_input(params->hwnd, &input, &rawinput);
input.ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP; input.ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP;
__wine_send_input(params->hwnd, &input, NULL); __wine_send_input(params->hwnd, &input, &rawinput);
} }
} }
} }
......
...@@ -990,6 +990,7 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data) ...@@ -990,6 +990,7 @@ void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data)
*/ */
static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, DWORD flags, DWORD time) static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, DWORD flags, DWORD time)
{ {
RAWINPUT rawinput;
INPUT input; INPUT input;
TRACE_(key)("hwnd %p vkey=%04x scan=%04x flags=%04x\n", hwnd, vkey, scan, flags); TRACE_(key)("hwnd %p vkey=%04x scan=%04x flags=%04x\n", hwnd, vkey, scan, flags);
...@@ -1001,7 +1002,7 @@ static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, DWORD fl ...@@ -1001,7 +1002,7 @@ static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, DWORD fl
input.ki.time = time; input.ki.time = time;
input.ki.dwExtraInfo = 0; input.ki.dwExtraInfo = 0;
__wine_send_input(hwnd, &input, NULL); __wine_send_input(hwnd, &input, &rawinput);
} }
......
...@@ -129,6 +129,7 @@ static const CFStringRef cocoa_cursor_names[] = ...@@ -129,6 +129,7 @@ static const CFStringRef cocoa_cursor_names[] =
static void send_mouse_input(HWND hwnd, macdrv_window cocoa_window, UINT flags, int x, int y, static void send_mouse_input(HWND hwnd, macdrv_window cocoa_window, UINT flags, int x, int y,
DWORD mouse_data, BOOL drag, unsigned long time) DWORD mouse_data, BOOL drag, unsigned long time)
{ {
RAWINPUT rawinput;
INPUT input; INPUT input;
HWND top_level_hwnd; HWND top_level_hwnd;
...@@ -158,7 +159,7 @@ static void send_mouse_input(HWND hwnd, macdrv_window cocoa_window, UINT flags, ...@@ -158,7 +159,7 @@ static void send_mouse_input(HWND hwnd, macdrv_window cocoa_window, UINT flags,
input.mi.time = time; input.mi.time = time;
input.mi.dwExtraInfo = 0; input.mi.dwExtraInfo = 0;
__wine_send_input(top_level_hwnd, &input, NULL); __wine_send_input(top_level_hwnd, &input, &rawinput);
} }
......
...@@ -1134,6 +1134,7 @@ static WORD EVENT_event_to_vkey( XIC xic, XKeyEvent *e) ...@@ -1134,6 +1134,7 @@ static WORD EVENT_event_to_vkey( XIC xic, XKeyEvent *e)
*/ */
static void X11DRV_send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags, DWORD time ) static void X11DRV_send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags, DWORD time )
{ {
RAWINPUT rawinput;
INPUT input; INPUT input;
TRACE_(key)( "hwnd %p vkey=%04x scan=%04x flags=%04x\n", hwnd, vkey, scan, flags ); TRACE_(key)( "hwnd %p vkey=%04x scan=%04x flags=%04x\n", hwnd, vkey, scan, flags );
...@@ -1145,7 +1146,7 @@ static void X11DRV_send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD f ...@@ -1145,7 +1146,7 @@ static void X11DRV_send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD f
input.u.ki.time = time; input.u.ki.time = time;
input.u.ki.dwExtraInfo = 0; input.u.ki.dwExtraInfo = 0;
__wine_send_input( hwnd, &input, NULL ); __wine_send_input( hwnd, &input, &rawinput );
} }
......
...@@ -749,6 +749,7 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x ...@@ -749,6 +749,7 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x
static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPUT *input ) static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPUT *input )
{ {
struct x11drv_win_data *data; struct x11drv_win_data *data;
RAWINPUT rawinput;
input->type = INPUT_MOUSE; input->type = INPUT_MOUSE;
...@@ -765,7 +766,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU ...@@ -765,7 +766,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
sync_window_cursor( window ); sync_window_cursor( window );
last_cursor_change = input->u.mi.time; last_cursor_change = input->u.mi.time;
} }
__wine_send_input( hwnd, input, NULL ); __wine_send_input( hwnd, input, &rawinput );
return; return;
} }
...@@ -805,7 +806,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU ...@@ -805,7 +806,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
SERVER_END_REQ; SERVER_END_REQ;
} }
__wine_send_input( hwnd, input, NULL ); __wine_send_input( hwnd, input, &rawinput );
} }
#ifdef SONAME_LIBXCURSOR #ifdef SONAME_LIBXCURSOR
...@@ -1787,6 +1788,7 @@ void move_resize_window( HWND hwnd, int dir ) ...@@ -1787,6 +1788,7 @@ void move_resize_window( HWND hwnd, int dir )
{ {
MSG msg; MSG msg;
INPUT input; INPUT input;
RAWINPUT rawinput;
int x, y, rootX, rootY; int x, y, rootX, rootY;
if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break; if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break;
...@@ -1802,7 +1804,7 @@ void move_resize_window( HWND hwnd, int dir ) ...@@ -1802,7 +1804,7 @@ void move_resize_window( HWND hwnd, int dir )
input.u.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.u.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
input.u.mi.time = NtGetTickCount(); input.u.mi.time = NtGetTickCount();
input.u.mi.dwExtraInfo = 0; input.u.mi.dwExtraInfo = 0;
__wine_send_input( hwnd, &input, NULL ); __wine_send_input( hwnd, &input, &rawinput );
} }
while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE )) while (NtUserPeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
...@@ -2015,6 +2017,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) ...@@ -2015,6 +2017,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
{ {
XIRawEvent *event = xev->data; XIRawEvent *event = xev->data;
RAWINPUT rawinput;
INPUT input; INPUT input;
if (broken_rawevents && is_old_motion_event( xev->serial )) if (broken_rawevents && is_old_motion_event( xev->serial ))
...@@ -2032,7 +2035,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) ...@@ -2032,7 +2035,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
input.u.mi.dy = 0; input.u.mi.dy = 0;
if (!map_raw_event_coords( event, &input )) return FALSE; if (!map_raw_event_coords( event, &input )) return FALSE;
__wine_send_input( 0, &input, NULL ); __wine_send_input( 0, &input, &rawinput );
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment