gnome-settings-daemon r608 - in trunk: . plugins/media-keys
- From: jensg svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-settings-daemon r608 - in trunk: . plugins/media-keys
- Date: Thu, 20 Nov 2008 21:38:04 +0000 (UTC)
Author: jensg
Date: Thu Nov 20 21:38:03 2008
New Revision: 608
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=608&view=rev
Log:
2008-11-20 Jens Granseuer <jensgr gmx net>
* plugins/media-keys/gsd-media-keys-manager.c: (find_by_time),
(gsd_media_keys_manager_grab_media_player_keys): fix handling of
time = GDK_CURRENT_TIME. Previously, apps that registered with
GDK_CURRENT_TIME would be trumped by any app that registered with
time != 0 (bug #559797)
Modified:
trunk/ChangeLog
trunk/plugins/media-keys/gsd-media-keys-manager.c
Modified: trunk/plugins/media-keys/gsd-media-keys-manager.c
==============================================================================
--- trunk/plugins/media-keys/gsd-media-keys-manager.c (original)
+++ trunk/plugins/media-keys/gsd-media-keys-manager.c Thu Nov 20 21:38:03 2008
@@ -682,10 +682,16 @@
find_by_time (gconstpointer a,
gconstpointer b)
{
- return ((MediaPlayer *)a)->time != 0 && ((MediaPlayer *)a)->time < ((MediaPlayer *)b)->time;
+ return ((MediaPlayer *)a)->time < ((MediaPlayer *)b)->time;
}
-
+/*
+ * Register a new media player. Most applications will want to call
+ * this with time = GDK_CURRENT_TIME. This way, the last registered
+ * player will receive media events. In some cases, applications
+ * may want to register with a lower priority (usually 1), to grab
+ * events only nobody is interested.
+ */
gboolean
gsd_media_keys_manager_grab_media_player_keys (GsdMediaKeysManager *manager,
const char *application,
@@ -695,12 +701,19 @@
GList *iter;
MediaPlayer *media_player;
+ if (time == GDK_CURRENT_TIME) {
+ GTimeVal tv;
+
+ g_get_current_time (&tv);
+ time = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ }
+
iter = g_list_find_custom (manager->priv->media_players,
application,
find_by_application);
if (iter != NULL) {
- if (time == 0 || ((MediaPlayer *)iter->data)->time < time) {
+ if (((MediaPlayer *)iter->data)->time < time) {
g_free (((MediaPlayer *)iter->data)->application);
g_free (iter->data);
manager->priv->media_players = g_list_delete_link (manager->priv->media_players, iter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]