aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/screen.c5
-rw-r--r--src/screen.h3
-rw-r--r--src/screen_artist.c2
-rw-r--r--src/screen_file.c2
-rw-r--r--src/screen_lyrics.c2
-rw-r--r--src/screen_play.c2
-rw-r--r--src/screen_search.c2
7 files changed, 10 insertions, 8 deletions
diff --git a/src/screen.c b/src/screen.c
index cea637a8d..02df03b52 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -47,9 +47,10 @@ static const struct screen_functions *mode_fn = &screen_playlist;
static int seek_id = -1;
static int seek_target_time = 0;
-gint get_cur_mode_id(void)
+gboolean
+screen_is_visible(const struct screen_functions *sf)
{
- return screen_get_id_by_index(screen.mode);
+ return sf == mode_fn;
}
static void
diff --git a/src/screen.h b/src/screen.h
index 7a8b0edb3..dc7e239ea 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -94,8 +94,9 @@ void screen_idle(mpdclient_t *c);
void screen_cmd(mpdclient_t *c, command_t cmd);
gint screen_get_id(const char *name);
+gboolean
+screen_is_visible(const struct screen_functions *sf);
-gint get_cur_mode_id(void);
int screen_get_mouse_event(mpdclient_t *c, unsigned long *bstate, int *row);
#endif
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 23a56d5b4..71b168841 100644
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
@@ -90,7 +90,7 @@ artist_repaint(void)
static void
artist_repaint_if_active(void)
{
- if (get_cur_mode_id() == 2) /* XXX don't use the literal number */
+ if (screen_is_visible(&screen_artist))
artist_repaint();
}
diff --git a/src/screen_file.c b/src/screen_file.c
index 05e8ad299..24cd8afc7 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -49,7 +49,7 @@ file_repaint(void)
static void
file_repaint_if_active(void)
{
- if (get_cur_mode_id() == 1) /* XXX don't use the literal number */
+ if (screen_is_visible(&screen_browse))
file_repaint();
}
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 3c0393488..ec552ee33 100644
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
@@ -99,7 +99,7 @@ lyrics_repaint(void)
static void
lyrics_repaint_if_active(void)
{
- if (get_cur_mode_id() == 104) { /* XXX don't use the literal number */
+ if (screen_is_visible(&screen_lyrics)) {
lyrics_repaint();
/* XXX repaint the screen title */
diff --git a/src/screen_play.c b/src/screen_play.c
index 8258e18ae..555412905 100644
--- a/src/screen_play.c
+++ b/src/screen_play.c
@@ -64,7 +64,7 @@ playlist_repaint(struct mpdclient *c)
static void
playlist_repaint_if_active(struct mpdclient *c)
{
- if (get_cur_mode_id() == 0) /* XXX don't use the literal number */
+ if (screen_is_visible(&screen_playlist))
playlist_repaint(c);
}
diff --git a/src/screen_search.c b/src/screen_search.c
index 245eb5243..b93aef01a 100644
--- a/src/screen_search.c
+++ b/src/screen_search.c
@@ -148,7 +148,7 @@ search_repaint(void)
static void
search_repaint_if_active(void)
{
- if (get_cur_mode_id() == 103) /* XXX don't use the literal number */
+ if (screen_is_visible(&screen_search))
search_repaint();
}