diff options
author | Max Kellermann <max@duempel.org> | 2008-10-03 14:28:49 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-03 14:28:49 +0200 |
commit | 66f34ee6b418742d44f38ec3bdec5a8ea541bfcc (patch) | |
tree | 825976289312f2e716710d613ce1fd8bdc54367d | |
parent | 0ae851aa39de5dfdf6b97c3e774aa322c820f410 (diff) | |
download | mpd-66f34ee6b418742d44f38ec3bdec5a8ea541bfcc.tar.gz mpd-66f34ee6b418742d44f38ec3bdec5a8ea541bfcc.tar.xz mpd-66f34ee6b418742d44f38ec3bdec5a8ea541bfcc.zip |
screen: removed "painted" flag
Repaint immediately instead of setting "painted=0".
-rw-r--r-- | src/main.c | 6 | ||||
-rw-r--r-- | src/screen.c | 14 | ||||
-rw-r--r-- | src/screen.h | 4 |
3 files changed, 10 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c index 3a6243c37..983923437 100644 --- a/src/main.c +++ b/src/main.c @@ -143,7 +143,7 @@ catch_sigcont(mpd_unused int sig) reset_prog_mode(); /* restore tty modes */ refresh(); #endif - screen_resize(); + screen_resize(mpd); } void @@ -165,7 +165,7 @@ timer_sigwinch(mpd_unused gpointer data) endwin(); refresh(); - screen_resize(); + screen_resize(mpd); return FALSE; } @@ -442,6 +442,8 @@ main(int argc, const char *argv[]) g_timeout_add(10000, timer_check_key_bindings, NULL); idle_source_id = g_timeout_add(idle_interval, timer_idle, NULL); + screen_paint(mpd); + g_main_loop_run(main_loop); /* cleanup */ diff --git a/src/screen.c b/src/screen.c index 2fd4b571f..90788b086 100644 --- a/src/screen.c +++ b/src/screen.c @@ -76,11 +76,12 @@ screen_switch(const struct screen_functions *sf, struct mpdclient *c) /* get functions for the new mode */ mode_fn = sf; - screen.painted = 0; /* open the new mode */ if (mode_fn->open != NULL) mode_fn->open(&screen, c); + + screen_paint(c); } static int @@ -372,7 +373,7 @@ screen_exit(void) } void -screen_resize(void) +screen_resize(struct mpdclient *c) { if (COLS<SCREEN_MIN_COLS || LINES<SCREEN_MIN_ROWS) { screen_exit(); @@ -416,7 +417,7 @@ screen_resize(void) curs_set(1); curs_set(0); - screen.painted = 0; + screen_paint(c); } void @@ -459,7 +460,6 @@ screen_init(mpdclient_t *c) screen.buf = g_malloc(screen.cols); screen.buf_size = screen.cols; screen.findbuf = NULL; - screen.painted = 0; screen.start_timestamp = time(NULL); screen.last_cmd = CMD_NONE; @@ -550,7 +550,6 @@ screen_paint(mpdclient_t *c) paint_progress_window(c); paint_status_window(c); - screen.painted = 1; wmove(screen.main_window.w, 0, 0); wnoutrefresh(screen.main_window.w); @@ -566,9 +565,6 @@ screen_update(mpdclient_t *c) static int crossfade = -1; static int dbupdate = -1; - if( !screen.painted ) - screen_paint(c); - /* print a message if mpd status has changed */ if (c->status != NULL) { if (repeat < 0) { @@ -788,7 +784,7 @@ screen_cmd(mpdclient_t *c, command_t cmd) _("Auto center mode: Off")); break; case CMD_SCREEN_UPDATE: - screen.painted = 0; + screen_paint(c); break; case CMD_SCREEN_PREVIOUS: screen_next_mode(c, -1); diff --git a/src/screen.h b/src/screen.h index 6d2645702..4ad376ba8 100644 --- a/src/screen.h +++ b/src/screen.h @@ -38,8 +38,6 @@ typedef struct screen { char *findbuf; GList *find_history; - - int painted; } screen_t; extern const struct screen_functions screen_playlist; @@ -72,7 +70,7 @@ typedef struct screen_functions { void screen_init(mpdclient_t *c); void screen_exit(void); -void screen_resize(void); +void screen_resize(struct mpdclient *c); void screen_status_message(const char *msg); void screen_status_printf(const char *format, ...); char *screen_error(void); |