From 9d23fac4ce927cd27964323aa4cf8138e5128ba0 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 12 Apr 2012 03:51:09 +0000
Subject: common: Try XI 2.2 if XI 2.0 fails

The media-keys plugin calls supports_xinput2_devices(). That again calls
XIQueryDevice with a major/minor of 2.0. The upstream server has a check
for this in place and responds BadValue if a client initiates XI2 twice
with two different versions (such both us and GTK+ checking for
different versions). This happens here, and thus the plugin fails
to load.

The X server was fixed, but this is still required for older versions
of the Xi code:
http://cgit.freedesktop.org/xorg/xserver/commit/?id=ea51e9b2877df60135edaf2a8f88d0f2a2b41060

https://bugzilla.gnome.org/show_bug.cgi?id=673964
---
diff --git a/plugins/common/gsd-input-helper.c b/plugins/common/gsd-input-helper.c
index cf9e83d..f06b507 100644
--- a/plugins/common/gsd-input-helper.c
+++ b/plugins/common/gsd-input-helper.c
@@ -129,7 +129,14 @@ supports_xinput2_devices (int *opcode)
 
         if (XIQueryVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor) != Success) {
                 gdk_error_trap_pop_ignored ();
-                return FALSE;
+                /* try for 2.2, maybe gtk has already announced 2.2 support */
+                gdk_error_trap_push ();
+                major = 2;
+                minor = 2;
+                if (XIQueryVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor) != Success) {
+                    gdk_error_trap_pop_ignored ();
+                    return FALSE;
+                }
         }
         gdk_error_trap_pop_ignored ();
 
--
cgit v0.9.0.2

