You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
user32-rawinput-*: Replace with new patches from Rémi Bernon.
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
From 8016a35cf5771858b2b6245ee22e60c23a1bafd6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 17 Jan 2020 16:33:11 +0100
|
||||
Subject: [PATCH] winex11.drv: Split XInput2 thread initialization.
|
||||
|
||||
And rename the library and function loader to x11drv_xinput_load.
|
||||
---
|
||||
dlls/winex11.drv/mouse.c | 46 +++++++++++++++++++++++-----------
|
||||
dlls/winex11.drv/x11drv.h | 3 ++-
|
||||
dlls/winex11.drv/x11drv_main.c | 4 ++-
|
||||
3 files changed, 36 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index 42bac332664..ce77c7e5985 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -286,6 +286,32 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
|
||||
#endif
|
||||
|
||||
|
||||
+/***********************************************************************
|
||||
+ * x11drv_xinput_init
|
||||
+ */
|
||||
+void x11drv_xinput_init(void)
|
||||
+{
|
||||
+#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
+ struct x11drv_thread_data *data = x11drv_thread_data();
|
||||
+ int major = 2, minor = 0;
|
||||
+
|
||||
+ if (data->xi2_state != xi_unknown) return;
|
||||
+
|
||||
+ if (xinput2_available &&
|
||||
+ !pXIQueryVersion( data->display, &major, &minor ))
|
||||
+ {
|
||||
+ TRACE( "XInput2 %d.%d available\n", major, minor );
|
||||
+ data->xi2_state = xi_disabled;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ data->xi2_state = xi_unavailable;
|
||||
+ WARN( "XInput 2.0 not available\n" );
|
||||
+ }
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+
|
||||
/***********************************************************************
|
||||
* enable_xinput2
|
||||
*/
|
||||
@@ -298,19 +324,9 @@ static void enable_xinput2(void)
|
||||
unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)];
|
||||
int count;
|
||||
|
||||
- if (!xinput2_available) return;
|
||||
+ TRACE( "state:%d\n", data->xi2_state );
|
||||
+ if (data->xi2_state != xi_disabled) return;
|
||||
|
||||
- if (data->xi2_state == xi_unknown)
|
||||
- {
|
||||
- int major = 2, minor = 0;
|
||||
- if (!pXIQueryVersion( data->display, &major, &minor )) data->xi2_state = xi_disabled;
|
||||
- else
|
||||
- {
|
||||
- data->xi2_state = xi_unavailable;
|
||||
- WARN( "X Input 2 not available\n" );
|
||||
- }
|
||||
- }
|
||||
- if (data->xi2_state == xi_unavailable) return;
|
||||
if (!pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) return;
|
||||
|
||||
mask.mask = mask_bits;
|
||||
@@ -350,9 +366,9 @@ static void disable_xinput2(void)
|
||||
struct x11drv_thread_data *data = x11drv_thread_data();
|
||||
XIEventMask mask;
|
||||
|
||||
+ TRACE( "state:%d\n", data->xi2_state );
|
||||
if (data->xi2_state != xi_enabled) return;
|
||||
|
||||
- TRACE( "disabling\n" );
|
||||
data->xi2_state = xi_disabled;
|
||||
|
||||
mask.mask = NULL;
|
||||
@@ -1908,9 +1924,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
- * X11DRV_XInput2_Init
|
||||
+ * x11drv_xinput_load
|
||||
*/
|
||||
-void X11DRV_XInput2_Init(void)
|
||||
+void x11drv_xinput_load(void)
|
||||
{
|
||||
#if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H)
|
||||
int event, error;
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index 45855976607..16a8a6be2be 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -195,7 +195,8 @@ extern BOOL CDECL X11DRV_UnrealizePalette( HPALETTE hpal ) DECLSPEC_HIDDEN;
|
||||
/* X11 driver internal functions */
|
||||
|
||||
extern void X11DRV_Xcursor_Init(void) DECLSPEC_HIDDEN;
|
||||
-extern void X11DRV_XInput2_Init(void) DECLSPEC_HIDDEN;
|
||||
+extern void x11drv_xinput_load(void) DECLSPEC_HIDDEN;
|
||||
+extern void x11drv_xinput_init(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,
|
||||
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
|
||||
index 9ec4c7a98f6..43c30ab369c 100644
|
||||
--- a/dlls/winex11.drv/x11drv_main.c
|
||||
+++ b/dlls/winex11.drv/x11drv_main.c
|
||||
@@ -610,7 +610,7 @@ static BOOL process_attach(void)
|
||||
#ifdef SONAME_LIBXCOMPOSITE
|
||||
X11DRV_XComposite_Init();
|
||||
#endif
|
||||
- X11DRV_XInput2_Init();
|
||||
+ x11drv_xinput_load();
|
||||
|
||||
#ifdef HAVE_XKB
|
||||
if (use_xkb) use_xkb = XkbUseExtension( gdi_display, NULL, NULL );
|
||||
@@ -702,6 +702,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
|
||||
|
||||
if (use_xim) X11DRV_SetupXIM();
|
||||
|
||||
+ x11drv_xinput_init();
|
||||
+
|
||||
return data;
|
||||
}
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
@@ -0,0 +1,254 @@
|
||||
From a5bff960bdb07ad110189c2ea7394370ac28b512 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 23 Jan 2020 11:00:19 +0100
|
||||
Subject: [PATCH] winex11.drv: Support XInput2 events for individual windows.
|
||||
|
||||
This will allow us to listen to the XInput version of several events,
|
||||
which can bring additional information.
|
||||
---
|
||||
dlls/winex11.drv/desktop.c | 1 +
|
||||
dlls/winex11.drv/event.c | 7 +++++
|
||||
dlls/winex11.drv/mouse.c | 59 +++++++++++++++++++++++++++-----------
|
||||
dlls/winex11.drv/window.c | 3 ++
|
||||
dlls/winex11.drv/x11drv.h | 12 +++++++-
|
||||
5 files changed, 65 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c
|
||||
index b517e44e150..6f46ef505c9 100644
|
||||
--- a/dlls/winex11.drv/desktop.c
|
||||
+++ b/dlls/winex11.drv/desktop.c
|
||||
@@ -356,6 +356,7 @@ BOOL CDECL X11DRV_create_desktop( UINT width, UINT height )
|
||||
0, 0, width, height, 0, default_visual.depth, InputOutput, default_visual.visual,
|
||||
CWEventMask | CWCursor | CWColormap, &win_attr );
|
||||
if (!win) return FALSE;
|
||||
+ x11drv_xinput_enable( display, win, win_attr.event_mask );
|
||||
if (!create_desktop_win_data( win )) return FALSE;
|
||||
|
||||
X11DRV_init_desktop( win, width, height );
|
||||
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
|
||||
index 99943478729..217c1eca857 100644
|
||||
--- a/dlls/winex11.drv/event.c
|
||||
+++ b/dlls/winex11.drv/event.c
|
||||
@@ -245,6 +245,13 @@ static Bool filter_event( Display *display, XEvent *event, char *arg )
|
||||
return (mask & QS_MOUSEBUTTON) != 0;
|
||||
#ifdef GenericEvent
|
||||
case GenericEvent:
|
||||
+#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
+ if (event->xcookie.extension == xinput2_opcode &&
|
||||
+ (event->xcookie.evtype == XI_RawMotion ||
|
||||
+ event->xcookie.evtype == XI_DeviceChanged))
|
||||
+ return (mask & QS_MOUSEMOVE) != 0;
|
||||
+#endif
|
||||
+ return (mask & QS_SENDMESSAGE) != 0;
|
||||
#endif
|
||||
case MotionNotify:
|
||||
case EnterNotify:
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index ce77c7e5985..2550af3cb9c 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -313,21 +313,33 @@ void x11drv_xinput_init(void)
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
- * enable_xinput2
|
||||
+ * x11drv_xinput_enable
|
||||
*/
|
||||
-static void enable_xinput2(void)
|
||||
+void x11drv_xinput_enable( Display *display, Window window, long event_mask )
|
||||
{
|
||||
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
struct x11drv_thread_data *data = x11drv_thread_data();
|
||||
XIEventMask mask;
|
||||
XIDeviceInfo *pointer_info;
|
||||
unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)];
|
||||
+ enum xi2_state xi2_state = data ? data->xi2_state : xi_unknown;
|
||||
int count;
|
||||
|
||||
- TRACE( "state:%d\n", data->xi2_state );
|
||||
- if (data->xi2_state != xi_disabled) return;
|
||||
+ TRACE( "state:%d window:%lx event_mask:%lx\n", xi2_state, window, event_mask );
|
||||
|
||||
- if (!pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) return;
|
||||
+ if (xi2_state == xi_unavailable) return;
|
||||
+
|
||||
+ if (window != DefaultRootWindow( display ))
|
||||
+ {
|
||||
+ mask.mask = mask_bits;
|
||||
+ mask.mask_len = sizeof(mask_bits);
|
||||
+ mask.deviceid = XIAllMasterDevices;
|
||||
+ memset( mask_bits, 0, sizeof(mask_bits) );
|
||||
+
|
||||
+ pXISelectEvents( display, window, &mask, 1 );
|
||||
+ XSelectInput( display, window, event_mask );
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
mask.mask = mask_bits;
|
||||
mask.mask_len = sizeof(mask_bits);
|
||||
@@ -337,8 +349,9 @@ static void enable_xinput2(void)
|
||||
XISetMask( mask_bits, XI_RawMotion );
|
||||
XISetMask( mask_bits, XI_ButtonPress );
|
||||
|
||||
- pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 );
|
||||
+ pXISelectEvents( display, DefaultRootWindow( display ), &mask, 1 );
|
||||
|
||||
+ if (!data || !pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) return;
|
||||
pointer_info = pXIQueryDevice( data->display, data->xi2_core_pointer, &count );
|
||||
update_relative_valuators( pointer_info->classes, pointer_info->num_classes );
|
||||
pXIFreeDeviceInfo( pointer_info );
|
||||
@@ -347,7 +360,7 @@ static void enable_xinput2(void)
|
||||
* no XI_DeviceChanged events happened. If any hierarchy change occurred that
|
||||
* might be relevant here (eg. user switching mice after (un)plugging), a
|
||||
* XI_DeviceChanged event will point us to the right slave. So this list is
|
||||
- * safe to be obtained statically at enable_xinput2() time.
|
||||
+ * safe to be obtained statically at x11drv_xinput_enable() time.
|
||||
*/
|
||||
if (data->xi2_devices) pXIFreeDeviceInfo( data->xi2_devices );
|
||||
data->xi2_devices = pXIQueryDevice( data->display, XIAllDevices, &data->xi2_device_count );
|
||||
@@ -358,30 +371,44 @@ static void enable_xinput2(void)
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
- * disable_xinput2
|
||||
+ * x11drv_xinput_disable
|
||||
*/
|
||||
-static void disable_xinput2(void)
|
||||
+void x11drv_xinput_disable( Display *display, Window window, long event_mask )
|
||||
{
|
||||
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
struct x11drv_thread_data *data = x11drv_thread_data();
|
||||
+ enum xi2_state xi2_state = data ? data->xi2_state : xi_unknown;
|
||||
XIEventMask mask;
|
||||
|
||||
- TRACE( "state:%d\n", data->xi2_state );
|
||||
- if (data->xi2_state != xi_enabled) return;
|
||||
+ TRACE( "state:%d window:%lx event_mask:%lx\n", xi2_state, window, event_mask );
|
||||
|
||||
- data->xi2_state = xi_disabled;
|
||||
+ if (xi2_state == xi_unavailable) return;
|
||||
+
|
||||
+ if (window != DefaultRootWindow( display ))
|
||||
+ {
|
||||
+ mask.mask = NULL;
|
||||
+ mask.mask_len = 0;
|
||||
+ mask.deviceid = XIAllMasterDevices;
|
||||
+
|
||||
+ pXISelectEvents( display, window, &mask, 1 );
|
||||
+ XSelectInput( display, window, event_mask );
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
mask.mask = NULL;
|
||||
mask.mask_len = 0;
|
||||
mask.deviceid = XIAllDevices;
|
||||
|
||||
- pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 );
|
||||
+ pXISelectEvents( display, DefaultRootWindow( display ), &mask, 1 );
|
||||
+
|
||||
+ if (!data) return;
|
||||
pXIFreeDeviceInfo( data->xi2_devices );
|
||||
data->x_rel_valuator.number = -1;
|
||||
data->y_rel_valuator.number = -1;
|
||||
data->xi2_devices = NULL;
|
||||
data->xi2_core_pointer = 0;
|
||||
data->xi2_current_slave = 0;
|
||||
+ data->xi2_state = xi_disabled;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -423,7 +450,7 @@ static BOOL grab_clipping_window( const RECT *clip )
|
||||
}
|
||||
|
||||
/* enable XInput2 unless we are already clipping */
|
||||
- if (!data->clip_hwnd) enable_xinput2();
|
||||
+ if (!data->clip_hwnd) x11drv_xinput_enable( data->display, DefaultRootWindow( data->display ), PointerMotionMask );
|
||||
|
||||
if (data->xi2_state != xi_enabled)
|
||||
{
|
||||
@@ -453,7 +480,7 @@ static BOOL grab_clipping_window( const RECT *clip )
|
||||
|
||||
if (!clipping_cursor)
|
||||
{
|
||||
- disable_xinput2();
|
||||
+ x11drv_xinput_disable( data->display, DefaultRootWindow( data->display ), PointerMotionMask );
|
||||
DestroyWindow( msg_hwnd );
|
||||
return FALSE;
|
||||
}
|
||||
@@ -532,7 +559,7 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND prev_clip_hwnd, HWND new_clip_hwnd )
|
||||
TRACE( "clip hwnd reset from %p\n", hwnd );
|
||||
data->clip_hwnd = 0;
|
||||
data->clip_reset = GetTickCount();
|
||||
- disable_xinput2();
|
||||
+ x11drv_xinput_disable( data->display, DefaultRootWindow( data->display ), PointerMotionMask );
|
||||
DestroyWindow( hwnd );
|
||||
}
|
||||
else if (prev_clip_hwnd)
|
||||
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
|
||||
index baaa30d74e3..4005e3df387 100644
|
||||
--- a/dlls/winex11.drv/window.c
|
||||
+++ b/dlls/winex11.drv/window.c
|
||||
@@ -375,6 +375,7 @@ static void sync_window_style( struct x11drv_win_data *data )
|
||||
int mask = get_window_attributes( data, &attr );
|
||||
|
||||
XChangeWindowAttributes( data->display, data->whole_window, mask, &attr );
|
||||
+ x11drv_xinput_enable( data->display, data->whole_window, attr.event_mask );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1573,6 +1574,7 @@ static void create_whole_window( struct x11drv_win_data *data )
|
||||
data->vis.visual, mask, &attr );
|
||||
if (!data->whole_window) goto done;
|
||||
|
||||
+ x11drv_xinput_enable( data->display, data->whole_window, attr.event_mask );
|
||||
set_initial_wm_hints( data->display, data->whole_window );
|
||||
set_wm_hints( data );
|
||||
|
||||
@@ -1879,6 +1881,7 @@ BOOL CDECL X11DRV_CreateWindow( HWND hwnd )
|
||||
data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0,
|
||||
InputOnly, default_visual.visual,
|
||||
CWOverrideRedirect | CWEventMask, &attr );
|
||||
+ x11drv_xinput_enable( data->display, data->clip_window, attr.event_mask );
|
||||
XFlush( data->display );
|
||||
SetPropA( hwnd, clip_window_prop, (HANDLE)data->clip_window );
|
||||
X11DRV_InitClipboard();
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index 16a8a6be2be..7ea60fa495a 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -197,6 +197,8 @@ extern BOOL CDECL X11DRV_UnrealizePalette( HPALETTE hpal ) DECLSPEC_HIDDEN;
|
||||
extern void X11DRV_Xcursor_Init(void) DECLSPEC_HIDDEN;
|
||||
extern void x11drv_xinput_load(void) DECLSPEC_HIDDEN;
|
||||
extern void x11drv_xinput_init(void) DECLSPEC_HIDDEN;
|
||||
+extern void x11drv_xinput_enable( Display *display, Window window, long event_mask ) DECLSPEC_HIDDEN;
|
||||
+extern void x11drv_xinput_disable( Display *display, Window window, long event_mask ) 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,
|
||||
@@ -324,6 +326,14 @@ struct x11drv_valuator_data
|
||||
int number;
|
||||
};
|
||||
|
||||
+enum xi2_state
|
||||
+{
|
||||
+ xi_unavailable = -1,
|
||||
+ xi_unknown,
|
||||
+ xi_disabled,
|
||||
+ xi_enabled
|
||||
+};
|
||||
+
|
||||
struct x11drv_thread_data
|
||||
{
|
||||
Display *display;
|
||||
@@ -339,7 +349,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 xi2_state 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;
|
||||
--
|
||||
2.30.2
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 7440b3f974b66631ee71fa9acafc333e39543174 Mon Sep 17 00:00:00 2001
|
||||
From 3addef6ede746e418be37c5f288027bb0247f37c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 2 Aug 2019 02:24:32 -0400
|
||||
Subject: [PATCH] winex11.drv: Advertise XInput2 version 2.1 support.
|
||||
@@ -17,35 +17,33 @@ events from the desktop window thread, even if a mouse grab is active.
|
||||
It is now also possible to simplify the code by listening to master
|
||||
device events only and get rid of slave device id tracking.
|
||||
---
|
||||
dlls/winex11.drv/mouse.c | 49 ++++++++-------------------------------
|
||||
dlls/winex11.drv/mouse.c | 43 +++++----------------------------------
|
||||
dlls/winex11.drv/x11drv.h | 3 ---
|
||||
2 files changed, 10 insertions(+), 42 deletions(-)
|
||||
2 files changed, 5 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index aaa34d8ff0f..3a4b1198829 100644
|
||||
index 2550af3cb9c..0d41438c5c7 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -302,12 +302,16 @@ static void enable_xinput2(void)
|
||||
@@ -293,7 +293,7 @@ void x11drv_xinput_init(void)
|
||||
{
|
||||
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
struct x11drv_thread_data *data = x11drv_thread_data();
|
||||
- int major = 2, minor = 0;
|
||||
+ int major = 2, minor = 1;
|
||||
|
||||
if (data->xi2_state == xi_unknown)
|
||||
if (data->xi2_state != xi_unknown) return;
|
||||
|
||||
@@ -306,7 +306,7 @@ void x11drv_xinput_init(void)
|
||||
else
|
||||
{
|
||||
- int major = 2, minor = 0;
|
||||
- if (!pXIQueryVersion( data->display, &major, &minor )) data->xi2_state = xi_disabled;
|
||||
+ int major = 2, minor = 1;
|
||||
+ if (!pXIQueryVersion( data->display, &major, &minor ) && major == 2 && minor > 0)
|
||||
+ {
|
||||
+ TRACE( "XInput2 v%d.%d available\n", major, minor );
|
||||
+ data->xi2_state = xi_disabled;
|
||||
+ }
|
||||
else
|
||||
{
|
||||
data->xi2_state = xi_unavailable;
|
||||
- WARN( "X Input 2 not available\n" );
|
||||
+ WARN( "XInput v2.1 not available\n" );
|
||||
}
|
||||
data->xi2_state = xi_unavailable;
|
||||
- WARN( "XInput 2.0 not available\n" );
|
||||
+ WARN( "XInput 2.1 not available\n" );
|
||||
}
|
||||
if (data->xi2_state == xi_unavailable) return;
|
||||
@@ -315,7 +319,7 @@ static void enable_xinput2(void)
|
||||
#endif
|
||||
}
|
||||
@@ -343,7 +343,7 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask )
|
||||
|
||||
mask.mask = mask_bits;
|
||||
mask.mask_len = sizeof(mask_bits);
|
||||
@@ -54,7 +52,7 @@ index aaa34d8ff0f..3a4b1198829 100644
|
||||
memset( mask_bits, 0, sizeof(mask_bits) );
|
||||
XISetMask( mask_bits, XI_DeviceChanged );
|
||||
XISetMask( mask_bits, XI_RawMotion );
|
||||
@@ -327,16 +331,6 @@ static void enable_xinput2(void)
|
||||
@@ -356,16 +356,6 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask )
|
||||
update_relative_valuators( pointer_info->classes, pointer_info->num_classes );
|
||||
pXIFreeDeviceInfo( pointer_info );
|
||||
|
||||
@@ -62,7 +60,7 @@ index aaa34d8ff0f..3a4b1198829 100644
|
||||
- * no XI_DeviceChanged events happened. If any hierarchy change occurred that
|
||||
- * might be relevant here (eg. user switching mice after (un)plugging), a
|
||||
- * XI_DeviceChanged event will point us to the right slave. So this list is
|
||||
- * safe to be obtained statically at enable_xinput2() time.
|
||||
- * safe to be obtained statically at x11drv_xinput_enable() time.
|
||||
- */
|
||||
- if (data->xi2_devices) pXIFreeDeviceInfo( data->xi2_devices );
|
||||
- data->xi2_devices = pXIQueryDevice( data->display, XIAllDevices, &data->xi2_device_count );
|
||||
@@ -71,24 +69,26 @@ index aaa34d8ff0f..3a4b1198829 100644
|
||||
data->xi2_state = xi_enabled;
|
||||
#endif
|
||||
}
|
||||
@@ -357,15 +351,12 @@ static void disable_xinput2(void)
|
||||
@@ -397,17 +387,14 @@ void x11drv_xinput_disable( Display *display, Window window, long event_mask )
|
||||
|
||||
mask.mask = NULL;
|
||||
mask.mask_len = 0;
|
||||
- mask.deviceid = XIAllDevices;
|
||||
+ mask.deviceid = XIAllMasterDevices;
|
||||
|
||||
pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 );
|
||||
pXISelectEvents( display, DefaultRootWindow( display ), &mask, 1 );
|
||||
|
||||
if (!data) return;
|
||||
- pXIFreeDeviceInfo( data->xi2_devices );
|
||||
data->x_rel_valuator.number = -1;
|
||||
data->y_rel_valuator.number = -1;
|
||||
- data->xi2_devices = NULL;
|
||||
data->xi2_core_pointer = 0;
|
||||
- data->xi2_current_slave = 0;
|
||||
data->xi2_state = xi_disabled;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1799,7 +1790,6 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
|
||||
@@ -1860,7 +1847,6 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
|
||||
if (event->reason != XISlaveSwitch) return FALSE;
|
||||
|
||||
update_relative_valuators( event->classes, event->num_classes );
|
||||
@@ -96,7 +96,7 @@ index aaa34d8ff0f..3a4b1198829 100644
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1820,26 +1810,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
@@ -1881,26 +1867,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
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;
|
||||
@@ -125,13 +125,13 @@ index aaa34d8ff0f..3a4b1198829 100644
|
||||
x_rel = &thread_data->x_rel_valuator;
|
||||
y_rel = &thread_data->y_rel_valuator;
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index cfce09bf11d..8a02a6ebf94 100644
|
||||
index 7ea60fa495a..df8a53bb228 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -339,12 +339,9 @@ struct x11drv_thread_data
|
||||
@@ -350,12 +350,9 @@ struct x11drv_thread_data
|
||||
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 xi2_state 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;
|
||||
@@ -142,5 +142,5 @@ index cfce09bf11d..8a02a6ebf94 100644
|
||||
|
||||
extern struct x11drv_thread_data *x11drv_init_thread_data(void) DECLSPEC_HIDDEN;
|
||||
--
|
||||
2.27.0
|
||||
2.30.2
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From e0245cae5151eddb30eeaed3116697257ce65f22 Mon Sep 17 00:00:00 2001
|
||||
From a88aed6df65592b55fde5ecee55b090149c362bb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 19 Dec 2019 22:34:44 +0100
|
||||
Subject: [PATCH] winex11.drv: Keep track of pointer and device button
|
||||
@@ -16,10 +16,10 @@ Original patch by Andrew Eikum <aeikum@codeweavers.com>.
|
||||
4 files changed, 106 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
|
||||
index 2a3bed787ab..37c96c926f4 100644
|
||||
index 01620c5e4a4..272f728def9 100644
|
||||
--- a/dlls/winex11.drv/keyboard.c
|
||||
+++ b/dlls/winex11.drv/keyboard.c
|
||||
@@ -1977,13 +1977,24 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event )
|
||||
@@ -1976,13 +1976,24 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event )
|
||||
{
|
||||
HWND hwnd;
|
||||
|
||||
@@ -51,7 +51,7 @@ index 2a3bed787ab..37c96c926f4 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index 3a4b1198829..26e8b4eea92 100644
|
||||
index 0d41438c5c7..fc5fd29d7b6 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -25,6 +25,9 @@
|
||||
@@ -150,7 +150,7 @@ index 3a4b1198829..26e8b4eea92 100644
|
||||
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
/***********************************************************************
|
||||
* update_relative_valuators
|
||||
@@ -1790,6 +1865,8 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
|
||||
@@ -1847,6 +1922,8 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
|
||||
if (event->reason != XISlaveSwitch) return FALSE;
|
||||
|
||||
update_relative_valuators( event->classes, event->num_classes );
|
||||
@@ -159,22 +159,22 @@ index 3a4b1198829..26e8b4eea92 100644
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1859,13 +1936,12 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
@@ -1916,13 +1993,12 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
|
||||
#endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */
|
||||
|
||||
-
|
||||
/***********************************************************************
|
||||
* X11DRV_XInput2_Init
|
||||
* x11drv_xinput_load
|
||||
*/
|
||||
void X11DRV_XInput2_Init(void)
|
||||
void x11drv_xinput_load(void)
|
||||
{
|
||||
-#if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H)
|
||||
+#if defined(SONAME_LIBXI)
|
||||
int event, error;
|
||||
void *libxi_handle = dlopen( SONAME_LIBXI, RTLD_NOW );
|
||||
|
||||
@@ -1881,11 +1957,20 @@ void X11DRV_XInput2_Init(void)
|
||||
@@ -1938,11 +2014,20 @@ void x11drv_xinput_load(void)
|
||||
return; \
|
||||
}
|
||||
|
||||
@@ -196,10 +196,10 @@ index 3a4b1198829..26e8b4eea92 100644
|
||||
|
||||
xinput2_available = XQueryExtension( gdi_display, "XInputExtension", &xinput2_opcode, &event, &error );
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index 8a02a6ebf94..73b1e90f12e 100644
|
||||
index df8a53bb228..afa990b7e68 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -629,6 +629,7 @@ extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN;
|
||||
@@ -643,6 +643,7 @@ extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) DECLSPEC_HIDDEN;
|
||||
extern void move_resize_window( HWND hwnd, int dir ) DECLSPEC_HIDDEN;
|
||||
extern void X11DRV_InitKeyboard( Display *display ) DECLSPEC_HIDDEN;
|
||||
@@ -208,10 +208,10 @@ index 8a02a6ebf94..73b1e90f12e 100644
|
||||
DWORD mask, DWORD flags ) DECLSPEC_HIDDEN;
|
||||
|
||||
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
|
||||
index e6e61e801e1..20e829ba64f 100644
|
||||
index 43c30ab369c..d8576949aea 100644
|
||||
--- a/dlls/winex11.drv/x11drv_main.c
|
||||
+++ b/dlls/winex11.drv/x11drv_main.c
|
||||
@@ -615,6 +615,7 @@ static BOOL process_attach(void)
|
||||
@@ -616,6 +616,7 @@ static BOOL process_attach(void)
|
||||
if (use_xkb) use_xkb = XkbUseExtension( gdi_display, NULL, NULL );
|
||||
#endif
|
||||
X11DRV_InitKeyboard( gdi_display );
|
||||
@@ -220,5 +220,5 @@ index e6e61e801e1..20e829ba64f 100644
|
||||
|
||||
X11DRV_DisplayDevices_Init(FALSE);
|
||||
--
|
||||
2.27.0
|
||||
2.30.2
|
||||
|
@@ -0,0 +1,101 @@
|
||||
From ce3b572e3b0ac1b19e9d032039435044e51929de Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 26 Aug 2019 14:37:20 +0200
|
||||
Subject: [PATCH] server: Add send_hardware_message flags for rawinput
|
||||
translation.
|
||||
|
||||
---
|
||||
dlls/user32/message.c | 2 ++
|
||||
server/protocol.def | 1 +
|
||||
server/queue.c | 12 ++++++------
|
||||
3 files changed, 9 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
|
||||
index f986b71953a..98f6c2730e0 100644
|
||||
--- a/dlls/user32/message.c
|
||||
+++ b/dlls/user32/message.c
|
||||
@@ -3259,6 +3259,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
|
||||
req->input.mouse.flags = input->u.mi.dwFlags;
|
||||
req->input.mouse.time = input->u.mi.time;
|
||||
req->input.mouse.info = input->u.mi.dwExtraInfo;
|
||||
+ req->flags |= SEND_HWMSG_RAWINPUT;
|
||||
break;
|
||||
case INPUT_KEYBOARD:
|
||||
req->input.kbd.vkey = input->u.ki.wVk;
|
||||
@@ -3266,6 +3267,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
|
||||
req->input.kbd.flags = input->u.ki.dwFlags;
|
||||
req->input.kbd.time = input->u.ki.time;
|
||||
req->input.kbd.info = input->u.ki.dwExtraInfo;
|
||||
+ req->flags |= SEND_HWMSG_RAWINPUT;
|
||||
break;
|
||||
case INPUT_HARDWARE:
|
||||
req->input.hw.msg = input->u.hi.uMsg;
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index 829216b58c1..90379955ecd 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -2054,6 +2054,7 @@ enum message_type
|
||||
VARARG(keystate,bytes); /* global state array for all the keys */
|
||||
@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 a411d0af8d2..a928f4d7fad 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -1782,7 +1782,7 @@ done:
|
||||
|
||||
/* 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 )
|
||||
{
|
||||
const struct rawinput_device *device;
|
||||
struct hardware_msg_data *msg_data;
|
||||
@@ -1837,7 +1837,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 ((req_flags & SEND_HWMSG_RAWINPUT) && (foreground = get_foreground_thread( desktop, win )))
|
||||
{
|
||||
raw_msg.foreground = foreground;
|
||||
raw_msg.desktop = desktop;
|
||||
@@ -1896,7 +1896,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
|
||||
/* queue a hardware message for a keyboard event */
|
||||
static int queue_keyboard_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 hw_msg_source source = { IMDT_KEYBOARD, origin };
|
||||
const struct rawinput_device *device;
|
||||
@@ -1974,7 +1974,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
break;
|
||||
}
|
||||
|
||||
- if ((foreground = get_foreground_thread( desktop, win )))
|
||||
+ if ((req_flags & SEND_HWMSG_RAWINPUT) && (foreground = get_foreground_thread( desktop, win )))
|
||||
{
|
||||
raw_msg.foreground = foreground;
|
||||
raw_msg.desktop = desktop;
|
||||
@@ -2603,11 +2603,11 @@ DECL_HANDLER(send_hardware_message)
|
||||
{
|
||||
case INPUT_MOUSE:
|
||||
if (!desktop) return;
|
||||
- reply->wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender );
|
||||
+ reply->wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender, req->flags );
|
||||
break;
|
||||
case INPUT_KEYBOARD:
|
||||
if (!desktop) return;
|
||||
- reply->wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender );
|
||||
+ reply->wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender, req->flags );
|
||||
break;
|
||||
case INPUT_HARDWARE:
|
||||
if (!desktop) set_error( STATUS_SUCCESS );
|
||||
--
|
||||
2.30.2
|
||||
|
@@ -1,128 +0,0 @@
|
||||
From 7a3a5195d932de5bc6291458f15fa5400c9777f0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 26 Aug 2019 14:37:20 +0200
|
||||
Subject: [PATCH] server: Add send_hardware_message flags for rawinput
|
||||
translation.
|
||||
|
||||
---
|
||||
dlls/user32/input.c | 6 +++---
|
||||
server/protocol.def | 2 ++
|
||||
server/queue.c | 20 ++++++++++++++------
|
||||
3 files changed, 19 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
|
||||
index 1dd43a36a11..f0b95c7fc6c 100644
|
||||
--- a/dlls/user32/input.c
|
||||
+++ b/dlls/user32/input.c
|
||||
@@ -125,7 +125,7 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
|
||||
*/
|
||||
BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input )
|
||||
{
|
||||
- NTSTATUS status = send_hardware_message( hwnd, input, 0 );
|
||||
+ NTSTATUS status = send_hardware_message( hwnd, input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||
return !status;
|
||||
}
|
||||
@@ -193,9 +193,9 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
|
||||
/* we need to update the coordinates to what the server expects */
|
||||
INPUT input = inputs[i];
|
||||
update_mouse_coords( &input );
|
||||
- status = send_hardware_message( 0, &input, SEND_HWMSG_INJECTED );
|
||||
+ status = send_hardware_message( 0, &input, SEND_HWMSG_INJECTED|SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
}
|
||||
- else status = send_hardware_message( 0, &inputs[i], SEND_HWMSG_INJECTED );
|
||||
+ else status = send_hardware_message( 0, &inputs[i], SEND_HWMSG_INJECTED|SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
|
||||
if (status)
|
||||
{
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index 56fda14932d..21de849e5d8 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -2339,6 +2339,8 @@ enum message_type
|
||||
VARARG(keystate,bytes); /* global state array for all the keys */
|
||||
@END
|
||||
#define SEND_HWMSG_INJECTED 0x01
|
||||
+#define SEND_HWMSG_RAWINPUT 0x02
|
||||
+#define SEND_HWMSG_WINDOW 0x04
|
||||
|
||||
|
||||
/* Get a message from the current queue */
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index ff9e703d1ff..46ace52f004 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -1695,7 +1695,7 @@ done:
|
||||
|
||||
/* 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 )
|
||||
{
|
||||
const struct rawinput_device *device;
|
||||
struct hardware_msg_data *msg_data;
|
||||
@@ -1765,7 +1765,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
msg_data->rawinput.mouse.y = y - desktop->cursor.y;
|
||||
msg_data->rawinput.mouse.data = input->mouse.data;
|
||||
|
||||
- enum_processes( queue_rawinput_message, &raw_msg );
|
||||
+ if ((req_flags & SEND_HWMSG_RAWINPUT))
|
||||
+ enum_processes( queue_rawinput_message, &raw_msg );
|
||||
release_object( foreground );
|
||||
}
|
||||
|
||||
@@ -1775,6 +1776,9 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ if (!(req_flags & SEND_HWMSG_WINDOW))
|
||||
+ return 0;
|
||||
+
|
||||
for (i = 0; i < ARRAY_SIZE( messages ); i++)
|
||||
{
|
||||
if (!messages[i]) continue;
|
||||
@@ -1806,7 +1810,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
|
||||
/* queue a hardware message for a keyboard event */
|
||||
static int queue_keyboard_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 hw_msg_source source = { IMDT_KEYBOARD, origin };
|
||||
const struct rawinput_device *device;
|
||||
@@ -1899,7 +1903,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
msg_data->rawinput.kbd.vkey = vkey;
|
||||
msg_data->rawinput.kbd.scan = input->kbd.scan;
|
||||
|
||||
- enum_processes( queue_rawinput_message, &raw_msg );
|
||||
+ if ((req_flags & SEND_HWMSG_RAWINPUT))
|
||||
+ enum_processes( queue_rawinput_message, &raw_msg );
|
||||
release_object( foreground );
|
||||
}
|
||||
|
||||
@@ -1909,6 +1914,9 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ if (!(req_flags & SEND_HWMSG_WINDOW))
|
||||
+ return 0;
|
||||
+
|
||||
if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
|
||||
msg_data = msg->data;
|
||||
|
||||
@@ -2465,10 +2473,10 @@ DECL_HANDLER(send_hardware_message)
|
||||
switch (req->input.type)
|
||||
{
|
||||
case INPUT_MOUSE:
|
||||
- reply->wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender );
|
||||
+ reply->wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender, req->flags );
|
||||
break;
|
||||
case INPUT_KEYBOARD:
|
||||
- reply->wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender );
|
||||
+ reply->wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender, req->flags );
|
||||
break;
|
||||
case INPUT_HARDWARE:
|
||||
queue_custom_hardware_message( desktop, req->win, origin, &req->input );
|
||||
--
|
||||
2.27.0
|
||||
|
@@ -0,0 +1,278 @@
|
||||
From acd309726a5ca6ac94a7ea13c92382ae637e21ab Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Wed, 24 Mar 2021 23:29:28 +0100
|
||||
Subject: [PATCH] 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.
|
||||
---
|
||||
dlls/user32/input.c | 3 ++-
|
||||
dlls/user32/message.c | 4 ++--
|
||||
dlls/wineandroid.drv/keyboard.c | 3 ++-
|
||||
dlls/wineandroid.drv/window.c | 5 +++--
|
||||
dlls/winemac.drv/ime.c | 6 ++++--
|
||||
dlls/winemac.drv/keyboard.c | 3 ++-
|
||||
dlls/winemac.drv/mouse.c | 3 ++-
|
||||
dlls/winex11.drv/keyboard.c | 3 ++-
|
||||
dlls/winex11.drv/mouse.c | 11 +++++++----
|
||||
9 files changed, 26 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
|
||||
index 3fc818a2510..af1ad797102 100644
|
||||
--- a/dlls/user32/input.c
|
||||
+++ b/dlls/user32/input.c
|
||||
@@ -181,6 +181,7 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
|
||||
{
|
||||
UINT i;
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
+ RAWINPUT rawinput;
|
||||
|
||||
if (size != sizeof(INPUT))
|
||||
{
|
||||
@@ -210,7 +211,7 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
|
||||
update_mouse_coords( &input );
|
||||
/* fallthrough */
|
||||
case INPUT_KEYBOARD:
|
||||
- status = send_hardware_message( 0, &input, NULL, SEND_HWMSG_INJECTED );
|
||||
+ status = send_hardware_message( 0, &input, &rawinput, SEND_HWMSG_INJECTED );
|
||||
break;
|
||||
#ifdef _WIN64
|
||||
case INPUT_HARDWARE:
|
||||
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
|
||||
index 98f6c2730e0..43c6adad033 100644
|
||||
--- a/dlls/user32/message.c
|
||||
+++ b/dlls/user32/message.c
|
||||
@@ -3259,7 +3259,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
|
||||
req->input.mouse.flags = input->u.mi.dwFlags;
|
||||
req->input.mouse.time = input->u.mi.time;
|
||||
req->input.mouse.info = input->u.mi.dwExtraInfo;
|
||||
- req->flags |= SEND_HWMSG_RAWINPUT;
|
||||
+ if (rawinput) req->flags |= SEND_HWMSG_RAWINPUT;
|
||||
break;
|
||||
case INPUT_KEYBOARD:
|
||||
req->input.kbd.vkey = input->u.ki.wVk;
|
||||
@@ -3267,7 +3267,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
|
||||
req->input.kbd.flags = input->u.ki.dwFlags;
|
||||
req->input.kbd.time = input->u.ki.time;
|
||||
req->input.kbd.info = input->u.ki.dwExtraInfo;
|
||||
- req->flags |= SEND_HWMSG_RAWINPUT;
|
||||
+ if (rawinput) req->flags |= SEND_HWMSG_RAWINPUT;
|
||||
break;
|
||||
case INPUT_HARDWARE:
|
||||
req->input.hw.msg = input->u.hi.uMsg;
|
||||
diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c
|
||||
index 0a6ede0ec5f..df85188fbbb 100644
|
||||
--- a/dlls/wineandroid.drv/keyboard.c
|
||||
+++ b/dlls/wineandroid.drv/keyboard.c
|
||||
@@ -671,6 +671,7 @@ static BOOL get_async_key_state( BYTE state[256] )
|
||||
|
||||
static void send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags )
|
||||
{
|
||||
+ RAWINPUT rawinput;
|
||||
INPUT input;
|
||||
|
||||
input.type = INPUT_KEYBOARD;
|
||||
@@ -680,7 +681,7 @@ static void send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags )
|
||||
input.u.ki.time = 0;
|
||||
input.u.ki.dwExtraInfo = 0;
|
||||
|
||||
- __wine_send_input( hwnd, &input, NULL );
|
||||
+ __wine_send_input( hwnd, &input, &rawinput );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
|
||||
index 1cb1bbbadc9..92a1c5012a0 100644
|
||||
--- a/dlls/wineandroid.drv/window.c
|
||||
+++ b/dlls/wineandroid.drv/window.c
|
||||
@@ -428,6 +428,7 @@ static int process_events( DWORD mask )
|
||||
DPI_AWARENESS_CONTEXT context;
|
||||
struct java_event *event, *next, *previous;
|
||||
unsigned int count = 0;
|
||||
+ RAWINPUT rawinput;
|
||||
|
||||
assert( GetCurrentThreadId() == desktop_tid );
|
||||
|
||||
@@ -521,7 +522,7 @@ static int process_events( DWORD mask )
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -535,7 +536,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.wScan );
|
||||
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;
|
||||
|
||||
default:
|
||||
diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c
|
||||
index f2368c10743..89f6d9c617d 100644
|
||||
--- a/dlls/winemac.drv/ime.c
|
||||
+++ b/dlls/winemac.drv/ime.c
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "winuser.h"
|
||||
#include "imm.h"
|
||||
#include "ddk/imm.h"
|
||||
+#include "wine/server.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(imm);
|
||||
|
||||
@@ -1415,6 +1416,7 @@ void macdrv_im_set_text(const macdrv_event *event)
|
||||
event->im_set_text.cursor_pos, !event->im_set_text.complete);
|
||||
else
|
||||
{
|
||||
+ RAWINPUT rawinput;
|
||||
INPUT input;
|
||||
CFIndex i;
|
||||
|
||||
@@ -1427,10 +1429,10 @@ void macdrv_im_set_text(const macdrv_event *event)
|
||||
{
|
||||
input.ki.wScan = chars[i];
|
||||
input.ki.dwFlags = KEYEVENTF_UNICODE;
|
||||
- __wine_send_input(hwnd, &input, NULL);
|
||||
+ __wine_send_input(hwnd, &input, &rawinput);
|
||||
|
||||
input.ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP;
|
||||
- __wine_send_input(hwnd, &input, NULL);
|
||||
+ __wine_send_input(hwnd, &input, &rawinput);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c
|
||||
index 1ea15f59341..b4d50058d4e 100644
|
||||
--- a/dlls/winemac.drv/keyboard.c
|
||||
+++ b/dlls/winemac.drv/keyboard.c
|
||||
@@ -918,6 +918,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)
|
||||
{
|
||||
+ RAWINPUT rawinput;
|
||||
INPUT input;
|
||||
|
||||
TRACE_(key)("hwnd %p vkey=%04x scan=%04x flags=%04x\n", hwnd, vkey, scan, flags);
|
||||
@@ -929,7 +930,7 @@ static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, DWORD fl
|
||||
input.ki.time = time;
|
||||
input.ki.dwExtraInfo = 0;
|
||||
|
||||
- __wine_send_input(hwnd, &input, NULL);
|
||||
+ __wine_send_input(hwnd, &input, &rawinput);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c
|
||||
index d2278ae0e4c..d6598617456 100644
|
||||
--- a/dlls/winemac.drv/mouse.c
|
||||
+++ b/dlls/winemac.drv/mouse.c
|
||||
@@ -136,6 +136,7 @@ static const CFStringRef cocoa_cursor_names[] =
|
||||
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)
|
||||
{
|
||||
+ RAWINPUT rawinput;
|
||||
INPUT input;
|
||||
HWND top_level_hwnd;
|
||||
|
||||
@@ -165,7 +166,7 @@ static void send_mouse_input(HWND hwnd, macdrv_window cocoa_window, UINT flags,
|
||||
input.mi.time = time;
|
||||
input.mi.dwExtraInfo = 0;
|
||||
|
||||
- __wine_send_input(top_level_hwnd, &input, NULL);
|
||||
+ __wine_send_input(top_level_hwnd, &input, &rawinput);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
|
||||
index 272f728def9..2e87eeede99 100644
|
||||
--- a/dlls/winex11.drv/keyboard.c
|
||||
+++ b/dlls/winex11.drv/keyboard.c
|
||||
@@ -1137,6 +1137,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 )
|
||||
{
|
||||
+ RAWINPUT rawinput;
|
||||
INPUT input;
|
||||
|
||||
TRACE_(key)( "hwnd %p vkey=%04x scan=%04x flags=%04x\n", hwnd, vkey, scan, flags );
|
||||
@@ -1148,7 +1149,7 @@ static void X11DRV_send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD f
|
||||
input.u.ki.time = time;
|
||||
input.u.ki.dwExtraInfo = 0;
|
||||
|
||||
- __wine_send_input( hwnd, &input, NULL );
|
||||
+ __wine_send_input( hwnd, &input, &rawinput );
|
||||
}
|
||||
|
||||
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index fc5fd29d7b6..6b6512521f4 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -748,6 +748,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 )
|
||||
{
|
||||
struct x11drv_win_data *data;
|
||||
+ RAWINPUT rawinput;
|
||||
|
||||
input->type = INPUT_MOUSE;
|
||||
|
||||
@@ -764,7 +765,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
sync_window_cursor( window );
|
||||
last_cursor_change = input->u.mi.time;
|
||||
}
|
||||
- __wine_send_input( hwnd, input, NULL );
|
||||
+ __wine_send_input( hwnd, input, &rawinput );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -804,7 +805,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
SERVER_END_REQ;
|
||||
}
|
||||
|
||||
- __wine_send_input( hwnd, input, NULL );
|
||||
+ __wine_send_input( hwnd, input, &rawinput );
|
||||
}
|
||||
|
||||
#ifdef SONAME_LIBXCURSOR
|
||||
@@ -1759,6 +1760,7 @@ void move_resize_window( HWND hwnd, int dir )
|
||||
{
|
||||
MSG msg;
|
||||
INPUT input;
|
||||
+ RAWINPUT rawinput;
|
||||
int x, y, rootX, rootY;
|
||||
|
||||
if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break;
|
||||
@@ -1774,7 +1776,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.time = GetTickCount();
|
||||
input.u.mi.dwExtraInfo = 0;
|
||||
- __wine_send_input( hwnd, &input, NULL );
|
||||
+ __wine_send_input( hwnd, &input, &rawinput );
|
||||
}
|
||||
|
||||
while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
|
||||
@@ -1935,6 +1937,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
XIRawEvent *event = xev->data;
|
||||
const double *values = event->valuators.values;
|
||||
RECT virtual_rect;
|
||||
+ RAWINPUT rawinput;
|
||||
INPUT input;
|
||||
int i;
|
||||
double dx = 0, dy = 0, val;
|
||||
@@ -1987,7 +1990,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
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, NULL );
|
||||
+ __wine_send_input( 0, &input, &rawinput );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
@@ -1,201 +0,0 @@
|
||||
From c74a22af02a816e81bf84b2f80fcd05582e01187 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 26 Aug 2019 15:20:32 +0200
|
||||
Subject: [PATCH] user32: Add __wine_send_input flags to hint raw input
|
||||
translation.
|
||||
|
||||
---
|
||||
dlls/user32/input.c | 4 ++--
|
||||
dlls/user32/user32.spec | 2 +-
|
||||
dlls/wineandroid.drv/keyboard.c | 2 +-
|
||||
dlls/wineandroid.drv/window.c | 4 ++--
|
||||
dlls/winemac.drv/ime.c | 5 +++--
|
||||
dlls/winemac.drv/keyboard.c | 2 +-
|
||||
dlls/winemac.drv/mouse.c | 2 +-
|
||||
dlls/winex11.drv/keyboard.c | 2 +-
|
||||
dlls/winex11.drv/mouse.c | 8 ++++----
|
||||
include/winuser.h | 2 +-
|
||||
10 files changed, 17 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
|
||||
index f0b95c7fc6c..150b7de9704 100644
|
||||
--- a/dlls/user32/input.c
|
||||
+++ b/dlls/user32/input.c
|
||||
@@ -123,9 +123,9 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
|
||||
*
|
||||
* Internal SendInput function to allow the graphics driver to inject real events.
|
||||
*/
|
||||
-BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input )
|
||||
+BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, UINT flags )
|
||||
{
|
||||
- NTSTATUS status = send_hardware_message( hwnd, input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
+ NTSTATUS status = send_hardware_message( hwnd, input, flags );
|
||||
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||
return !status;
|
||||
}
|
||||
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
|
||||
index d2a14879714..6ffc7d44096 100644
|
||||
--- a/dlls/user32/user32.spec
|
||||
+++ b/dlls/user32/user32.spec
|
||||
@@ -833,5 +833,5 @@
|
||||
# All functions must be prefixed with '__wine_' (for internal functions)
|
||||
# or 'wine_' (for user-visible functions) to avoid namespace conflicts.
|
||||
#
|
||||
-@ cdecl __wine_send_input(long ptr)
|
||||
+@ cdecl __wine_send_input(long ptr long)
|
||||
@ cdecl __wine_set_pixel_format(long long)
|
||||
diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c
|
||||
index a0f3257f74b..1af8a98f1f9 100644
|
||||
--- a/dlls/wineandroid.drv/keyboard.c
|
||||
+++ b/dlls/wineandroid.drv/keyboard.c
|
||||
@@ -680,7 +680,7 @@ static void send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD flags )
|
||||
input.u.ki.time = 0;
|
||||
input.u.ki.dwExtraInfo = 0;
|
||||
|
||||
- __wine_send_input( hwnd, &input );
|
||||
+ __wine_send_input( hwnd, &input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
|
||||
index eb05aaf2832..c1e7b000a8f 100644
|
||||
--- a/dlls/wineandroid.drv/window.c
|
||||
+++ b/dlls/wineandroid.drv/window.c
|
||||
@@ -521,7 +521,7 @@ static int process_events( DWORD mask )
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
}
|
||||
- __wine_send_input( capture ? capture : event->data.motion.hwnd, &event->data.motion.input );
|
||||
+ __wine_send_input( capture ? capture : event->data.motion.hwnd, &event->data.motion.input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -535,7 +535,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.wScan );
|
||||
update_keyboard_lock_state( event->data.kbd.input.u.ki.wVk, event->data.kbd.lock_state );
|
||||
- __wine_send_input( 0, &event->data.kbd.input );
|
||||
+ __wine_send_input( 0, &event->data.kbd.input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
break;
|
||||
|
||||
default:
|
||||
diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c
|
||||
index dabe6654f98..3593374a613 100644
|
||||
--- a/dlls/winemac.drv/ime.c
|
||||
+++ b/dlls/winemac.drv/ime.c
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "winuser.h"
|
||||
#include "imm.h"
|
||||
#include "ddk/imm.h"
|
||||
+#include "wine/server.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(imm);
|
||||
|
||||
@@ -1427,10 +1428,10 @@ void macdrv_im_set_text(const macdrv_event *event)
|
||||
{
|
||||
input.ki.wScan = chars[i];
|
||||
input.ki.dwFlags = KEYEVENTF_UNICODE;
|
||||
- __wine_send_input(hwnd, &input);
|
||||
+ __wine_send_input(hwnd, &input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW);
|
||||
|
||||
input.ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP;
|
||||
- __wine_send_input(hwnd, &input);
|
||||
+ __wine_send_input(hwnd, &input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c
|
||||
index bb408cb20c5..41919baafc7 100644
|
||||
--- a/dlls/winemac.drv/keyboard.c
|
||||
+++ b/dlls/winemac.drv/keyboard.c
|
||||
@@ -929,7 +929,7 @@ static void macdrv_send_keyboard_input(HWND hwnd, WORD vkey, WORD scan, DWORD fl
|
||||
input.ki.time = time;
|
||||
input.ki.dwExtraInfo = 0;
|
||||
|
||||
- __wine_send_input(hwnd, &input);
|
||||
+ __wine_send_input(hwnd, &input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c
|
||||
index dd6443fe1ba..91cafdf1362 100644
|
||||
--- a/dlls/winemac.drv/mouse.c
|
||||
+++ b/dlls/winemac.drv/mouse.c
|
||||
@@ -165,7 +165,7 @@ static void send_mouse_input(HWND hwnd, macdrv_window cocoa_window, UINT flags,
|
||||
input.mi.time = time;
|
||||
input.mi.dwExtraInfo = 0;
|
||||
|
||||
- __wine_send_input(top_level_hwnd, &input);
|
||||
+ __wine_send_input(top_level_hwnd, &input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
|
||||
index 48da12c0292..2a3bed787ab 100644
|
||||
--- a/dlls/winex11.drv/keyboard.c
|
||||
+++ b/dlls/winex11.drv/keyboard.c
|
||||
@@ -1148,7 +1148,7 @@ static void X11DRV_send_keyboard_input( HWND hwnd, WORD vkey, WORD scan, DWORD f
|
||||
input.u.ki.time = time;
|
||||
input.u.ki.dwExtraInfo = 0;
|
||||
|
||||
- __wine_send_input( hwnd, &input );
|
||||
+ __wine_send_input( hwnd, &input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
}
|
||||
|
||||
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index 7f11ba86e49..aaa34d8ff0f 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -657,7 +657,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
}
|
||||
input->u.mi.dx += clip_rect.left;
|
||||
input->u.mi.dy += clip_rect.top;
|
||||
- __wine_send_input( hwnd, input );
|
||||
+ __wine_send_input( hwnd, input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -697,7 +697,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
SERVER_END_REQ;
|
||||
}
|
||||
|
||||
- __wine_send_input( hwnd, input );
|
||||
+ __wine_send_input( hwnd, input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
}
|
||||
|
||||
#ifdef SONAME_LIBXCURSOR
|
||||
@@ -1643,7 +1643,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.time = GetTickCount();
|
||||
input.u.mi.dwExtraInfo = 0;
|
||||
- __wine_send_input( hwnd, &input );
|
||||
+ __wine_send_input( hwnd, &input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
}
|
||||
|
||||
while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
|
||||
@@ -1882,7 +1882,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
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 );
|
||||
+ __wine_send_input( 0, &input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
diff --git a/include/winuser.h b/include/winuser.h
|
||||
index 311b1481be4..4bc18a63e31 100644
|
||||
--- a/include/winuser.h
|
||||
+++ b/include/winuser.h
|
||||
@@ -4406,7 +4406,7 @@ static inline BOOL WINAPI SetRectEmpty(LPRECT rect)
|
||||
WORD WINAPI SYSTEM_KillSystemTimer( WORD );
|
||||
|
||||
#ifdef __WINESRC__
|
||||
-WINUSERAPI BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input );
|
||||
+WINUSERAPI BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input, UINT flags );
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
--
|
||||
2.27.0
|
||||
|
@@ -0,0 +1,54 @@
|
||||
From ba34a1671d177a18391e3bf8619cea68eead6e34 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 25 Mar 2021 14:26:35 +0100
|
||||
Subject: [PATCH] user32: Support sending RIM_TYPEMOUSE through
|
||||
__wine_send_input.
|
||||
|
||||
---
|
||||
dlls/user32/message.c | 6 ++++++
|
||||
server/queue.c | 5 ++++-
|
||||
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
|
||||
index 43c6adad033..d62da5de16f 100644
|
||||
--- a/dlls/user32/message.c
|
||||
+++ b/dlls/user32/message.c
|
||||
@@ -3279,6 +3279,12 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
|
||||
req->input.hw.data.rawinput.type = rawinput->header.dwType;
|
||||
switch (rawinput->header.dwType)
|
||||
{
|
||||
+ case RIM_TYPEMOUSE:
|
||||
+ req->input.hw.data.rawinput.mouse.x = rawinput->data.mouse.lLastX;
|
||||
+ req->input.hw.data.rawinput.mouse.y = rawinput->data.mouse.lLastY;
|
||||
+ req->input.hw.data.rawinput.mouse.data = rawinput->data.mouse.u.ulButtons;
|
||||
+ req->input.hw.lparam = rawinput->data.mouse.ulRawButtons;
|
||||
+ break;
|
||||
case RIM_TYPEHID:
|
||||
assert( rawinput->data.hid.dwCount <= 1 );
|
||||
req->input.hw.data.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice );
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index a928f4d7fad..9008f8e90ff 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -2054,7 +2054,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
raw_msg.extra = NULL;
|
||||
raw_msg.extra_len = 0;
|
||||
|
||||
- if (input->hw.msg == WM_INPUT)
|
||||
+ if (input->hw.msg == WM_INPUT && input->hw.data.rawinput.type == RIM_TYPEHID)
|
||||
{
|
||||
raw_msg.extra = get_req_data();
|
||||
raw_msg.extra_len = get_req_data_size();
|
||||
@@ -2065,6 +2065,9 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
|
||||
msg_data->flags = 0;
|
||||
msg_data->rawinput = input->hw.data.rawinput;
|
||||
|
||||
+ if (input->hw.msg == WM_INPUT && input->hw.data.rawinput.type == RIM_TYPEMOUSE)
|
||||
+ msg_data->flags = input->hw.lparam;
|
||||
+
|
||||
if (input->hw.msg == WM_INPUT_DEVICE_CHANGE &&
|
||||
input->hw.data.rawinput.type == RIM_TYPEHID &&
|
||||
input->hw.data.rawinput.hid.param == GIDC_ARRIVAL)
|
||||
--
|
||||
2.30.2
|
||||
|
@@ -0,0 +1,244 @@
|
||||
From a385e325b7fda81327d4e4d41363d20e98b3171f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 25 Mar 2021 16:12:58 +0100
|
||||
Subject: [PATCH] winex11.drv: Listen to RawMotion and RawButton* events in the
|
||||
desktop thread.
|
||||
|
||||
We still need to send "normal" input from the clipping window thread
|
||||
to trigger low-level hooks callbacks when clipping cursor. This is for
|
||||
instance used in our dinput implementation.
|
||||
---
|
||||
dlls/winex11.drv/event.c | 10 +++-
|
||||
dlls/winex11.drv/mouse.c | 107 ++++++++++++++++++++++++++++++++++----
|
||||
dlls/winex11.drv/x11drv.h | 1 +
|
||||
3 files changed, 107 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
|
||||
index 217c1eca857..8685ce9536b 100644
|
||||
--- a/dlls/winex11.drv/event.c
|
||||
+++ b/dlls/winex11.drv/event.c
|
||||
@@ -328,6 +328,10 @@ static enum event_merge_action merge_raw_motion_events( XIRawEvent *prev, XIRawE
|
||||
*/
|
||||
static enum event_merge_action merge_events( XEvent *prev, XEvent *next )
|
||||
{
|
||||
+#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
+ struct x11drv_thread_data *thread_data = x11drv_thread_data();
|
||||
+#endif
|
||||
+
|
||||
switch (prev->type)
|
||||
{
|
||||
case ConfigureNotify:
|
||||
@@ -359,19 +363,21 @@ static enum event_merge_action merge_events( XEvent *prev, XEvent *next )
|
||||
case GenericEvent:
|
||||
if (next->xcookie.extension != xinput2_opcode) break;
|
||||
if (next->xcookie.evtype != XI_RawMotion) break;
|
||||
- if (x11drv_thread_data()->warp_serial) break;
|
||||
+ if (thread_data->xi2_rawinput_only) break;
|
||||
+ if (thread_data->warp_serial) break;
|
||||
return MERGE_KEEP;
|
||||
}
|
||||
break;
|
||||
case GenericEvent:
|
||||
if (prev->xcookie.extension != xinput2_opcode) break;
|
||||
if (prev->xcookie.evtype != XI_RawMotion) break;
|
||||
+ if (thread_data->xi2_rawinput_only) break;
|
||||
switch (next->type)
|
||||
{
|
||||
case GenericEvent:
|
||||
if (next->xcookie.extension != xinput2_opcode) break;
|
||||
if (next->xcookie.evtype != XI_RawMotion) break;
|
||||
- if (x11drv_thread_data()->warp_serial) break;
|
||||
+ if (thread_data->warp_serial) break;
|
||||
return merge_raw_motion_events( prev->xcookie.data, next->xcookie.data );
|
||||
#endif
|
||||
}
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index 6b6512521f4..0558467a805 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -422,7 +422,18 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask )
|
||||
memset( mask_bits, 0, sizeof(mask_bits) );
|
||||
XISetMask( mask_bits, XI_DeviceChanged );
|
||||
XISetMask( mask_bits, XI_RawMotion );
|
||||
- XISetMask( mask_bits, XI_ButtonPress );
|
||||
+
|
||||
+ if (GetWindowThreadProcessId( GetDesktopWindow(), NULL ) == GetCurrentThreadId())
|
||||
+ {
|
||||
+ XISetMask( mask_bits, XI_RawButtonPress );
|
||||
+ XISetMask( mask_bits, XI_RawButtonRelease );
|
||||
+ data->xi2_rawinput_only = TRUE;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ XISetMask( mask_bits, XI_ButtonPress );
|
||||
+ data->xi2_rawinput_only = FALSE;
|
||||
+ }
|
||||
|
||||
pXISelectEvents( display, DefaultRootWindow( display ), &mask, 1 );
|
||||
|
||||
@@ -748,7 +759,6 @@ 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 )
|
||||
{
|
||||
struct x11drv_win_data *data;
|
||||
- RAWINPUT rawinput;
|
||||
|
||||
input->type = INPUT_MOUSE;
|
||||
|
||||
@@ -765,7 +775,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
sync_window_cursor( window );
|
||||
last_cursor_change = input->u.mi.time;
|
||||
}
|
||||
- __wine_send_input( hwnd, input, &rawinput );
|
||||
+ __wine_send_input( hwnd, input, NULL );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -805,7 +815,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
SERVER_END_REQ;
|
||||
}
|
||||
|
||||
- __wine_send_input( hwnd, input, &rawinput );
|
||||
+ __wine_send_input( hwnd, input, NULL );
|
||||
}
|
||||
|
||||
#ifdef SONAME_LIBXCURSOR
|
||||
@@ -1760,7 +1770,6 @@ void move_resize_window( HWND hwnd, int dir )
|
||||
{
|
||||
MSG msg;
|
||||
INPUT input;
|
||||
- RAWINPUT rawinput;
|
||||
int x, y, rootX, rootY;
|
||||
|
||||
if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break;
|
||||
@@ -1776,7 +1785,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.time = GetTickCount();
|
||||
input.u.mi.dwExtraInfo = 0;
|
||||
- __wine_send_input( hwnd, &input, &rawinput );
|
||||
+ __wine_send_input( hwnd, &input, NULL );
|
||||
}
|
||||
|
||||
while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
|
||||
@@ -1952,6 +1961,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
x_rel = &thread_data->x_rel_valuator;
|
||||
y_rel = &thread_data->y_rel_valuator;
|
||||
|
||||
+ input.type = INPUT_MOUSE;
|
||||
input.u.mi.mouseData = 0;
|
||||
input.u.mi.dwFlags = MOUSEEVENTF_MOVE;
|
||||
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
|
||||
@@ -1987,10 +1997,85 @@ 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 );
|
||||
+ if (!thread_data->xi2_rawinput_only)
|
||||
+ {
|
||||
+ TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
|
||||
+ __wine_send_input( 0, &input, NULL );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ TRACE( "raw 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, &rawinput );
|
||||
+ rawinput.header.dwType = RIM_TYPEMOUSE;
|
||||
+ rawinput.header.dwSize = offsetof(RAWINPUT, data) + sizeof(RAWMOUSE);
|
||||
+ rawinput.header.hDevice = ULongToHandle(1); /* WINE_MOUSE_HANDLE */
|
||||
+ rawinput.header.wParam = RIM_INPUT;
|
||||
+ rawinput.data.mouse.ulRawButtons = input.u.mi.dwFlags;
|
||||
+ rawinput.data.mouse.u.ulButtons = input.u.mi.mouseData;
|
||||
+ rawinput.data.mouse.lLastX = input.u.mi.dx;
|
||||
+ rawinput.data.mouse.lLastY = input.u.mi.dy;
|
||||
+ rawinput.data.mouse.ulExtraInformation = 0;
|
||||
+
|
||||
+ input.type = INPUT_HARDWARE;
|
||||
+ input.u.hi.uMsg = WM_INPUT;
|
||||
+ input.u.hi.wParamH = (WORD)(rawinput.header.dwSize >> 16);
|
||||
+ input.u.hi.wParamL = (WORD)(rawinput.header.dwSize >> 0);
|
||||
+ if (rawinput.data.mouse.lLastX || rawinput.data.mouse.lLastY)
|
||||
+ __wine_send_input( 0, &input, &rawinput );
|
||||
+ }
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+/***********************************************************************
|
||||
+ * X11DRV_RawButtonEvent
|
||||
+ */
|
||||
+static BOOL X11DRV_RawButtonEvent( XGenericEventCookie *cookie )
|
||||
+{
|
||||
+ struct x11drv_thread_data *thread_data = x11drv_thread_data();
|
||||
+ XIRawEvent *event = cookie->data;
|
||||
+ int button = event->detail - 1;
|
||||
+ RAWINPUT rawinput;
|
||||
+ INPUT input;
|
||||
+
|
||||
+ if (!device_mapping || device_mapping->deviceid != event->sourceid)
|
||||
+ update_device_mapping( event->display, event->sourceid );
|
||||
+
|
||||
+ if (button >= 0 && device_mapping)
|
||||
+ button = device_mapping->buttons[button] - 1;
|
||||
+
|
||||
+ if (button >= 0 && pointer_mapping)
|
||||
+ button = pointer_mapping->buttons[button] - 1;
|
||||
+
|
||||
+ if (button < 0 || button >= NB_BUTTONS) return FALSE;
|
||||
+ if (thread_data->xi2_state != xi_enabled) return FALSE;
|
||||
+ if (event->deviceid != thread_data->xi2_core_pointer) return FALSE;
|
||||
+
|
||||
+ TRACE( "raw button %u (raw: %u) %s\n", button, event->detail, event->evtype == XI_RawButtonRelease ? "up" : "down" );
|
||||
+
|
||||
+ rawinput.header.dwType = RIM_TYPEMOUSE;
|
||||
+ rawinput.header.dwSize = offsetof(RAWINPUT, data) + sizeof(RAWMOUSE);
|
||||
+ rawinput.header.hDevice = ULongToHandle(1); /* WINE_MOUSE_HANDLE */
|
||||
+ rawinput.header.wParam = RIM_INPUT;
|
||||
+ if (event->evtype == XI_RawButtonRelease)
|
||||
+ {
|
||||
+ rawinput.data.mouse.ulRawButtons = button_up_flags[button];
|
||||
+ rawinput.data.mouse.u.ulButtons = button_up_data[button];
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ rawinput.data.mouse.ulRawButtons = button_down_flags[button];
|
||||
+ rawinput.data.mouse.u.ulButtons = button_down_data[button];
|
||||
+ }
|
||||
+ rawinput.data.mouse.lLastX = 0;
|
||||
+ rawinput.data.mouse.lLastY = 0;
|
||||
+ rawinput.data.mouse.ulExtraInformation = 0;
|
||||
+
|
||||
+ input.type = INPUT_HARDWARE;
|
||||
+ input.u.hi.uMsg = WM_INPUT;
|
||||
+ input.u.hi.wParamH = (WORD)(rawinput.header.dwSize >> 16);
|
||||
+ input.u.hi.wParamL = (WORD)(rawinput.header.dwSize >> 0);
|
||||
+ if (rawinput.data.mouse.ulRawButtons || rawinput.data.mouse.u.ulButtons)
|
||||
+ __wine_send_input( 0, &input, &rawinput );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2066,6 +2151,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev )
|
||||
case XI_RawMotion:
|
||||
ret = X11DRV_RawMotion( event );
|
||||
break;
|
||||
+ case XI_RawButtonPress:
|
||||
+ case XI_RawButtonRelease:
|
||||
+ ret = X11DRV_RawButtonEvent( event );
|
||||
+ break;
|
||||
|
||||
default:
|
||||
TRACE( "Unhandled event %#x\n", event->evtype );
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index afa990b7e68..910a6c6cc18 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -353,6 +353,7 @@ struct x11drv_thread_data
|
||||
struct x11drv_valuator_data x_rel_valuator;
|
||||
struct x11drv_valuator_data y_rel_valuator;
|
||||
int xi2_core_pointer; /* XInput2 core pointer id */
|
||||
+ int xi2_rawinput_only;
|
||||
};
|
||||
|
||||
extern struct x11drv_thread_data *x11drv_init_thread_data(void) DECLSPEC_HIDDEN;
|
||||
--
|
||||
2.30.2
|
||||
|
@@ -1,282 +0,0 @@
|
||||
From b1139be0f5b7cc4c682f382655a6b58e5087a711 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Wed, 11 Sep 2019 10:15:20 +0200
|
||||
Subject: [PATCH] winex11.drv: Listen to RawMotion and RawButton* events in the
|
||||
desktop thread.
|
||||
|
||||
We still need to send "normal" input from the clipping window thread
|
||||
to trigger low-level hooks callbacks when clipping cursor. This is for
|
||||
instance used in our dinput implementation.
|
||||
---
|
||||
dlls/winex11.drv/event.c | 10 +++-
|
||||
dlls/winex11.drv/mouse.c | 88 ++++++++++++++++++++++++++++------
|
||||
dlls/winex11.drv/x11drv.h | 3 ++
|
||||
dlls/winex11.drv/x11drv_main.c | 4 ++
|
||||
4 files changed, 89 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
|
||||
index 07f7a1ad502..d722ba9d7cc 100644
|
||||
--- a/dlls/winex11.drv/event.c
|
||||
+++ b/dlls/winex11.drv/event.c
|
||||
@@ -321,6 +321,10 @@ static enum event_merge_action merge_raw_motion_events( XIRawEvent *prev, XIRawE
|
||||
*/
|
||||
static enum event_merge_action merge_events( XEvent *prev, XEvent *next )
|
||||
{
|
||||
+#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
+ struct x11drv_thread_data *thread_data = x11drv_thread_data();
|
||||
+#endif
|
||||
+
|
||||
switch (prev->type)
|
||||
{
|
||||
case ConfigureNotify:
|
||||
@@ -352,19 +356,21 @@ static enum event_merge_action merge_events( XEvent *prev, XEvent *next )
|
||||
case GenericEvent:
|
||||
if (next->xcookie.extension != xinput2_opcode) break;
|
||||
if (next->xcookie.evtype != XI_RawMotion) break;
|
||||
- if (x11drv_thread_data()->warp_serial) break;
|
||||
+ if (thread_data->xi2_rawinput_only) break;
|
||||
+ if (thread_data->warp_serial) break;
|
||||
return MERGE_KEEP;
|
||||
}
|
||||
break;
|
||||
case GenericEvent:
|
||||
if (prev->xcookie.extension != xinput2_opcode) break;
|
||||
if (prev->xcookie.evtype != XI_RawMotion) break;
|
||||
+ if (thread_data->xi2_rawinput_only) break;
|
||||
switch (next->type)
|
||||
{
|
||||
case GenericEvent:
|
||||
if (next->xcookie.extension != xinput2_opcode) break;
|
||||
if (next->xcookie.evtype != XI_RawMotion) break;
|
||||
- if (x11drv_thread_data()->warp_serial) break;
|
||||
+ if (thread_data->warp_serial) break;
|
||||
return merge_raw_motion_events( prev->xcookie.data, next->xcookie.data );
|
||||
#endif
|
||||
}
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index a1f2d4262e1..74598a3a85b 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -362,9 +362,9 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
- * 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();
|
||||
@@ -396,9 +396,21 @@ static void enable_xinput2(void)
|
||||
mask.mask_len = sizeof(mask_bits);
|
||||
mask.deviceid = XIAllMasterDevices;
|
||||
memset( mask_bits, 0, sizeof(mask_bits) );
|
||||
+
|
||||
XISetMask( mask_bits, XI_DeviceChanged );
|
||||
XISetMask( mask_bits, XI_RawMotion );
|
||||
- XISetMask( mask_bits, XI_ButtonPress );
|
||||
+
|
||||
+ if (GetWindowThreadProcessId( GetDesktopWindow(), NULL ) == GetCurrentThreadId())
|
||||
+ {
|
||||
+ XISetMask( mask_bits, XI_RawButtonPress );
|
||||
+ XISetMask( mask_bits, XI_RawButtonRelease );
|
||||
+ data->xi2_rawinput_only = TRUE;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ XISetMask( mask_bits, XI_ButtonPress );
|
||||
+ data->xi2_rawinput_only = FALSE;
|
||||
+ }
|
||||
|
||||
pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 );
|
||||
|
||||
@@ -411,9 +423,9 @@ static void enable_xinput2(void)
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
- * 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();
|
||||
@@ -473,7 +485,7 @@ static BOOL grab_clipping_window( const RECT *clip )
|
||||
}
|
||||
|
||||
/* enable XInput2 unless we are already clipping */
|
||||
- if (!data->clip_hwnd) enable_xinput2();
|
||||
+ if (!data->clip_hwnd) X11DRV_XInput2_Enable();
|
||||
|
||||
if (data->xi2_state != xi_enabled)
|
||||
{
|
||||
@@ -503,7 +515,7 @@ static BOOL grab_clipping_window( const RECT *clip )
|
||||
|
||||
if (!clipping_cursor)
|
||||
{
|
||||
- disable_xinput2();
|
||||
+ X11DRV_XInput2_Disable();
|
||||
DestroyWindow( msg_hwnd );
|
||||
return FALSE;
|
||||
}
|
||||
@@ -582,7 +594,7 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND prev_clip_hwnd, HWND new_clip_hwnd )
|
||||
TRACE( "clip hwnd reset from %p\n", hwnd );
|
||||
data->clip_hwnd = 0;
|
||||
data->clip_reset = GetTickCount();
|
||||
- disable_xinput2();
|
||||
+ X11DRV_XInput2_Disable();
|
||||
DestroyWindow( hwnd );
|
||||
}
|
||||
else if (prev_clip_hwnd)
|
||||
@@ -719,7 +731,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
}
|
||||
input->u.mi.dx += clip_rect.left;
|
||||
input->u.mi.dy += clip_rect.top;
|
||||
- __wine_send_input( hwnd, input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
+ __wine_send_input( hwnd, input, SEND_HWMSG_WINDOW );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -759,7 +771,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
SERVER_END_REQ;
|
||||
}
|
||||
|
||||
- __wine_send_input( hwnd, input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
+ __wine_send_input( hwnd, input, SEND_HWMSG_WINDOW );
|
||||
}
|
||||
|
||||
#ifdef SONAME_LIBXCURSOR
|
||||
@@ -1729,7 +1741,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.time = GetTickCount();
|
||||
input.u.mi.dwExtraInfo = 0;
|
||||
- __wine_send_input( hwnd, &input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
+ __wine_send_input( hwnd, &input, SEND_HWMSG_WINDOW );
|
||||
}
|
||||
|
||||
while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
|
||||
@@ -1912,6 +1924,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
x_rel = &thread_data->x_rel_valuator;
|
||||
y_rel = &thread_data->y_rel_valuator;
|
||||
|
||||
+ input.type = INPUT_MOUSE;
|
||||
input.u.mi.mouseData = 0;
|
||||
input.u.mi.dwFlags = MOUSEEVENTF_MOVE;
|
||||
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
|
||||
@@ -1947,10 +1960,53 @@ 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 );
|
||||
+ if (!thread_data->xi2_rawinput_only)
|
||||
+ {
|
||||
+ TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
|
||||
+ __wine_send_input( 0, &input, SEND_HWMSG_WINDOW );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ TRACE( "raw pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
|
||||
+ __wine_send_input( 0, &input, SEND_HWMSG_RAWINPUT );
|
||||
+ }
|
||||
+ return TRUE;
|
||||
+}
|
||||
|
||||
- input.type = INPUT_MOUSE;
|
||||
- __wine_send_input( 0, &input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
|
||||
+/***********************************************************************
|
||||
+ * X11DRV_RawButtonEvent
|
||||
+ */
|
||||
+static BOOL X11DRV_RawButtonEvent( XGenericEventCookie *cookie )
|
||||
+{
|
||||
+ struct x11drv_thread_data *thread_data = x11drv_thread_data();
|
||||
+ XIRawEvent *event = cookie->data;
|
||||
+ int button = event->detail - 1;
|
||||
+ INPUT input;
|
||||
+
|
||||
+ if (!device_mapping || device_mapping->deviceid != event->sourceid)
|
||||
+ update_device_mapping( event->display, event->sourceid );
|
||||
+
|
||||
+ if (button >= 0 && device_mapping)
|
||||
+ button = device_mapping->buttons[button] - 1;
|
||||
+
|
||||
+ if (button >= 0 && pointer_mapping)
|
||||
+ button = pointer_mapping->buttons[button] - 1;
|
||||
+
|
||||
+ if (button < 0 || button >= NB_BUTTONS) return FALSE;
|
||||
+ if (thread_data->xi2_state != xi_enabled) return FALSE;
|
||||
+ if (event->deviceid != thread_data->xi2_core_pointer) return FALSE;
|
||||
+
|
||||
+ TRACE( "raw button %u (raw: %u) %s\n", button, event->detail, event->evtype == XI_RawButtonRelease ? "up" : "down" );
|
||||
+
|
||||
+ input.type = INPUT_MOUSE;
|
||||
+ input.u.mi.dx = 0;
|
||||
+ input.u.mi.dy = 0;
|
||||
+ input.u.mi.mouseData = event->evtype == XI_RawButtonRelease ? button_up_data[button] : button_down_data[button];
|
||||
+ input.u.mi.dwFlags = event->evtype == XI_RawButtonRelease ? button_up_flags[button] : button_down_flags[button];
|
||||
+ input.u.mi.time = EVENT_x11_time_to_win32_time(event->time);
|
||||
+ input.u.mi.dwExtraInfo = 0;
|
||||
+
|
||||
+ __wine_send_input( 0, &input, SEND_HWMSG_RAWINPUT );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2026,6 +2082,10 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev )
|
||||
case XI_RawMotion:
|
||||
ret = X11DRV_RawMotion( event );
|
||||
break;
|
||||
+ case XI_RawButtonPress:
|
||||
+ case XI_RawButtonRelease:
|
||||
+ ret = X11DRV_RawButtonEvent( event );
|
||||
+ break;
|
||||
|
||||
default:
|
||||
TRACE( "Unhandled event %#x\n", event->evtype );
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index 6c2a8978eb5..92bd23c93ea 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -196,6 +196,8 @@ extern BOOL CDECL 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,
|
||||
@@ -343,6 +345,7 @@ struct x11drv_thread_data
|
||||
struct x11drv_valuator_data x_rel_valuator;
|
||||
struct x11drv_valuator_data y_rel_valuator;
|
||||
int xi2_core_pointer; /* XInput2 core pointer id */
|
||||
+ int xi2_rawinput_only;
|
||||
};
|
||||
|
||||
extern struct x11drv_thread_data *x11drv_init_thread_data(void) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
|
||||
index 6b32f3fd118..a7855a3245b 100644
|
||||
--- a/dlls/winex11.drv/x11drv_main.c
|
||||
+++ b/dlls/winex11.drv/x11drv_main.c
|
||||
@@ -633,6 +633,8 @@ void CDECL X11DRV_ThreadDetach(void)
|
||||
|
||||
if (data)
|
||||
{
|
||||
+ if (GetWindowThreadProcessId( GetDesktopWindow(), NULL ) == GetCurrentThreadId())
|
||||
+ X11DRV_XInput2_Disable();
|
||||
if (data->xim) XCloseIM( data->xim );
|
||||
if (data->font_set) XFreeFontSet( data->display, data->font_set );
|
||||
XCloseDisplay( data->display );
|
||||
@@ -702,6 +704,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
|
||||
TlsSetValue( thread_data_tls_index, data );
|
||||
|
||||
if (use_xim) X11DRV_SetupXIM();
|
||||
+ if (GetWindowThreadProcessId( GetDesktopWindow(), NULL ) == GetCurrentThreadId())
|
||||
+ X11DRV_XInput2_Enable();
|
||||
|
||||
return data;
|
||||
}
|
||||
--
|
||||
2.28.0
|
||||
|
@@ -1,36 +0,0 @@
|
||||
From b8cfcfa8e3b7694102462b6d3d59ee7919897a00 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Tue, 1 Dec 2020 10:19:00 +1100
|
||||
Subject: [PATCH] winex11.drv: Move header order
|
||||
|
||||
The HAVE_X11_EXTENSIONS_XINPUT2_H needs to be moved into each of the files
|
||||
to avoid a compile error with Status being undefined.
|
||||
---
|
||||
dlls/winex11.drv/window.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
|
||||
index 1e9d63ae808..22a330b3f88 100644
|
||||
--- a/dlls/winex11.drv/window.c
|
||||
+++ b/dlls/winex11.drv/window.c
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif /* HAVE_LIBXSHAPE */
|
||||
|
||||
+#include "x11drv.h"
|
||||
+
|
||||
/* avoid conflict with field names in included win32 headers */
|
||||
#undef Status
|
||||
#include "windef.h"
|
||||
@@ -45,7 +47,7 @@
|
||||
#include "winuser.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
-#include "x11drv.h"
|
||||
+
|
||||
#include "wine/debug.h"
|
||||
#include "wine/server.h"
|
||||
#include "mwm.h"
|
||||
--
|
||||
2.29.2
|
||||
|
@@ -1,4 +1,3 @@
|
||||
Fixes: [42631] Mouse drift, jump or don't react to small slow movements in Unity-engine games and Fallout 4 (partly fixed in Unity games, have walkaround in Fallout4 )
|
||||
Fixes: [42675] Overwatch: Phantom mouse input / view pulled up to ceiling
|
||||
# In the process of upstreaming.
|
||||
Disabled: true
|
||||
Depends: user32-rawinput-hid
|
||||
|
Reference in New Issue
Block a user