device-map: Initialize XInput 2.1

This is needed in order to use the Multitouch API.
This commit is contained in:
Carlos Garnacho 2011-08-02 18:51:52 +02:00
parent afa4c643a8
commit 45450c2fa3
2 changed files with 16 additions and 4 deletions

View File

@ -214,15 +214,24 @@ initialize_xinput (MetaDisplay *display)
&opcode, &unused, &unused)) &opcode, &unused, &unused))
return FALSE; return FALSE;
major = XINPUT2_VERSION_MAJOR; major = XI_2_Major;
minor = XINPUT2_VERSION_MINOR; #ifdef HAVE_XTOUCH
minor = XI_2_1_Minor;
#else
minor = XI_2_Minor;
#endif /* HAVE_XTOUCH */
XIQueryVersion (display->xdisplay, &major, &minor); XIQueryVersion (display->xdisplay, &major, &minor);
if (major == XINPUT2_VERSION_MAJOR && if (major == XI_2_Major &&
minor == XINPUT2_VERSION_MINOR) (
#ifdef HAVE_XTOUCH
minor == XI_2_1_Minor ||
#endif /* HAVE_XTOUCH */
minor == XI_2_Minor))
{ {
display->have_xinput2 = TRUE; display->have_xinput2 = TRUE;
display->have_xtouch = (minor >= XI_2_1_Minor);
display->xinput2_opcode = opcode; display->xinput2_opcode = opcode;
return TRUE; return TRUE;

View File

@ -320,6 +320,9 @@ struct _MetaDisplay
#ifdef HAVE_XINPUT2 #ifdef HAVE_XINPUT2
int xinput2_opcode; int xinput2_opcode;
unsigned int have_xinput2 : 1; unsigned int have_xinput2 : 1;
#ifdef HAVE_XTOUCH
unsigned int have_xtouch : 1;
#endif /* HAVE_XTOUCH */
#endif #endif
#ifdef HAVE_XSYNC #ifdef HAVE_XSYNC