[mutter/wip/xinput2b: 6/19] core: enable XInput2 by default



commit a0031dd0cedc2960d7a7263a846ca9e3e3b6a7ec
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Jul 9 18:49:35 2011 +0200

    core: enable XInput2 by default
    
    We don't support more than the core mouse/keyboard pair, really,
    but as far as I'm aware, there's no existing use case for multiple
    device pairs besides things like display walls, which mutter
    doesn't support or really care about supproting.
    
    the MUTTER_USE_CORE_DEVICES envvar has been added to force use
    of Xlib core events for devices in order to check for regressions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688779

 src/core/main.c |    7 ++++++-
 src/core/util.c |   13 +++++++++++++
 src/meta/util.h |    3 +++
 src/ui/ui.c     |    9 ++-------
 4 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/src/core/main.c b/src/core/main.c
index 00f36ed..9d9cfde 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -301,9 +301,12 @@ static GSourceFuncs event_funcs = {
 static void
 meta_clutter_init (void)
 {
+  if (!meta_get_use_core_devices ())
+    clutter_x11_enable_xinput ();
+
   clutter_x11_set_display (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
   clutter_x11_disable_event_retrieval ();
-  
+
   if (CLUTTER_INIT_SUCCESS == clutter_init (NULL, NULL))
     {
       GSource *source = g_source_new (&event_funcs, sizeof (GSource));
@@ -414,6 +417,8 @@ meta_init (void)
     meta_set_verbose (TRUE);
   if (g_getenv ("MUTTER_DEBUG"))
     meta_set_debugging (TRUE);
+  if (g_getenv ("MUTTER_USE_CORE_DEVICES"))
+    meta_set_use_core_devices (TRUE);
 
   if (g_get_home_dir ())
     if (chdir (g_get_home_dir ()) < 0)
diff --git a/src/core/util.c b/src/core/util.c
index 0ab87bb..81c0f8f 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -50,6 +50,7 @@ meta_topic_real_valist (MetaDebugTopic topic,
 static gint verbose_topics = 0;
 static gboolean is_debugging = FALSE;
 static gboolean replace_current = FALSE;
+static gboolean use_core_devices = FALSE;
 static int no_prefix = 0;
 
 #ifdef WITH_VERBOSE_MODE
@@ -179,6 +180,18 @@ meta_set_debugging (gboolean setting)
 }
 
 gboolean
+meta_get_use_core_devices (void)
+{
+  return use_core_devices;
+}
+
+void
+meta_set_use_core_devices (gboolean setting)
+{
+  use_core_devices = setting;
+}
+
+gboolean
 meta_get_replace_current_wm (void)
 {
   return replace_current;
diff --git a/src/meta/util.h b/src/meta/util.h
index 04bb7bf..c1b2bd9 100644
--- a/src/meta/util.h
+++ b/src/meta/util.h
@@ -38,6 +38,9 @@ gboolean meta_is_syncing (void);
 void     meta_set_syncing (gboolean setting);
 void     meta_set_replace_current_wm (gboolean setting);
 
+gboolean meta_get_use_core_devices (void);
+void     meta_set_use_core_devices (gboolean setting);
+
 void meta_debug_spew_real (const char *format,
                            ...) G_GNUC_PRINTF (1, 2);
 void meta_verbose_real    (const char *format,
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 9335e18..e441005 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -60,13 +60,8 @@ struct _MetaUI
 void
 meta_ui_init (void)
 {
-  /* As of 2.91.7, Gdk uses XI2 by default, which conflicts with the
-   * direct X calls we use - in particular, events caused by calls to
-   * XGrabPointer/XGrabKeyboard are no longer understood by GDK, while
-   * GDK will no longer generate the core XEvents we process.
-   * So at least for now, enforce the previous behavior.
-   */
-  gdk_disable_multidevice ();
+  if (meta_get_use_core_devices ())
+    gdk_disable_multidevice ();
 
   if (!gtk_init_check (NULL, NULL))
     meta_fatal ("Unable to open X display %s\n", XDisplayName (NULL));



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