diff --git a/src/core.c b/src/core.c index 878bbaee..a7509b8e 100644 --- a/src/core.c +++ b/src/core.c @@ -1223,7 +1223,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.print = &print_xmms2_percent; END OBJ(xmms2_bar, &update_xmms2) scan_bar(obj, arg); - obj->callbacks.print = &print_xmms2_bar; + obj->callbacks.barval = &xmms2_barval; END OBJ(xmms2_smart, &update_xmms2) obj->callbacks.print = &print_xmms2_smart; END OBJ(xmms2_playlist, &update_xmms2) diff --git a/src/xmms2.c b/src/xmms2.c index d11d8566..e4191bbf 100644 --- a/src/xmms2.c +++ b/src/xmms2.c @@ -343,13 +343,11 @@ void print_xmms2_duration(struct text_object *obj, char *p, int p_max_size) (info.xmms2.duration / 1000) % 60); } -void print_xmms2_bar(struct text_object *obj, char *p, int p_max_size) +uint8_t xmms2_barval(struct text_object *obj) { (void)obj; - if (!p_max_size) - return; - new_bar(obj, p, p_max_size, (int) (info.xmms2.progress * 255.0f)); + return round_to_int(info.xmms2.progress * 255.0f); } void print_xmms2_smart(struct text_object *obj, char *p, int p_max_size) diff --git a/src/xmms2.h b/src/xmms2.h index dbd87a6c..2474ea22 100644 --- a/src/xmms2.h +++ b/src/xmms2.h @@ -58,9 +58,7 @@ void update_xmms2(void); void print_xmms2_tracknr(struct text_object *, char *, int); void print_xmms2_elapsed(struct text_object *, char *, int); void print_xmms2_duration(struct text_object *, char *, int); -#ifdef X11 -void print_xmms2_bar(struct text_object *, char *, int); -#endif /* X11 */ +uint8_t xmms2_barval(struct text_object *); void print_xmms2_smart(struct text_object *, char *, int); void print_xmms2_artist(struct text_object *, char *, int); void print_xmms2_album(struct text_object *, char *, int);