Mercurial > audlegacy
comparison 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 |
comparison
equal
deleted
inserted
replaced
3015:02a62ac3d9c2 | 3018:6a9fdd5aee3a |
---|---|
2480 void change_timer_mode(void) { | 2480 void change_timer_mode(void) { |
2481 if (cfg.timer_mode == TIMER_ELAPSED) | 2481 if (cfg.timer_mode == TIMER_ELAPSED) |
2482 set_timer_mode(TIMER_REMAINING); | 2482 set_timer_mode(TIMER_REMAINING); |
2483 else | 2483 else |
2484 set_timer_mode(TIMER_ELAPSED); | 2484 set_timer_mode(TIMER_ELAPSED); |
2485 mainwin_update_song_info(); | |
2485 } | 2486 } |
2486 | 2487 |
2487 static void | 2488 static void |
2488 mainwin_playlist_prev(void) | 2489 mainwin_playlist_prev(void) |
2489 { | 2490 { |
2979 { | 2980 { |
2980 mainwin_timeout_id = g_timeout_add(MAINWIN_UPDATE_INTERVAL, | 2981 mainwin_timeout_id = g_timeout_add(MAINWIN_UPDATE_INTERVAL, |
2981 mainwin_idle_func, NULL); | 2982 mainwin_idle_func, NULL); |
2982 } | 2983 } |
2983 | 2984 |
2984 static void | 2985 gboolean |
2985 idle_func_update_song_info(gint time) | 2986 mainwin_update_song_info(void) |
2986 { | 2987 { |
2988 gint time = playback_get_time(); | |
2987 gint length, t; | 2989 gint length, t; |
2988 gchar stime_prefix; | 2990 gchar stime_prefix; |
2989 | 2991 |
2992 if (!playback_get_playing() || time < 0) | |
2993 return FALSE; | |
2994 | |
2990 if (ab_position_a != -1 && ab_position_b != -1 && time > ab_position_b) | 2995 if (ab_position_a != -1 && ab_position_b != -1 && time > ab_position_b) |
2991 playback_seek(ab_position_a/1000); | 2996 playback_seek(ab_position_a/1000); |
2992 | 2997 |
2993 length = playlist_get_current_length(playlist_get_active()); | 2998 length = playlist_get_current_length(playlist_get_active()); |
2994 if (playback_get_playing()) | 2999 playlistwin_set_time(time, length, cfg.timer_mode); |
2995 playlistwin_set_time(time, length, cfg.timer_mode); | |
2996 else | |
2997 playlistwin_hide_timer(); | |
2998 input_update_vis(time); | |
2999 | 3000 |
3000 if (cfg.timer_mode == TIMER_REMAINING) { | 3001 if (cfg.timer_mode == TIMER_REMAINING) { |
3001 if (length != -1) { | 3002 if (length != -1) { |
3002 ui_skinned_number_set_number(mainwin_minus_num, 11); | 3003 ui_skinned_number_set_number(mainwin_minus_num, 11); |
3003 t = length - time; | 3004 t = length - time; |
3053 } | 3054 } |
3054 else { | 3055 else { |
3055 hslider_set_position(mainwin_position, 0); | 3056 hslider_set_position(mainwin_position, 0); |
3056 hslider_set_position(mainwin_sposition, 1); | 3057 hslider_set_position(mainwin_sposition, 1); |
3057 } | 3058 } |
3059 | |
3060 return TRUE; | |
3058 } | 3061 } |
3059 | 3062 |
3060 static gboolean | 3063 static gboolean |
3061 mainwin_idle_func(gpointer data) | 3064 mainwin_idle_func(gpointer data) |
3062 { | 3065 { |
3074 GDK_THREADS_LEAVE(); | 3077 GDK_THREADS_LEAVE(); |
3075 ev_waiting = FALSE; | 3078 ev_waiting = FALSE; |
3076 break; | 3079 break; |
3077 | 3080 |
3078 default: | 3081 default: |
3079 idle_func_update_song_info(time); | 3082 input_update_vis(time); |
3080 /* nothing at this time */ | 3083 /* nothing at this time */ |
3081 } | 3084 } |
3082 | 3085 |
3083 GDK_THREADS_ENTER(); | 3086 GDK_THREADS_ENTER(); |
3084 | 3087 |