diff src/audacious/ui_main.c @ 3018:6a9fdd5aee3a trunk

Move timer updates out of the 100hz giant loop.
author Daniel Drake <dsd@gentoo.org>
date Mon, 09 Jul 2007 23:19:35 -0500
parents 3c4ed53a685f
children 89b85a1b7fd2
line wrap: on
line diff
--- a/src/audacious/ui_main.c	Mon Jul 09 05:17:21 2007 -0500
+++ b/src/audacious/ui_main.c	Mon Jul 09 23:19:35 2007 -0500
@@ -2482,6 +2482,7 @@
         set_timer_mode(TIMER_REMAINING);
     else
         set_timer_mode(TIMER_ELAPSED);
+    mainwin_update_song_info();
 }
 
 static void
@@ -2981,21 +2982,21 @@
                                        mainwin_idle_func, NULL);
 }
 
-static void
-idle_func_update_song_info(gint time)
+gboolean
+mainwin_update_song_info(void)
 {
+    gint time = playback_get_time();
     gint length, t;
     gchar stime_prefix;
 
+    if (!playback_get_playing() || time < 0)
+        return FALSE;
+
     if (ab_position_a != -1 && ab_position_b != -1 && time > ab_position_b)
         playback_seek(ab_position_a/1000);
 
     length = playlist_get_current_length(playlist_get_active());
-    if (playback_get_playing())
-        playlistwin_set_time(time, length, cfg.timer_mode);
-    else
-        playlistwin_hide_timer();
-    input_update_vis(time);
+    playlistwin_set_time(time, length, cfg.timer_mode);
 
     if (cfg.timer_mode == TIMER_REMAINING) {
         if (length != -1) {
@@ -3055,6 +3056,8 @@
         hslider_set_position(mainwin_position, 0);
         hslider_set_position(mainwin_sposition, 1);
     }
+
+    return TRUE;
 }
 
 static gboolean
@@ -3076,7 +3079,7 @@
             break;
 
         default:
-            idle_func_update_song_info(time);
+            input_update_vis(time);
             /* nothing at this time */
     }