[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 01/01: Grab XID when window is first initialized to make the process smoother.
noreply at xfce.org
noreply at xfce.org
Thu Dec 7 12:21:16 CET 2017
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-pulseaudio-plugin.
commit b2f41752d8f612607a7c16d99c80261f63b7a89f
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Thu Dec 7 06:21:03 2017 -0500
Grab XID when window is first initialized to make the process smoother.
---
panel-plugin/pulseaudio-mpris-player.c | 42 ++++++++++++++++++++++++----------
1 file changed, 30 insertions(+), 12 deletions(-)
diff --git a/panel-plugin/pulseaudio-mpris-player.c b/panel-plugin/pulseaudio-mpris-player.c
index 480cf5f..7e068c3 100644
--- a/panel-plugin/pulseaudio-mpris-player.c
+++ b/panel-plugin/pulseaudio-mpris-player.c
@@ -184,17 +184,15 @@ pulseaudio_mpris_player_parse_metadata (PulseaudioMprisPlayer *player,
#ifdef HAVE_WNCK
-/**
- * Alternative "Raise" method.
- * Some media players (e.g. Spotify) do not support the "Raise" method.
- * This workaround utilizes libwnck to find the correct window and raise it.
- */
static void
-pulseaudio_mpris_player_raise_wnck (PulseaudioMprisPlayer *player)
+pulseaudio_mpris_player_get_xid (PulseaudioMprisPlayer *player)
{
WnckScreen *screen = NULL;
GList *window = NULL;
+ if (player->xid > 0L)
+ return;
+
screen = wnck_screen_get_default ();
if (screen != NULL)
{
@@ -206,17 +204,34 @@ pulseaudio_mpris_player_raise_wnck (PulseaudioMprisPlayer *player)
if (0 == g_strcmp0 (player->player_label, wnck_window_get_name (WNCK_WINDOW (window->data))))
{
player->xid = wnck_window_get_xid (WNCK_WINDOW (window->data));
+ if (player->xid > 0L)
+ return;
}
}
}
-
- if (player->xid > 0L)
- {
- WnckWindow *wdw = wnck_window_get (player->xid);
- wnck_window_activate (wdw, 0);
- }
}
}
+
+
+
+/**
+ * Alternative "Raise" method.
+ * Some media players (e.g. Spotify) do not support the "Raise" method.
+ * This workaround utilizes libwnck to find the correct window and raise it.
+ */
+static void
+pulseaudio_mpris_player_raise_wnck (PulseaudioMprisPlayer *player)
+{
+ WnckWindow *window = NULL;
+
+ pulseaudio_mpris_player_get_xid (player);
+
+ if (player->xid == 0L)
+ return;
+
+ window = wnck_window_get (player->xid);
+ wnck_window_activate (window, 0);
+}
#endif
@@ -578,6 +593,9 @@ pulseaudio_mpris_player_on_dbus_connected (GDBusConnection *connection,
g_variant_unref (reply);
}
+#ifdef HAVE_WNCK
+ pulseaudio_mpris_player_get_xid (player);
+#endif
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list