From d9115690c8677457386ab0851a42752b81b3517f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 3 Oct 2009 22:04:54 +0200 Subject: [PATCH] status_bar: moved hscroll object to struct status_bar --- src/status_bar.c | 9 ++------- src/status_bar.h | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/status_bar.c b/src/status_bar.c index 204a66e..19eec1d 100644 --- a/src/status_bar.c +++ b/src/status_bar.c @@ -26,10 +26,6 @@ #include "player_command.h" #include "utils.h" -#ifndef NCMPC_MINI -#include "hscroll.h" -#endif - #include #include @@ -54,7 +50,7 @@ status_bar_clear_message(gpointer data) } void -status_bar_paint(const struct status_bar *p, const struct mpd_status *status, +status_bar_paint(struct status_bar *p, const struct mpd_status *status, const struct mpd_song *song) { WINDOW *w = p->window.w; @@ -170,8 +166,7 @@ status_bar_paint(const struct status_bar *p, const struct mpd_status *status, /* scroll if the song name is to long */ #ifndef NCMPC_MINI if (options.scroll && utf8_width(songname) > (unsigned)width) { - static struct hscroll hscroll = { 0, 0 }; - char *tmp = strscroll(&hscroll, songname, + char *tmp = strscroll(&p->hscroll, songname, options.scroll_sep, width); g_strlcpy(songname, tmp, sizeof(songname)); diff --git a/src/status_bar.h b/src/status_bar.h index 902ed1a..c97c7a1 100644 --- a/src/status_bar.h +++ b/src/status_bar.h @@ -22,6 +22,10 @@ #include "window.h" +#ifndef NCMPC_MINI +#include "hscroll.h" +#endif + #include #include @@ -33,6 +37,10 @@ struct status_bar { struct window window; guint message_source_id; + +#ifndef NCMPC_MINI + struct hscroll hscroll; +#endif }; static inline void @@ -44,6 +52,11 @@ status_bar_init(struct status_bar *p, unsigned width, int y, int x) keypad(p->window.w, true); p->message_source_id = 0; + +#ifndef NCMPC_MINI + hscroll_reset(&p->hscroll); + p->hscroll.t = 0; +#endif } static inline void @@ -56,7 +69,7 @@ status_bar_deinit(struct status_bar *p) } void -status_bar_paint(const struct status_bar *p, const struct mpd_status *status, +status_bar_paint(struct status_bar *p, const struct mpd_status *status, const struct mpd_song *song); void -- 2.30.2