mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
134 lines
4.3 KiB
Diff
134 lines
4.3 KiB
Diff
|
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
|
||
|
|