[mutter/wip/multitouch: 61/73] device-map: Initialize XInput 2.1



commit 45450c2fa3f0a105805d8ea36e7ae4e7eda770cc
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Aug 2 18:51:52 2011 +0200

    device-map: Initialize XInput 2.1
    
    This is needed in order to use the Multitouch API.

 src/core/device-map.c      |   17 +++++++++++++----
 src/core/display-private.h |    3 +++
 2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/core/device-map.c b/src/core/device-map.c
index e79449a..33af95a 100644
--- a/src/core/device-map.c
+++ b/src/core/device-map.c
@@ -214,15 +214,24 @@ initialize_xinput (MetaDisplay *display)
                         &opcode, &unused, &unused))
     return FALSE;
 
-  major = XINPUT2_VERSION_MAJOR;
-  minor = XINPUT2_VERSION_MINOR;
+  major = XI_2_Major;
+#ifdef HAVE_XTOUCH
+  minor = XI_2_1_Minor;
+#else
+  minor = XI_2_Minor;
+#endif /* HAVE_XTOUCH */
 
   XIQueryVersion (display->xdisplay, &major, &minor);
 
-  if (major == XINPUT2_VERSION_MAJOR &&
-      minor == XINPUT2_VERSION_MINOR)
+  if (major == XI_2_Major &&
+      (
+#ifdef HAVE_XTOUCH
+       minor == XI_2_1_Minor ||
+#endif /* HAVE_XTOUCH */
+       minor == XI_2_Minor))
     {
       display->have_xinput2 = TRUE;
+      display->have_xtouch = (minor >= XI_2_1_Minor);
       display->xinput2_opcode = opcode;
 
       return TRUE;
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 41ef726..9b5acd0 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -320,6 +320,9 @@ struct _MetaDisplay
 #ifdef HAVE_XINPUT2
   int xinput2_opcode;
   unsigned int have_xinput2 : 1;
+#ifdef HAVE_XTOUCH
+  unsigned int have_xtouch : 1;
+#endif /* HAVE_XTOUCH */
 #endif
 
 #ifdef HAVE_XSYNC



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]