2023-11-29 16:35:48 -08:00
|
|
|
From 1061a45af693c2cb526a3d83209397b483346b47 Mon Sep 17 00:00:00 2001
|
2021-04-09 15:39:38 -07:00
|
|
|
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
|
|
|
Date: Fri, 17 Jan 2020 16:33:11 +0100
|
2021-12-22 15:22:27 -08:00
|
|
|
Subject: [PATCH] winex11.drv: Split XInput2 thread initialization.
|
2021-04-09 15:39:38 -07:00
|
|
|
|
|
|
|
And rename the library and function loader to x11drv_xinput_load.
|
|
|
|
---
|
|
|
|
dlls/winex11.drv/mouse.c | 46 +++++++++++++++++++++++-----------
|
2023-11-29 16:35:48 -08:00
|
|
|
dlls/winex11.drv/x11drv.h | 4 +--
|
2021-04-09 15:39:38 -07:00
|
|
|
dlls/winex11.drv/x11drv_main.c | 4 ++-
|
2023-11-29 16:35:48 -08:00
|
|
|
3 files changed, 36 insertions(+), 18 deletions(-)
|
2021-04-09 15:39:38 -07:00
|
|
|
|
|
|
|
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
2023-11-29 16:35:48 -08:00
|
|
|
index 612fff9995c..911e93d8de1 100644
|
2021-04-09 15:39:38 -07:00
|
|
|
--- a/dlls/winex11.drv/mouse.c
|
|
|
|
+++ b/dlls/winex11.drv/mouse.c
|
2023-08-21 17:39:59 -07:00
|
|
|
@@ -253,6 +253,32 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
|
2021-12-22 15:22:27 -08:00
|
|
|
}
|
2021-04-09 15:39:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
+/***********************************************************************
|
|
|
|
+ * 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
|
|
|
|
*/
|
2023-08-21 17:39:59 -07:00
|
|
|
@@ -264,19 +290,9 @@ static void enable_xinput2(void)
|
2021-04-09 15:39:38 -07:00
|
|
|
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;
|
2023-08-21 17:39:59 -07:00
|
|
|
@@ -317,9 +333,9 @@ static void disable_xinput2(void)
|
2021-04-09 15:39:38 -07:00
|
|
|
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;
|
2023-11-29 16:35:48 -08:00
|
|
|
@@ -1755,9 +1771,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
2021-04-09 15:39:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
- * 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
|
2023-11-29 16:35:48 -08:00
|
|
|
index 2917579927c..050008d2bfb 100644
|
2021-04-09 15:39:38 -07:00
|
|
|
--- a/dlls/winex11.drv/x11drv.h
|
|
|
|
+++ b/dlls/winex11.drv/x11drv.h
|
2023-11-29 16:35:48 -08:00
|
|
|
@@ -260,8 +260,8 @@ extern void X11DRV_ThreadDetach(void);
|
|
|
|
|
2021-04-09 15:39:38 -07:00
|
|
|
/* X11 driver internal functions */
|
|
|
|
|
2023-11-29 16:35:48 -08:00
|
|
|
-extern void X11DRV_Xcursor_Init(void);
|
|
|
|
-extern void X11DRV_XInput2_Init(void);
|
|
|
|
+extern void x11drv_xinput_load(void);
|
|
|
|
+extern void x11drv_xinput_init(void);
|
2021-04-09 15:39:38 -07:00
|
|
|
|
|
|
|
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
|
2023-11-29 16:35:48 -08:00
|
|
|
index 32a20e0e4f2..573a41bbe96 100644
|
2021-04-09 15:39:38 -07:00
|
|
|
--- a/dlls/winex11.drv/x11drv_main.c
|
|
|
|
+++ b/dlls/winex11.drv/x11drv_main.c
|
2023-08-21 17:39:59 -07:00
|
|
|
@@ -700,7 +700,7 @@ static NTSTATUS x11drv_init( void *arg )
|
2021-04-09 15:39:38 -07:00
|
|
|
#ifdef SONAME_LIBXCOMPOSITE
|
|
|
|
X11DRV_XComposite_Init();
|
|
|
|
#endif
|
|
|
|
- X11DRV_XInput2_Init();
|
|
|
|
+ x11drv_xinput_load();
|
|
|
|
|
2023-02-28 15:05:20 -08:00
|
|
|
XkbUseExtension( gdi_display, NULL, NULL );
|
|
|
|
X11DRV_InitKeyboard( gdi_display );
|
2023-08-21 17:39:59 -07:00
|
|
|
@@ -790,6 +790,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
|
2021-04-09 15:39:38 -07:00
|
|
|
|
2023-04-03 17:40:07 -07:00
|
|
|
if (use_xim) xim_thread_attach( data );
|
2021-04-09 15:39:38 -07:00
|
|
|
|
|
|
|
+ x11drv_xinput_init();
|
|
|
|
+
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
2023-11-29 16:35:48 -08:00
|
|
|
2.42.0
|
2021-04-09 15:39:38 -07:00
|
|
|
|