[mutter/wip/multitouch: 2/8] device-map: Initialize XInput 2.1



commit f73f7165b42afdcbfdcf6b03693f6b6aee608ef5
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 cee3aef..24711f9 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -317,6 +317,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]