Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- dlls/user32/rawinput.c | 2 +- server/queue.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c index 2085fd3f9f..120de073c8 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c @@ -250,7 +250,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(RAWINPUTDEVICE *devices, U TRACE("device %u: page %#x, usage %#x, flags %#x, target %p.\n", i, devices[i].usUsagePage, devices[i].usUsage, devices[i].dwFlags, devices[i].hwndTarget); - if (devices[i].dwFlags & ~RIDEV_REMOVE) + if (devices[i].dwFlags & ~(RIDEV_REMOVE|RIDEV_NOLEGACY)) FIXME("Unhandled flags %#x for device %u.\n", devices[i].dwFlags, i);
d[i].usage_page = devices[i].usUsagePage; diff --git a/server/queue.c b/server/queue.c index 24239916af..4987fca79f 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1668,6 +1668,9 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons msg_data->rawinput.mouse.data = input->mouse.data;
queue_hardware_message( desktop, msg, 0 ); + + if (device->flags & RIDEV_NOLEGACY) + return FALSE; }
for (i = 0; i < ARRAY_SIZE( messages ); i++) @@ -1793,6 +1796,9 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c msg_data->rawinput.kbd.scan = input->kbd.scan;
queue_hardware_message( desktop, msg, 0 ); + + if (device->flags & RIDEV_NOLEGACY) + return FALSE; }
if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- dlls/user32/message.c | 46 +++---------------------------------------- server/protocol.def | 9 +++++---- server/queue.c | 46 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 49 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 43ce77c2dd..b6dd7d5932 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -2295,54 +2295,14 @@ static BOOL process_rawinput_message( MSG *msg, const struct hardware_msg_data * rawinput->header.dwType = msg_data->rawinput.type; if (msg_data->rawinput.type == RIM_TYPEMOUSE) { - static const unsigned int button_flags[] = - { - 0, /* MOUSEEVENTF_MOVE */ - RI_MOUSE_LEFT_BUTTON_DOWN, /* MOUSEEVENTF_LEFTDOWN */ - RI_MOUSE_LEFT_BUTTON_UP, /* MOUSEEVENTF_LEFTUP */ - RI_MOUSE_RIGHT_BUTTON_DOWN, /* MOUSEEVENTF_RIGHTDOWN */ - RI_MOUSE_RIGHT_BUTTON_UP, /* MOUSEEVENTF_RIGHTUP */ - RI_MOUSE_MIDDLE_BUTTON_DOWN, /* MOUSEEVENTF_MIDDLEDOWN */ - RI_MOUSE_MIDDLE_BUTTON_UP, /* MOUSEEVENTF_MIDDLEUP */ - }; - unsigned int i; - rawinput->header.dwSize = FIELD_OFFSET(RAWINPUT, data) + sizeof(RAWMOUSE); rawinput->header.hDevice = WINE_MOUSE_HANDLE; rawinput->header.wParam = 0;
rawinput->data.mouse.usFlags = MOUSE_MOVE_RELATIVE; - rawinput->data.mouse.u.s.usButtonFlags = 0; - rawinput->data.mouse.u.s.usButtonData = 0; - for (i = 1; i < ARRAY_SIZE(button_flags); ++i) - { - if (msg_data->flags & (1 << i)) - rawinput->data.mouse.u.s.usButtonFlags |= button_flags[i]; - } - if (msg_data->flags & MOUSEEVENTF_WHEEL) - { - rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_WHEEL; - rawinput->data.mouse.u.s.usButtonData = msg_data->rawinput.mouse.data; - } - if (msg_data->flags & MOUSEEVENTF_HWHEEL) - { - rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_HORIZONTAL_WHEEL; - rawinput->data.mouse.u.s.usButtonData = msg_data->rawinput.mouse.data; - } - if (msg_data->flags & MOUSEEVENTF_XDOWN) - { - if (msg_data->rawinput.mouse.data == XBUTTON1) - rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_BUTTON_4_DOWN; - else if (msg_data->rawinput.mouse.data == XBUTTON2) - rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_BUTTON_5_DOWN; - } - if (msg_data->flags & MOUSEEVENTF_XUP) - { - if (msg_data->rawinput.mouse.data == XBUTTON1) - rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_BUTTON_4_UP; - else if (msg_data->rawinput.mouse.data == XBUTTON2) - rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_BUTTON_5_UP; - } + + rawinput->data.mouse.u.s.usButtonFlags = msg_data->rawinput.mouse.button_flags; + rawinput->data.mouse.u.s.usButtonData = msg_data->rawinput.mouse.button_data;
rawinput->data.mouse.ulRawButtons = 0; rawinput->data.mouse.lLastX = msg_data->rawinput.mouse.x; diff --git a/server/protocol.def b/server/protocol.def index 5adc83db8b..8b8a8a1512 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -304,10 +304,11 @@ struct hardware_msg_data } kbd; struct { - int type; /* RIM_TYPEMOUSE */ - int x; /* x coordinate */ - int y; /* y coordinate */ - unsigned int data; /* mouse data */ + int type; /* RIM_TYPEMOUSE */ + int x; /* x coordinate */ + int y; /* y coordinate */ + unsigned short button_flags; /* mouse button */ + unsigned short button_data; /* event details */ } mouse; } rawinput; }; diff --git a/server/queue.c b/server/queue.c index 4987fca79f..5a001a87fe 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1624,6 +1624,16 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons WM_MOUSEHWHEEL /* 0x1000 = MOUSEEVENTF_HWHEEL */ };
+ static const unsigned int raw_button_flags[] = { + 0, /* 0x0001 = MOUSEEVENTF_MOVE */ + RI_MOUSE_LEFT_BUTTON_DOWN, /* 0x0002 = MOUSEEVENTF_LEFTDOWN */ + RI_MOUSE_LEFT_BUTTON_UP, /* 0x0004 = MOUSEEVENTF_LEFTUP */ + RI_MOUSE_RIGHT_BUTTON_DOWN, /* 0x0008 = MOUSEEVENTF_RIGHTDOWN */ + RI_MOUSE_RIGHT_BUTTON_UP, /* 0x0010 = MOUSEEVENTF_RIGHTUP */ + RI_MOUSE_MIDDLE_BUTTON_DOWN, /* 0x0020 = MOUSEEVENTF_MIDDLEDOWN */ + RI_MOUSE_MIDDLE_BUTTON_UP, /* 0x0040 = MOUSEEVENTF_MIDDLEUP */ + }; + desktop->cursor.last_change = get_tick_count(); flags = input->mouse.flags; time = input->mouse.time; @@ -1661,11 +1671,43 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons msg->wparam = RIM_INPUT; msg->lparam = 0;
- msg_data->flags = flags; + msg_data->flags = 0; 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; + msg_data->rawinput.mouse.button_flags = 0; + msg_data->rawinput.mouse.button_data = 0; + + for (i = 1; i < ARRAY_SIZE(raw_button_flags); ++i) + { + if (flags & (1 << i)) + msg_data->rawinput.mouse.button_flags |= raw_button_flags[i]; + } + + if (flags & MOUSEEVENTF_WHEEL) + { + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_WHEEL; + msg_data->rawinput.mouse.button_data = input->mouse.data; + } + if (flags & MOUSEEVENTF_HWHEEL) + { + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_HORIZONTAL_WHEEL; + msg_data->rawinput.mouse.button_data = input->mouse.data; + } + if (flags & MOUSEEVENTF_XDOWN) + { + if (input->mouse.data == XBUTTON1) + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_4_DOWN; + else if (input->mouse.data == XBUTTON2) + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_5_DOWN; + } + if (flags & MOUSEEVENTF_XUP) + { + if (input->mouse.data == XBUTTON1) + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_4_UP; + else if (input->mouse.data == XBUTTON2) + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_5_UP; + }
queue_hardware_message( desktop, msg, 0 );
Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- server/protocol.def | 28 ++++++++++++++++++++++++++++ server/queue.c | 41 +++++++++++++++++++++++++++++++++++++++++ server/trace.c | 21 +++++++++++++++++++++ tools/make_requests | 1 + 4 files changed, 91 insertions(+)
diff --git a/server/protocol.def b/server/protocol.def index 8b8a8a1512..3a6a202f49 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -358,6 +358,29 @@ typedef union } hw; } hw_input_t;
+typedef union +{ + int type; + struct + { + int type; /* RIM_TYPEMOUSE */ + int x; /* relative x movement */ + int y; /* relative y movement */ + unsigned short button_flags; /* mouse button */ + unsigned short button_data; /* event details */ + } mouse; + struct + { + int type; /* RIM_TYPEKEYBOARD */ + /* TODO: fill this in if/when necessary */ + } kbd; + struct + { + int type; /* RIM_TYPEHID */ + /* TODO: fill this in if/when necessary */ + } hid; +} hw_rawinput_t; + typedef union { unsigned char bytes[1]; /* raw data for sent messages */ @@ -2294,6 +2317,11 @@ enum message_type #define SEND_HWMSG_INJECTED 0x01
+@REQ(send_rawinput_message) + hw_rawinput_t input; +@END + + /* Get a message from the current queue */ @REQ(get_message) unsigned int flags; /* PM_* flags */ diff --git a/server/queue.c b/server/queue.c index 5a001a87fe..26a2282809 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2418,6 +2418,47 @@ DECL_HANDLER(send_hardware_message) release_object( desktop ); }
+/* send a hardware rawinput message to the queue thread */ +DECL_HANDLER(send_rawinput_message) +{ + const struct rawinput_device *device; + struct hardware_msg_data *msg_data; + struct message *msg; + struct desktop *desktop; + struct hw_msg_source source = { IMDT_MOUSE, IMO_HARDWARE }; + + desktop = get_thread_desktop( current, 0 ); + + switch (req->input.type) + { + case RIM_TYPEMOUSE: + if ((device = current->process->rawinput_mouse)) + { + if (!(msg = alloc_hardware_message( 0, source, 0 ))) return; + msg_data = msg->data; + + msg->win = device->target; + msg->msg = WM_INPUT; + msg->wparam = RIM_INPUT; + msg->lparam = 0; + + msg_data->flags = 0; + msg_data->rawinput.type = RIM_TYPEMOUSE; + msg_data->rawinput.mouse.x = req->input.mouse.x; + msg_data->rawinput.mouse.y = req->input.mouse.y; + msg_data->rawinput.mouse.button_flags = req->input.mouse.button_flags; + msg_data->rawinput.mouse.button_data = req->input.mouse.button_data; + + queue_hardware_message( desktop, msg, 0 ); + } + break; + default: + set_error( STATUS_INVALID_PARAMETER ); + } + + release_object(desktop); +} + /* post a quit message to the current queue */ DECL_HANDLER(post_quit_message) { diff --git a/server/trace.c b/server/trace.c index 3562823659..bccab449cf 100644 --- a/server/trace.c +++ b/server/trace.c @@ -390,6 +390,27 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input ) } }
+static void dump_hw_rawinput( const char *prefix, const hw_rawinput_t *rawinput ) +{ + switch (rawinput->type) + { + case RIM_TYPEMOUSE: + fprintf( stderr, "%s{type=MOUSE,x=%d,y=%d,button_flags=%04hx,button_data=%04hx}", + prefix, rawinput->mouse.x, rawinput->mouse.y, rawinput->mouse.button_flags, + rawinput->mouse.button_data); + break; + case RIM_TYPEKEYBOARD: + fprintf( stderr, "%s{type=KEYBOARD}\n", prefix); + break; + case RIM_TYPEHID: + fprintf( stderr, "%s{type=HID}\n", prefix); + break; + default: + fprintf( stderr, "%s{type=%04x}", prefix, rawinput->type); + break; + } +} + static void dump_luid( const char *prefix, const luid_t *luid ) { fprintf( stderr, "%s%d.%u", prefix, luid->high_part, luid->low_part ); diff --git a/tools/make_requests b/tools/make_requests index 367f245653..cf631923a7 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -53,6 +53,7 @@ my %formats = "ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ], "cpu_type_t" => [ 4, 4, "&dump_cpu_type" ], "hw_input_t" => [ 32, 8, "&dump_hw_input" ], + "hw_rawinput_t" => [ 16, 8, "&dump_hw_rawinput" ] );
my @requests = ();
Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- dlls/user32/input.c | 29 +++++++++++++++++++++++++++++ dlls/user32/user32.spec | 1 + include/winuser.h | 1 + 3 files changed, 31 insertions(+)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 8b2ae805aa..f7ef1c3be2 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -33,6 +33,7 @@ #include <assert.h>
#define NONAMELESSUNION +#define NONAMELESSSTRUCT
#include "ntstatus.h" #define WIN32_NO_STATUS @@ -129,6 +130,34 @@ BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input ) return !status; }
+BOOL CDECL __wine_send_raw_input( const RAWINPUT *raw_input ) +{ + NTSTATUS status; + + SERVER_START_REQ( send_rawinput_message ) + { + req->input.type = raw_input->header.dwType; + switch (raw_input->header.dwType) + { + case RIM_TYPEMOUSE: + if (raw_input->data.mouse.usFlags || raw_input->data.mouse.ulRawButtons + || raw_input->data.mouse.ulExtraInformation) + WARN("Unhandled parameters"); + + req->input.mouse.x = raw_input->data.mouse.lLastX; + req->input.mouse.y = raw_input->data.mouse.lLastY; + req->input.mouse.button_flags = raw_input->data.mouse.u.s.usButtonFlags; + req->input.mouse.button_data = raw_input->data.mouse.u.s.usButtonData; + break; + } + status = wine_server_call( req ); + } + SERVER_END_REQ; + + if (status) SetLastError( RtlNtStatusToDosError(status) ); + return !status; +} +
/*********************************************************************** * update_mouse_coords diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index d5b8597d8e..7103b86055 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -832,4 +832,5 @@ # or 'wine_' (for user-visible functions) to avoid namespace conflicts. # @ cdecl __wine_send_input(long ptr) +@ cdecl __wine_send_raw_input(ptr) @ cdecl __wine_set_pixel_format(long long) diff --git a/include/winuser.h b/include/winuser.h index 3cffaa19ac..5d8774b6e6 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -4354,6 +4354,7 @@ WORD WINAPI SYSTEM_KillSystemTimer( WORD );
#ifdef __WINESRC__ WINUSERAPI BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input ); +WINUSERAPI BOOL CDECL __wine_send_raw_input( const RAWINPUT *raw_input ); #endif
#ifdef __cplusplus
Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- server/protocol.def | 2 + server/queue.c | 99 ++++++++++++++++++++++++++------------------- 2 files changed, 59 insertions(+), 42 deletions(-)
diff --git a/server/protocol.def b/server/protocol.def index 3a6a202f49..9703b49154 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -358,6 +358,8 @@ typedef union } hw; } hw_input_t;
+#define RIM_ENABLE_NATIVE_MOUSE_MOVE 0x0800 +#define RIM_ENABLE_NATIVE_MOUSE_PRESS 0x1000 typedef union { int type; diff --git a/server/queue.c b/server/queue.c index 26a2282809..1fc5a23f06 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1596,6 +1596,9 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa return 1; }
+int emulate_raw_mouse_move = 1; +int emulate_raw_mouse_press = 1; + /* 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 ) @@ -1663,53 +1666,59 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
if ((device = current->process->rawinput_mouse)) { - if (!(msg = alloc_hardware_message( input->mouse.info, source, time ))) return 0; - msg_data = msg->data; + if ( (emulate_raw_mouse_press && flags & ~MOUSEEVENTF_MOVE) || (emulate_raw_mouse_move && flags & MOUSEEVENTF_MOVE) ) + { + if (!(msg = alloc_hardware_message( input->mouse.info, source, time ))) return 0; + msg_data = msg->data;
- msg->win = device->target; - msg->msg = WM_INPUT; - msg->wparam = RIM_INPUT; - msg->lparam = 0; + msg->win = device->target; + msg->msg = WM_INPUT; + msg->wparam = RIM_INPUT; + msg->lparam = 0;
- msg_data->flags = 0; - 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.button_flags = 0; - msg_data->rawinput.mouse.button_data = 0; + msg_data->flags = 0; + msg_data->rawinput.type = RIM_TYPEMOUSE; + msg_data->rawinput.mouse.x = emulate_raw_mouse_move ? x - desktop->cursor.x : 0; + msg_data->rawinput.mouse.y = emulate_raw_mouse_move ? y - desktop->cursor.y : 0; + msg_data->rawinput.mouse.button_flags = 0; + msg_data->rawinput.mouse.button_data = 0;
- for (i = 1; i < ARRAY_SIZE(raw_button_flags); ++i) - { - if (flags & (1 << i)) - msg_data->rawinput.mouse.button_flags |= raw_button_flags[i]; - } + if (emulate_raw_mouse_press) + { + for (i = 1; i < ARRAY_SIZE(raw_button_flags); ++i) + { + if (flags & (1 << i)) + msg_data->rawinput.mouse.button_flags |= raw_button_flags[i]; + }
- if (flags & MOUSEEVENTF_WHEEL) - { - msg_data->rawinput.mouse.button_flags |= RI_MOUSE_WHEEL; - msg_data->rawinput.mouse.button_data = input->mouse.data; - } - if (flags & MOUSEEVENTF_HWHEEL) - { - msg_data->rawinput.mouse.button_flags |= RI_MOUSE_HORIZONTAL_WHEEL; - msg_data->rawinput.mouse.button_data = input->mouse.data; - } - if (flags & MOUSEEVENTF_XDOWN) - { - if (input->mouse.data == XBUTTON1) - msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_4_DOWN; - else if (input->mouse.data == XBUTTON2) - msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_5_DOWN; - } - if (flags & MOUSEEVENTF_XUP) - { - if (input->mouse.data == XBUTTON1) - msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_4_UP; - else if (input->mouse.data == XBUTTON2) - msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_5_UP; - } + if (flags & MOUSEEVENTF_WHEEL) + { + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_WHEEL; + msg_data->rawinput.mouse.button_data = input->mouse.data; + } + if (flags & MOUSEEVENTF_HWHEEL) + { + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_HORIZONTAL_WHEEL; + msg_data->rawinput.mouse.button_data = input->mouse.data; + } + if (flags & MOUSEEVENTF_XDOWN) + { + if (input->mouse.data == XBUTTON1) + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_4_DOWN; + else if (input->mouse.data == XBUTTON2) + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_5_DOWN; + } + if (flags & MOUSEEVENTF_XUP) + { + if (input->mouse.data == XBUTTON1) + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_4_UP; + else if (input->mouse.data == XBUTTON2) + msg_data->rawinput.mouse.button_flags |= RI_MOUSE_BUTTON_5_UP; + } + }
- queue_hardware_message( desktop, msg, 0 ); + queue_hardware_message( desktop, msg, 0 ); + }
if (device->flags & RIDEV_NOLEGACY) return FALSE; @@ -2452,6 +2461,12 @@ DECL_HANDLER(send_rawinput_message) queue_hardware_message( desktop, msg, 0 ); } break; + case RIM_ENABLE_NATIVE_MOUSE_MOVE: + emulate_raw_mouse_move = 0; + break; + case RIM_ENABLE_NATIVE_MOUSE_PRESS: + emulate_raw_mouse_press = 0; + break; default: set_error( STATUS_INVALID_PARAMETER ); }
Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- dlls/winex11.drv/mouse.c | 95 ++++++++++++++++++++++++++-------- dlls/winex11.drv/x11drv.h | 4 +- dlls/winex11.drv/x11drv_main.c | 1 + 3 files changed, 77 insertions(+), 23 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index f737a306a5..e091efff46 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -284,11 +284,26 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator } #endif
+/*********************************************************************** + * inform_wineserver + */ +static void inform_wineserver(void) +{ + static int once = 0; + if (!once) + { + RAWINPUT raw_input; + raw_input.header.dwType = RIM_ENABLE_NATIVE_MOUSE_MOVE; + __wine_send_raw_input(&raw_input); + once = 1; + } +} +
/*********************************************************************** - * enable_xinput2 + * X11DRV_XInput2_Enable */ -static void enable_xinput2(void) +void X11DRV_XInput2_Enable(void) { #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H struct x11drv_thread_data *data = x11drv_thread_data(); @@ -318,7 +333,6 @@ static void enable_xinput2(void) memset( mask_bits, 0, sizeof(mask_bits) ); XISetMask( mask_bits, XI_DeviceChanged ); XISetMask( mask_bits, XI_RawMotion ); - XISetMask( mask_bits, XI_ButtonPress );
pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 );
@@ -337,19 +351,21 @@ static void enable_xinput2(void) data->xi2_current_slave = 0;
data->xi2_state = xi_enabled; + + inform_wineserver(); #endif }
/*********************************************************************** - * disable_xinput2 + * X11DRV_XInput2_Disable */ -static void disable_xinput2(void) +void X11DRV_XInput2_Disable(void) { #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H struct x11drv_thread_data *data = x11drv_thread_data(); XIEventMask mask;
- if (data->xi2_state != xi_enabled) return; + if (data->xi2_state < xi_enabled) return;
TRACE( "disabling\n" ); data->xi2_state = xi_disabled; @@ -368,6 +384,21 @@ static void disable_xinput2(void) #endif }
+static void use_xinput2_path(void) +{ + struct x11drv_thread_data *thread_data = x11drv_thread_data(); + + if (thread_data->xi2_state == xi_enabled) + thread_data->xi2_state = xi_extra; +} + +static void disable_xinput2_path(void) +{ + struct x11drv_thread_data *thread_data = x11drv_thread_data(); + + if (thread_data->xi2_state == xi_extra) + thread_data->xi2_state = xi_enabled; +}
/*********************************************************************** * grab_clipping_window @@ -393,9 +424,9 @@ static BOOL grab_clipping_window( const RECT *clip ) return TRUE;
/* enable XInput2 unless we are already clipping */ - if (!data->clip_hwnd) enable_xinput2(); + if (!data->clip_hwnd) use_xinput2_path();
- if (data->xi2_state != xi_enabled) + if (data->xi2_state < xi_extra) { WARN( "XInput2 not supported, refusing to clip to %s\n", wine_dbgstr_rect(clip) ); DestroyWindow( msg_hwnd ); @@ -423,7 +454,7 @@ static BOOL grab_clipping_window( const RECT *clip )
if (!clipping_cursor) { - disable_xinput2(); + disable_xinput2_path(); DestroyWindow( msg_hwnd ); return FALSE; } @@ -489,7 +520,7 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd ) TRACE( "clip hwnd reset from %p\n", hwnd ); data->clip_hwnd = 0; data->clip_reset = GetTickCount(); - disable_xinput2(); + disable_xinput2_path(); DestroyWindow( hwnd ); } else if (hwnd == GetForegroundWindow()) /* request to clip */ @@ -1724,16 +1755,18 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) { XIRawEvent *event = xev->data; const double *values = event->valuators.values; + const double *raw_values = event->raw_values; RECT virtual_rect; INPUT input; + RAWINPUT raw_input; int i; - double dx = 0, dy = 0, val; + double dx = 0, dy = 0, raw_dx = 0, raw_dy = 0, val, raw_val; struct x11drv_thread_data *thread_data = x11drv_thread_data(); struct x11drv_valuator_data *x_rel, *y_rel;
if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; - if (thread_data->xi2_state != xi_enabled) return FALSE; + if (thread_data->xi2_state < xi_enabled) return FALSE;
/* If there is no slave currently detected, no previous motion nor device * change events were received. Look it up now on the device list in this @@ -1758,25 +1791,21 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) x_rel = &thread_data->x_rel_valuator; y_rel = &thread_data->y_rel_valuator;
- input.u.mi.mouseData = 0; - input.u.mi.dwFlags = MOUSEEVENTF_MOVE; - input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); - input.u.mi.dwExtraInfo = 0; - input.u.mi.dx = 0; - input.u.mi.dy = 0; - virtual_rect = get_virtual_screen_rect();
for (i = 0; i <= max ( x_rel->number, y_rel->number ); i++) { if (!XIMaskIsSet( event->valuators.mask, i )) continue; val = *values++; + raw_val = *raw_values++; if (i == x_rel->number) { input.u.mi.dx = dx = val; if (x_rel->min < x_rel->max) input.u.mi.dx = val * (virtual_rect.right - virtual_rect.left) / (x_rel->max - x_rel->min); + + raw_dx = raw_val; } if (i == y_rel->number) { @@ -1784,6 +1813,8 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) if (y_rel->min < y_rel->max) input.u.mi.dy = val * (virtual_rect.bottom - virtual_rect.top) / (y_rel->max - y_rel->min); + + raw_dy = raw_val; } }
@@ -1793,10 +1824,30 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) return FALSE; }
- TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy ); + raw_input.data.mouse.lLastX = raw_dx; + raw_input.data.mouse.lLastY = raw_dy; + raw_input.data.mouse.u.usButtonFlags = 0; + raw_input.data.mouse.u.usButtonData = 0; + raw_input.data.mouse.ulExtraInformation = 0; + + TRACE("raw event %f,%f\n", raw_dx, raw_dy); + + raw_input.header.dwType = RIM_TYPEMOUSE; + __wine_send_raw_input( &raw_input ); + + if (thread_data->xi2_state == xi_extra) + { + input.u.mi.mouseData = 0; + input.u.mi.dwFlags = MOUSEEVENTF_MOVE; + input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); + input.u.mi.dwExtraInfo = 0; + + TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy ); + + input.type = INPUT_MOUSE; + __wine_send_input( 0, &input ); + }
- input.type = INPUT_MOUSE; - __wine_send_input( 0, &input ); return TRUE; }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a0308b0675..a9138eef2a 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -194,6 +194,8 @@ extern BOOL X11DRV_UnrealizePalette( HPALETTE hpal ) DECLSPEC_HIDDEN;
extern void X11DRV_Xcursor_Init(void) DECLSPEC_HIDDEN; extern void X11DRV_XInput2_Init(void) DECLSPEC_HIDDEN; +extern void X11DRV_XInput2_Enable(void) DECLSPEC_HIDDEN; +extern void X11DRV_XInput2_Disable(void) DECLSPEC_HIDDEN;
extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image, const struct gdi_image_bits *src_bits, struct gdi_image_bits *dst_bits, @@ -335,7 +337,7 @@ struct x11drv_thread_data HWND clip_hwnd; /* message window stored in desktop while clipping is active */ DWORD clip_reset; /* time when clipping was last reset */ HKL kbd_layout; /* active keyboard layout */ - enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */ + enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled, xi_extra } xi2_state; /* XInput2 state */ void *xi2_devices; /* list of XInput2 devices (valid when state is enabled) */ int xi2_device_count; struct x11drv_valuator_data x_rel_valuator; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index e67a3c05a9..25f9a061b4 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -679,6 +679,7 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) TlsSetValue( thread_data_tls_index, data );
if (use_xim) X11DRV_SetupXIM(); + X11DRV_XInput2_Enable();
return data; }
Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- dlls/winex11.drv/event.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 6054f645c4..30988be028 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -762,7 +762,11 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev ) TRACE( "win %p xwin %lx detail=%s\n", hwnd, event->window, focus_details[event->detail] );
if (event->detail == NotifyPointer) return FALSE; - if (hwnd == GetDesktopWindow()) return FALSE; + if (hwnd == GetDesktopWindow()) + { + X11DRV_XInput2_Enable(); + return FALSE; + }
if ((xic = X11DRV_get_ic( hwnd ))) XSetICFocus( xic ); if (use_take_focus) @@ -800,7 +804,11 @@ static void focus_out( Display *display , HWND hwnd )
if (root_window != DefaultRootWindow(display)) { - if (hwnd == GetDesktopWindow()) reset_clipping_window(); + if (hwnd == GetDesktopWindow()) + { + reset_clipping_window(); + X11DRV_XInput2_Disable(); + } return; } if (hwnd != GetForegroundWindow()) return;
Ignore this 7th patch, it doesn't work
On Tue, Jun 25, 2019 at 11:32 PM Derek Lesho dereklesho52@gmail.com wrote:
Signed-off-by: Derek Lesho dereklesho52@Gmail.com
dlls/winex11.drv/event.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 6054f645c4..30988be028 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -762,7 +762,11 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev ) TRACE( "win %p xwin %lx detail=%s\n", hwnd, event->window, focus_details[event->detail] );
if (event->detail == NotifyPointer) return FALSE;
- if (hwnd == GetDesktopWindow()) return FALSE;
if (hwnd == GetDesktopWindow())
{
X11DRV_XInput2_Enable();
return FALSE;
}
if ((xic = X11DRV_get_ic( hwnd ))) XSetICFocus( xic ); if (use_take_focus)
@@ -800,7 +804,11 @@ static void focus_out( Display *display , HWND hwnd )
if (root_window != DefaultRootWindow(display)) {
if (hwnd == GetDesktopWindow()) reset_clipping_window();
if (hwnd == GetDesktopWindow())
{
reset_clipping_window();
X11DRV_XInput2_Disable();
} if (hwnd != GetForegroundWindow()) return;} return;
-- 2.21.0
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=54136
Your paranoid android.
=== debian9 (64 bit WoW report) ===
user32: clipboard.c:760: Test failed: 2: gle 5 clipboard.c:765: Test failed: 2.0: got 0000 instead of 000d clipboard.c:805: Test failed: 2: gle 1418 clipboard.c:815: Test failed: 2: count 4 clipboard.c:818: Test failed: 2: gle 1418 clipboard.c:853: Test failed: 2.0: formats 00000000 have been rendered clipboard.c:858: Test failed: 2.0: formats 00000000 have been rendered clipboard.c:853: Test failed: 2.2: formats 00000000 have been rendered clipboard.c:858: Test failed: 2.2: formats 00000000 have been rendered clipboard.c:853: Test failed: 2.3: formats 00000000 have been rendered clipboard.c:858: Test failed: 2.3: formats 00000000 have been rendered