[mutter/wip/xinput2b: 3/22] display: Initialize XInput2
- From: Jasper St. Pierre <jstpierre src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [mutter/wip/xinput2b: 3/22] display: Initialize XInput2
 
- Date: Wed, 21 Nov 2012 02:26:05 +0000 (UTC)
 
commit 8864f4c3b4b33a6d98a746ba704e5312ea15c0d5
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Nov 15 15:57:08 2012 -0500
    display: Initialize XInput2
    
    Make sure it's the correct version.
 src/core/display-private.h |    5 ++++-
 src/core/display.c         |   21 ++++++++++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/core/display-private.h b/src/core/display-private.h
index b03fffd..b67fc33 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -283,7 +283,10 @@ struct _MetaDisplay
   int damage_error_base;
   int xfixes_event_base;
   int xfixes_error_base;
-  
+  int xinput2_error_base;
+  int xinput2_event_base;
+  int xinput2_opcode;
+
 #ifdef HAVE_STARTUP_NOTIFICATION
   SnDisplay *sn_display;
 #endif
diff --git a/src/core/display.c b/src/core/display.c
index a515a18..5ba1861 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -779,7 +779,26 @@ meta_display_open (void)
                   the_display->xfixes_error_base, 
                   the_display->xfixes_event_base);
   }
-      
+
+  {
+    int major = 2, minor = 2;
+    gboolean has_xi = FALSE;
+
+    if (!XQueryExtension (the_display->xdisplay,
+                          "XInputExtension",
+                          &the_display->xinput2_opcode,
+                          &the_display->xinput2_error_base,
+                          &the_display->xinput2_event_base))
+      meta_fatal ("Could not find XInput2\n");
+
+    if (XIQueryVersion (the_display->xdisplay, &major, &minor) == Success)
+      if (((major * 10) + minor) >= 22)
+        has_xi = TRUE;
+
+    if (!has_xi)
+      meta_fatal ("X server does not have an up to date version of XInput2\n");
+  }
+
 #ifdef HAVE_XCURSOR
   {
     XcursorSetTheme (the_display->xdisplay, meta_prefs_get_cursor_theme ());
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]