From: Max Kellermann Date: Fri, 3 Oct 2008 12:28:49 +0000 (+0200) Subject: screen: removed "painted" flag X-Git-Tag: v0.12_alpha1~78 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=66f34ee6b418742d44f38ec3bdec5a8ea541bfcc;p=ncmpc.git screen: removed "painted" flag Repaint immediately instead of setting "painted=0". --- diff --git a/src/main.c b/src/main.c index 3a6243c..9839234 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 2fd4b57..90788b0 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 (COLSstatus != 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 6d26457..4ad376b 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);