[gnome-settings-daemon] media-keys: Prefer MPRIS clients to g-s-d ones



commit 3a64890a35c2b7218c8830b3ccc817841a2ee338
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jan 24 17:22:24 2018 +0100

    media-keys: Prefer MPRIS clients to g-s-d ones
    
    When there is an MPRIS client, prefer it to clients using the
    gnome-settings-daemon interface. MPRIS clients are always media clients,
    and it's likely that the user wants the media keys to control music or
    movie playback, rather than presentations.
    
    This will make mixing and matching the 2 different types of clients
    (for example, Spotify and Rhythmbox) always control the MPRIS client,
    but it's more than likely what the users want.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=789738
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792875

 plugins/media-keys/gsd-media-keys-manager.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index ca98dfd..1ad3f3d 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -1651,13 +1651,17 @@ gsd_media_player_key_pressed (GsdMediaKeysManager *manager,
 
         g_debug ("Media key '%s' pressed", key);
 
+        /* Prefer MPRIS players to those using the native API */
+        if (mpris_controller_get_has_active_player (manager->priv->mpris_controller)) {
+                if (mpris_controller_key (manager->priv->mpris_controller, key))
+                        return TRUE;
+        }
+
         have_listeners = (manager->priv->media_players != NULL);
 
         if (!have_listeners) {
-                if (!mpris_controller_key (manager->priv->mpris_controller, key)) {
-                        /* Popup a dialog with an (/) icon */
-                        show_osd (manager, "action-unavailable-symbolic", NULL, -1, OSD_ALL_OUTPUTS);
-                }
+                /* Popup a dialog with an (/) icon */
+                show_osd (manager, "action-unavailable-symbolic", NULL, -1, OSD_ALL_OUTPUTS);
                return TRUE;
         }
 


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