Code

screen: removed "painted" flag
authorMax Kellermann <max@duempel.org>
Fri, 3 Oct 2008 12:28:49 +0000 (14:28 +0200)
committerMax Kellermann <max@duempel.org>
Fri, 3 Oct 2008 12:28:49 +0000 (14:28 +0200)
Repaint immediately instead of setting "painted=0".

src/main.c
src/screen.c
src/screen.h

index 3a6243c37fbe8065397ebff4d71e5262ada591eb..9839234372c05fb87719f8702a78b38211059fd9 100644 (file)
@@ -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 */
index 2fd4b571f3123324f410d27e0504399e0ff4a710..90788b0868496a5a6a3b9f6cb422d64e24e42bbb 100644 (file)
@@ -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);
index 6d264570201c37bab473967fb4af5dbbd465559b..4ad376ba8e9d09ddb9d3d86c8fc6e658acdfd5df 100644 (file)
@@ -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);