aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-25 21:21:29 +0200
committerMax Kellermann <max@duempel.org>2008-09-25 21:21:29 +0200
commitfb70ff1a3441d1076ba9eafe61d94b81190dda44 (patch)
treeb0016efae9e322393e9e86964169c26210bf167d /src/screen.c
parent5c752834b88e5f956e535da674f5a712757f69e7 (diff)
downloadmpd-fb70ff1a3441d1076ba9eafe61d94b81190dda44.tar.gz
mpd-fb70ff1a3441d1076ba9eafe61d94b81190dda44.tar.xz
mpd-fb70ff1a3441d1076ba9eafe61d94b81190dda44.zip
screen: removed screen.mode
Everything is now managed with a pointer to the screen_functions struct.
Diffstat (limited to '')
-rw-r--r--src/screen.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/screen.c b/src/screen.c
index 2124a2b74..9c7ca50a5 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -56,22 +56,17 @@ screen_is_visible(const struct screen_functions *sf)
static void
switch_screen_mode(const struct screen_functions *sf, mpdclient_t *c)
{
- gint new_mode;
+ assert(sf != NULL);
if (sf == mode_fn)
return;
- new_mode = lookup_mode(sf);
- if (new_mode < 0)
- return;
-
/* close the old mode */
if (mode_fn->close != NULL)
mode_fn->close();
/* get functions for the new mode */
mode_fn = sf;
- screen.mode = new_mode;
screen.painted = 0;
/* open the new mode */
@@ -96,9 +91,10 @@ screen_next_mode(mpdclient_t *c, int offset)
{
int max = g_strv_length(options.screen_list);
int current, next;
+ const struct screen_functions *sf;
/* find current screen */
- current = find_configured_screen(screen_get_name(screen.mode));
+ current = find_configured_screen(screen_get_name(mode_fn));
next = current + offset;
if (next<0)
next = max-1;
@@ -106,7 +102,9 @@ screen_next_mode(mpdclient_t *c, int offset)
next = 0;
D("current mode: %d:%d next:%d\n", current, max, next);
- switch_screen_mode(screen_lookup_name(options.screen_list[next]), c);
+ sf = screen_lookup_name(options.screen_list[next]);
+ if (sf != NULL)
+ switch_screen_mode(sf, c);
}
static void
@@ -447,7 +445,6 @@ screen_init(mpdclient_t *c)
exit(EXIT_FAILURE);
}
- screen.mode = 0;
screen.cols = COLS;
screen.rows = LINES;