summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7627058)
raw | patch | inline | side by side (parent: 7627058)
author | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 19:20:10 +0000 (21:20 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 19:20:10 +0000 (21:20 +0200) |
Screen code shouldn't know anything about the screen ids (which will
be eliminated completely later). Instead of comparing ids, compare
the screen_functions pointer.
be eliminated completely later). Instead of comparing ids, compare
the screen_functions pointer.
diff --git a/src/screen.c b/src/screen.c
index cea637a8de9ea497c9d5642eeef85ab2f557fded..02df03b528df4a0a4231527c8210a1ab5019e777 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
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 7a8b0edb3dba2dba06e13e128dc1b689a7156062..dc7e239ea838661bb1959a6153583838d259d8fc 100644 (file)
--- a/src/screen.h
+++ b/src/screen.h
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 23a56d5b418b6d11edc6f2107ee49c67fbb9e493..71b168841dc73d8c18f82e5f86244ed4e025507b 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
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 05e8ad29924441607e0ffe2935353373262a4955..24cd8afc747f40f3b78755ccb1eec91afb3306f0 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
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 3c0393488fde736866ae6a669f20a8fbab42f23d..ec552ee3326d94117712d887561913d017bb689b 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
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 8258e18aea96044a60833edb1ec4b9d3609d6a6b..555412905d8e83c10459effe2d00826dcaa02f90 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.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 245eb5243c9c9bc9000895fb54dea15967585af7..b93aef01a12f067e0f8502fc21301855632aeb0e 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
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();
}