winex11: Add handlers for the XInput2 raw mouse events.
This commit is contained in:
parent
77e05ce4e5
commit
338fe8b9ac
|
@ -140,7 +140,7 @@ static x11drv_event_handler handlers[MAX_EVENT_HANDLERS] =
|
|||
NULL, /* 32 ColormapNotify */
|
||||
X11DRV_ClientMessage, /* 33 ClientMessage */
|
||||
X11DRV_MappingNotify, /* 34 MappingNotify */
|
||||
NULL /* 35 GenericEvent */
|
||||
X11DRV_GenericEvent /* 35 GenericEvent */
|
||||
};
|
||||
|
||||
static const char * event_names[MAX_EVENT_HANDLERS] =
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
#include <X11/extensions/XInput2.h>
|
||||
#endif
|
||||
|
||||
#ifdef SONAME_LIBXCURSOR
|
||||
# include <X11/Xcursor/Xcursor.h>
|
||||
|
@ -1089,3 +1092,115 @@ void X11DRV_EnterNotify( HWND hwnd, XEvent *xev )
|
|||
|
||||
send_mouse_input( hwnd, event->window, event->state, &input );
|
||||
}
|
||||
|
||||
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_RawButtonPress
|
||||
*/
|
||||
static void X11DRV_RawButtonPress( XIRawEvent *event )
|
||||
{
|
||||
int button = event->detail - 1;
|
||||
INPUT input;
|
||||
|
||||
if (button >= NB_BUTTONS) return;
|
||||
|
||||
TRACE( "button %u\n", button );
|
||||
|
||||
input.type = INPUT_MOUSE;
|
||||
input.u.mi.dx = 0;
|
||||
input.u.mi.dy = 0;
|
||||
input.u.mi.mouseData = button_down_data[button];
|
||||
input.u.mi.dwFlags = button_down_flags[button];
|
||||
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
|
||||
input.u.mi.dwExtraInfo = 0;
|
||||
|
||||
update_user_time( event->time );
|
||||
input.type = INPUT_MOUSE;
|
||||
__wine_send_input( 0, &input );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_RawButtonRelease
|
||||
*/
|
||||
static void X11DRV_RawButtonRelease( XIRawEvent *event )
|
||||
{
|
||||
int button = event->detail - 1;
|
||||
INPUT input;
|
||||
|
||||
if (button >= NB_BUTTONS) return;
|
||||
|
||||
TRACE( "button %u\n", button );
|
||||
|
||||
input.u.mi.dx = 0;
|
||||
input.u.mi.dy = 0;
|
||||
input.u.mi.mouseData = button_up_data[button];
|
||||
input.u.mi.dwFlags = button_up_flags[button];
|
||||
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
|
||||
input.u.mi.dwExtraInfo = 0;
|
||||
|
||||
input.type = INPUT_MOUSE;
|
||||
__wine_send_input( 0, &input );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_RawMotion
|
||||
*/
|
||||
static void X11DRV_RawMotion( XIRawEvent *event )
|
||||
{
|
||||
const double *values = event->valuators.values;
|
||||
INPUT input;
|
||||
|
||||
if (!event->valuators.mask_len) return;
|
||||
|
||||
input.u.mi.dx = 0;
|
||||
input.u.mi.dy = 0;
|
||||
input.u.mi.mouseData = 0;
|
||||
input.u.mi.dwFlags = MOUSEEVENTF_MOVE;
|
||||
input.u.mi.time = EVENT_x11_time_to_win32_time( event->time );
|
||||
input.u.mi.dwExtraInfo = 0;
|
||||
|
||||
if (XIMaskIsSet( event->valuators.mask, 0 )) input.u.mi.dx = *values++;
|
||||
if (XIMaskIsSet( event->valuators.mask, 1 )) input.u.mi.dy = *values++;
|
||||
|
||||
TRACE( "pos %d,%d\n", input.u.mi.dx, input.u.mi.dy );
|
||||
|
||||
input.type = INPUT_MOUSE;
|
||||
__wine_send_input( 0, &input );
|
||||
}
|
||||
|
||||
#endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_GenericEvent
|
||||
*/
|
||||
void X11DRV_GenericEvent( HWND hwnd, XEvent *xev )
|
||||
{
|
||||
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
|
||||
XGenericEventCookie *event = &xev->xcookie;
|
||||
|
||||
if (!event->data) return;
|
||||
|
||||
switch (event->evtype)
|
||||
{
|
||||
case XI_RawButtonPress:
|
||||
X11DRV_RawButtonPress( event->data );
|
||||
break;
|
||||
|
||||
case XI_RawButtonRelease:
|
||||
X11DRV_RawButtonRelease( event->data );
|
||||
break;
|
||||
|
||||
case XI_RawMotion:
|
||||
X11DRV_RawMotion( event->data );
|
||||
break;
|
||||
|
||||
default:
|
||||
TRACE( "Unhandled event %#x\n", event->evtype );
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -728,6 +728,7 @@ extern void X11DRV_DestroyNotify( HWND hwnd, XEvent *event );
|
|||
extern void X11DRV_SelectionRequest( HWND hWnd, XEvent *event );
|
||||
extern void X11DRV_SelectionClear( HWND hWnd, XEvent *event );
|
||||
extern void X11DRV_MappingNotify( HWND hWnd, XEvent *event );
|
||||
extern void X11DRV_GenericEvent( HWND hwnd, XEvent *event );
|
||||
|
||||
extern Bool (*pXGetEventData)( Display *display, XEvent /*XGenericEventCookie*/ *event );
|
||||
extern void (*pXFreeEventData)( Display *display, XEvent /*XGenericEventCookie*/ *event );
|
||||
|
|
Loading…
Reference in New Issue