winex11: Initialize XInput2 extension on every thread.
This commit is contained in:
parent
1a757a0146
commit
b7867059ce
3 changed files with 33 additions and 28 deletions
|
@ -266,17 +266,6 @@ static void enable_xinput2(void)
|
||||||
|
|
||||||
if (!xinput2_available) return;
|
if (!xinput2_available) return;
|
||||||
|
|
||||||
if (data->xi2_state == xi_unknown)
|
|
||||||
{
|
|
||||||
int major = 2, minor = 2;
|
|
||||||
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->xinput2_pointer )) return;
|
if (!pXIGetClientPointer( data->display, None, &data->xinput2_pointer )) return;
|
||||||
|
|
||||||
mask.mask = mask_bits;
|
mask.mask = mask_bits;
|
||||||
|
@ -292,8 +281,6 @@ static void enable_xinput2(void)
|
||||||
pointer_info = pXIQueryDevice( data->display, data->xinput2_pointer, &count );
|
pointer_info = pXIQueryDevice( data->display, data->xinput2_pointer, &count );
|
||||||
update_relative_valuators( pointer_info->classes, pointer_info->num_classes );
|
update_relative_valuators( pointer_info->classes, pointer_info->num_classes );
|
||||||
pXIFreeDeviceInfo( pointer_info );
|
pXIFreeDeviceInfo( pointer_info );
|
||||||
|
|
||||||
data->xi2_state = xi_enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -307,10 +294,7 @@ static void disable_xinput2(void)
|
||||||
struct x11drv_thread_data *data = x11drv_thread_data();
|
struct x11drv_thread_data *data = x11drv_thread_data();
|
||||||
XIEventMask mask;
|
XIEventMask mask;
|
||||||
|
|
||||||
if (data->xi2_state != xi_enabled) return;
|
if (!xinput2_available) return;
|
||||||
|
|
||||||
TRACE( "disabling\n" );
|
|
||||||
data->xi2_state = xi_disabled;
|
|
||||||
|
|
||||||
mask.mask = NULL;
|
mask.mask = NULL;
|
||||||
mask.mask_len = 0;
|
mask.mask_len = 0;
|
||||||
|
@ -326,6 +310,26 @@ static void disable_xinput2(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* x11drv_xinput_init
|
||||||
|
*/
|
||||||
|
void x11drv_xinput2_init( struct x11drv_thread_data *data )
|
||||||
|
{
|
||||||
|
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||||
|
int major = 2, minor = 2;
|
||||||
|
|
||||||
|
if (!xinput2_available || pXIQueryVersion( data->display, &major, &minor ))
|
||||||
|
{
|
||||||
|
WARN( "XInput 2.0 not available\n" );
|
||||||
|
xinput2_available = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE( "XInput2 %d.%d available\n", major, minor );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* grab_clipping_window
|
* grab_clipping_window
|
||||||
*
|
*
|
||||||
|
@ -352,17 +356,16 @@ static BOOL grab_clipping_window( const RECT *clip )
|
||||||
WARN( "refusing to clip to %s\n", wine_dbgstr_rect(clip) );
|
WARN( "refusing to clip to %s\n", wine_dbgstr_rect(clip) );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (!xinput2_available)
|
||||||
/* enable XInput2 unless we are already clipping */
|
|
||||||
if (!data->clipping_cursor) enable_xinput2();
|
|
||||||
|
|
||||||
if (data->xi2_state != xi_enabled)
|
|
||||||
{
|
{
|
||||||
WARN( "XInput2 not supported, refusing to clip to %s\n", wine_dbgstr_rect(clip) );
|
WARN( "XInput2 not supported, refusing to clip to %s\n", wine_dbgstr_rect(clip) );
|
||||||
NtUserClipCursor( NULL );
|
NtUserClipCursor( NULL );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* enable XInput2 unless we are already clipping */
|
||||||
|
if (!data->clipping_cursor) enable_xinput2();
|
||||||
|
|
||||||
TRACE( "clipping to %s win %lx\n", wine_dbgstr_rect(clip), clip_window );
|
TRACE( "clipping to %s win %lx\n", wine_dbgstr_rect(clip), clip_window );
|
||||||
|
|
||||||
if (!data->clipping_cursor) XUnmapWindow( data->display, clip_window );
|
if (!data->clipping_cursor) XUnmapWindow( data->display, clip_window );
|
||||||
|
@ -1646,7 +1649,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
|
||||||
|
|
||||||
if (x->number < 0 || y->number < 0) return FALSE;
|
if (x->number < 0 || y->number < 0) return FALSE;
|
||||||
if (!event->valuators.mask_len) return FALSE;
|
if (!event->valuators.mask_len) return FALSE;
|
||||||
if (thread_data->xi2_state != xi_enabled) return FALSE;
|
if (!xinput2_available) return FALSE;
|
||||||
if (event->deviceid != thread_data->xinput2_pointer) return FALSE;
|
if (event->deviceid != thread_data->xinput2_pointer) return FALSE;
|
||||||
|
|
||||||
virtual_rect = NtUserGetVirtualScreenRect();
|
virtual_rect = NtUserGetVirtualScreenRect();
|
||||||
|
@ -1721,9 +1724,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* X11DRV_XInput2_Init
|
* x11drv_xinput2_load
|
||||||
*/
|
*/
|
||||||
void X11DRV_XInput2_Init(void)
|
void x11drv_xinput2_load(void)
|
||||||
{
|
{
|
||||||
#if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H)
|
#if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H)
|
||||||
int event, error;
|
int event, error;
|
||||||
|
|
|
@ -263,7 +263,6 @@ extern void X11DRV_ThreadDetach(void);
|
||||||
/* X11 driver internal functions */
|
/* X11 driver internal functions */
|
||||||
|
|
||||||
extern void X11DRV_Xcursor_Init(void);
|
extern void X11DRV_Xcursor_Init(void);
|
||||||
extern void X11DRV_XInput2_Init(void);
|
|
||||||
|
|
||||||
extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image,
|
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,
|
const struct gdi_image_bits *src_bits, struct gdi_image_bits *dst_bits,
|
||||||
|
@ -393,7 +392,6 @@ struct x11drv_thread_data
|
||||||
Window clip_window; /* window used for cursor clipping */
|
Window clip_window; /* window used for cursor clipping */
|
||||||
BOOL clipping_cursor; /* whether thread is currently clipping the cursor */
|
BOOL clipping_cursor; /* whether thread is currently clipping the cursor */
|
||||||
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||||
enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */
|
|
||||||
XIValuatorClassInfo x_valuator;
|
XIValuatorClassInfo x_valuator;
|
||||||
XIValuatorClassInfo y_valuator;
|
XIValuatorClassInfo y_valuator;
|
||||||
int xinput2_pointer; /* XInput2 master pointer device id */
|
int xinput2_pointer; /* XInput2 master pointer device id */
|
||||||
|
@ -575,6 +573,9 @@ extern BOOL X11DRV_MappingNotify( HWND hWnd, XEvent *event );
|
||||||
extern BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *event );
|
extern BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *event );
|
||||||
|
|
||||||
extern int xinput2_opcode;
|
extern int xinput2_opcode;
|
||||||
|
extern void x11drv_xinput2_load(void);
|
||||||
|
extern void x11drv_xinput2_init( struct x11drv_thread_data *data );
|
||||||
|
|
||||||
extern Bool (*pXGetEventData)( Display *display, XEvent /*XGenericEventCookie*/ *event );
|
extern Bool (*pXGetEventData)( Display *display, XEvent /*XGenericEventCookie*/ *event );
|
||||||
extern void (*pXFreeEventData)( Display *display, XEvent /*XGenericEventCookie*/ *event );
|
extern void (*pXFreeEventData)( Display *display, XEvent /*XGenericEventCookie*/ *event );
|
||||||
|
|
||||||
|
|
|
@ -697,7 +697,7 @@ static NTSTATUS x11drv_init( void *arg )
|
||||||
#ifdef SONAME_LIBXCOMPOSITE
|
#ifdef SONAME_LIBXCOMPOSITE
|
||||||
X11DRV_XComposite_Init();
|
X11DRV_XComposite_Init();
|
||||||
#endif
|
#endif
|
||||||
X11DRV_XInput2_Init();
|
x11drv_xinput2_load();
|
||||||
|
|
||||||
XkbUseExtension( gdi_display, NULL, NULL );
|
XkbUseExtension( gdi_display, NULL, NULL );
|
||||||
X11DRV_InitKeyboard( gdi_display );
|
X11DRV_InitKeyboard( gdi_display );
|
||||||
|
@ -786,6 +786,7 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
|
||||||
NtUserGetThreadInfo()->driver_data = (UINT_PTR)data;
|
NtUserGetThreadInfo()->driver_data = (UINT_PTR)data;
|
||||||
|
|
||||||
if (use_xim) xim_thread_attach( data );
|
if (use_xim) xim_thread_attach( data );
|
||||||
|
x11drv_xinput2_init( data );
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue