[rhythmbox] Don't try to use old mmkeys grab unless running on X11



commit f4b18d4e0d46bb2dbdc36340410dbba1573c5b75
Author: Armin K <krejzi email com>
Date:   Thu Nov 21 16:10:02 2013 +0100

    Don't try to use old mmkeys grab unless running on X11
    
    GDK on Linux can be compiled with multiple backends,
    so it is not enough to add build time checks for
    backend support, but also runtime checks.

 plugins/mmkeys/rb-mmkeys-plugin.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/plugins/mmkeys/rb-mmkeys-plugin.c b/plugins/mmkeys/rb-mmkeys-plugin.c
index 1fdb2dc..29b79ba 100644
--- a/plugins/mmkeys/rb-mmkeys-plugin.c
+++ b/plugins/mmkeys/rb-mmkeys-plugin.c
@@ -346,8 +346,10 @@ first_call_complete (GObject *proxy, GAsyncResult *res, RBMMKeysPlugin *plugin)
                g_warning ("Unable to grab media player keys: %s", error->message);
                g_clear_error (&error);
 #ifdef HAVE_MMKEYS
-               mmkeys_grab (plugin, TRUE);
-               plugin->grab_type = X_KEY_GRAB;
+               if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
+                       mmkeys_grab (plugin, TRUE);
+                       plugin->grab_type = X_KEY_GRAB;
+               }
 #endif
                return;
        }
@@ -411,7 +413,7 @@ impl_activate (PeasActivatable *pplugin)
        }
 
 #ifdef HAVE_MMKEYS
-       if (plugin->grab_type == NONE) {
+       if (plugin->grab_type == NONE && GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
                rb_debug ("attempting old-style key grabs");
                mmkeys_grab (plugin, TRUE);
                plugin->grab_type = X_KEY_GRAB;


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