Code

screen_*: eliminate redundant wrefresh() calls
authorMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 12:08:01 +0000 (13:08 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 12:08:01 +0000 (13:08 +0100)
This is already called by screen_refresh().

src/screen_artist.c
src/screen_file.c
src/screen_help.c
src/screen_keydef.c
src/screen_lyrics.c
src/screen_outputs.c
src/screen_queue.c
src/screen_search.c
src/screen_song.c

index 52b81d02ad3c662b99d84ea8cc3920781616f38b..f8d50d0c096def9358075320d970d75811e12992 100644 (file)
@@ -88,16 +88,6 @@ screen_artist_lw_callback(unsigned idx, void *data)
        return buf;
 }
 
-static void
-screen_artist_paint(void);
-
-static void
-artist_repaint(void)
-{
-       screen_artist_paint();
-       wrefresh(browser.lw->w);
-}
-
 static void
 string_array_free(GPtrArray *array)
 {
@@ -440,7 +430,7 @@ screen_artist_update(struct mpdclient *c)
                         | MPD_IDLE_QUEUE
 #endif
                         ))
-               artist_repaint();
+               screen_artist_paint();
 }
 
 /* add_query - Add all songs satisfying specified criteria.
@@ -530,7 +520,7 @@ screen_artist_cmd(struct mpdclient *c, command_t cmd)
                        open_album_list(c, g_strdup(selected));
                        list_window_reset(browser.lw);
 
-                       artist_repaint();
+                       screen_artist_paint();
                        return true;
 
                case LIST_ALBUMS:
@@ -560,7 +550,7 @@ screen_artist_cmd(struct mpdclient *c, command_t cmd)
                                list_window_reset(browser.lw);
                        }
 
-                       artist_repaint();
+                       screen_artist_paint();
                        return true;
 
                case LIST_SONGS:
@@ -583,7 +573,7 @@ screen_artist_cmd(struct mpdclient *c, command_t cmd)
                                        list_window_center(browser.lw, idx);
                                }
 
-                               artist_repaint();
+                               screen_artist_paint();
                                return true;
                        }
                        break;
@@ -632,7 +622,7 @@ screen_artist_cmd(struct mpdclient *c, command_t cmd)
                        break;
                }
 
-               artist_repaint();
+               screen_artist_paint();
                break;
 
        case CMD_GO_ROOT_DIRECTORY:
@@ -649,7 +639,7 @@ screen_artist_cmd(struct mpdclient *c, command_t cmd)
                        break;
                }
 
-               artist_repaint();
+               screen_artist_paint();
                break;
 
        case CMD_SELECT:
@@ -701,13 +691,13 @@ screen_artist_cmd(struct mpdclient *c, command_t cmd)
                case LIST_ARTISTS:
                        screen_find(browser.lw, cmd,
                                    screen_artist_lw_callback, artist_list);
-                       artist_repaint();
+                       screen_artist_paint();
                        return true;
 
                case LIST_ALBUMS:
                        screen_find(browser.lw, cmd,
                                    screen_artist_lw_callback, album_list);
-                       artist_repaint();
+                       screen_artist_paint();
                        return true;
 
                case LIST_SONGS:
@@ -720,14 +710,14 @@ screen_artist_cmd(struct mpdclient *c, command_t cmd)
                        screen_jump(browser.lw,
                                    screen_artist_lw_callback, artist_list,
                                    paint_artist_callback, artist_list);
-                       artist_repaint();
+                       screen_artist_paint();
                        return true;
 
                case LIST_ALBUMS:
                        screen_jump(browser.lw,
                                    screen_artist_lw_callback, album_list,
                                    paint_album_callback, album_list);
-                       artist_repaint();
+                       screen_artist_paint();
                        return true;
 
                case LIST_SONGS:
@@ -743,7 +733,7 @@ screen_artist_cmd(struct mpdclient *c, command_t cmd)
 
        if (screen_artist_lw_cmd(c, cmd)) {
                if (screen_is_visible(&screen_artist))
-                       artist_repaint();
+                       screen_artist_paint();
                return true;
        }
 
index af0dbd0049b5978f108fb57f6ba231b24053fc2c..5399c85d3bfe5c7fed1aea468321e2b8a23e813e 100644 (file)
 static struct screen_browser browser;
 static char *current_path;
 
-static void
-screen_file_paint(void);
-
-static void
-screen_file_repaint(void)
-{
-       screen_file_paint();
-       wrefresh(browser.lw->w);
-}
-
 static void
 screen_file_load_list(struct mpdclient *c, struct filelist *filelist)
 {
@@ -319,7 +309,7 @@ screen_file_update(struct mpdclient *c)
 #endif
                         )) {
                screen_browser_sync_highlights(browser.filelist, &c->playlist);
-               screen_file_repaint();
+               screen_file_paint();
        }
 }
 
@@ -329,7 +319,7 @@ screen_file_cmd(struct mpdclient *c, command_t cmd)
        switch(cmd) {
        case CMD_PLAY:
                if (screen_file_handle_enter(c)) {
-                       screen_file_repaint();
+                       screen_file_paint();
                        return true;
                }
 
@@ -337,11 +327,11 @@ screen_file_cmd(struct mpdclient *c, command_t cmd)
 
        case CMD_GO_ROOT_DIRECTORY:
                change_directory(c, "");
-               screen_file_repaint();
+               screen_file_paint();
                return true;
        case CMD_GO_PARENT_DIRECTORY:
                change_to_parent(c);
-               screen_file_repaint();
+               screen_file_paint();
                return true;
 
        case CMD_LOCATE:
@@ -353,7 +343,7 @@ screen_file_cmd(struct mpdclient *c, command_t cmd)
        case CMD_SCREEN_UPDATE:
                screen_file_reload(c);
                screen_browser_sync_highlights(browser.filelist, &c->playlist);
-               screen_file_repaint();
+               screen_file_paint();
                return false;
 
        default:
@@ -362,7 +352,7 @@ screen_file_cmd(struct mpdclient *c, command_t cmd)
 
        if (browser_cmd(&browser, c, cmd)) {
                if (screen_is_visible(&screen_browse))
-                       screen_file_repaint();
+                       screen_file_paint();
                return true;
        }
 
@@ -372,7 +362,7 @@ screen_file_cmd(struct mpdclient *c, command_t cmd)
        switch(cmd) {
        case CMD_DELETE:
                handle_delete(c);
-               screen_file_repaint();
+               screen_file_paint();
                break;
 
        case CMD_SAVE_PLAYLIST:
index 7497c11ad0ff0d73eba5419243037c2cffbf9155..c1a592f253a269995b77b77425789551114b98a7 100644 (file)
@@ -285,7 +285,6 @@ help_cmd(gcc_unused struct mpdclient *c, command_t cmd)
 {
        if (list_window_scroll_cmd(lw, cmd)) {
                help_paint();
-               wrefresh(lw->w);
                return true;
        }
 
@@ -294,7 +293,6 @@ help_cmd(gcc_unused struct mpdclient *c, command_t cmd)
                /* center the row */
                list_window_center(lw, lw->selected);
                help_paint();
-               wrefresh(lw->w);
                return true;
        }
 
index 31c3582e4d61de964eb242669df8c9f357a286dd..44b191c26d0a40672473faf6c94b7193b66ca8f7 100644 (file)
@@ -195,13 +195,6 @@ check_subcmd_length(void)
 static void
 keydef_paint(void);
 
-static void
-keydef_repaint(void)
-{
-       keydef_paint();
-       wrefresh(lw->w);
-}
-
 /** lw->start the last time switch_to_subcmd_mode() was called */
 static unsigned saved_start = 0;
 
@@ -216,7 +209,7 @@ switch_to_subcmd_mode(int cmd)
        list_window_reset(lw);
        check_subcmd_length();
 
-       keydef_repaint();
+       keydef_paint();
 }
 
 static void
@@ -230,7 +223,7 @@ switch_to_command_mode(void)
 
        lw->start = saved_start;
 
-       keydef_repaint();
+       keydef_paint();
 }
 
 /**
@@ -257,7 +250,7 @@ delete_key(int cmd_index, int key_index)
        screen_status_printf(_("Deleted"));
 
        /* repaint */
-       keydef_repaint();
+       keydef_paint();
 
        /* update key conflict flags */
        check_key_bindings(cmds, NULL, 0);
@@ -300,7 +293,7 @@ overwrite_key(int cmd_index, int key_index)
        check_subcmd_length();
 
        /* repaint */
-       keydef_repaint();
+       keydef_paint();
 
        /* update key conflict flags */
        check_key_bindings(cmds, NULL, 0);
@@ -440,7 +433,7 @@ keydef_cmd(gcc_unused struct mpdclient *c, command_t cmd)
                return false;
 
        if (list_window_cmd(lw, cmd)) {
-               keydef_repaint();
+               keydef_paint();
                return true;
        }
 
@@ -490,7 +483,7 @@ keydef_cmd(gcc_unused struct mpdclient *c, command_t cmd)
        case CMD_LIST_FIND_NEXT:
        case CMD_LIST_RFIND_NEXT:
                screen_find(lw, cmd, list_callback, NULL);
-               keydef_repaint();
+               keydef_paint();
                return true;
 
        default:
index a195fd7dd62312139be2d3edba6419c179c0563b..b937e79bc3792ca16030d766178989d746faec9c 100644 (file)
@@ -453,7 +453,7 @@ lyrics_cmd(struct mpdclient *c, command_t cmd)
        case CMD_LYRICS_UPDATE:
                if (c->song != NULL) {
                        screen_lyrics_load(c->song);
-                       screen_text_repaint(&text);
+                       screen_text_paint(&text);
                }
                return true;
        case CMD_EDIT:
index ce8fdc60b9d2c615e3e05e683c3f571fca5e0175..b2c9590afec535359b57ed9caf0b3215dc2ec0bd 100644 (file)
@@ -34,16 +34,6 @@ static struct list_window *lw;
 
 static GPtrArray *mpd_outputs = NULL;
 
-static void
-outputs_paint(void);
-
-static void
-outputs_repaint(void)
-{
-       outputs_paint();
-       wrefresh(lw->w);
-}
-
 static bool
 toggle_output(struct mpdclient *c, unsigned int output_index)
 {
@@ -201,7 +191,7 @@ screen_outputs_update(struct mpdclient *c)
        if (c->events & MPD_IDLE_OUTPUT) {
                clear_outputs_list();
                fill_outputs_list(c);
-               outputs_repaint();
+               outputs_paint();
        }
 }
 
@@ -211,7 +201,7 @@ outputs_cmd(struct mpdclient *c, command_t cmd)
        assert(mpd_outputs != NULL);
 
        if (list_window_cmd(lw, cmd)) {
-               outputs_repaint();
+               outputs_paint();
                return true;
        }
 
@@ -223,7 +213,7 @@ outputs_cmd(struct mpdclient *c, command_t cmd)
        case CMD_SCREEN_UPDATE:
                clear_outputs_list();
                fill_outputs_list(c);
-               outputs_repaint();
+               outputs_paint();
                return true;
 
        default:
index d3624d1f544a61e446f2a6344e1622a8e8e11e83..5b3b5f74cf005528e11d90df42715fd71da55267 100644 (file)
@@ -548,7 +548,7 @@ screen_queue_update(struct mpdclient *c)
            c->events & MPD_IDLE_QUEUE)
                /* the queue or the current song has changed, we must
                   paint the new version */
-               screen_queue_repaint();
+               screen_queue_paint();
 }
 
 #ifdef HAVE_GETMOUSE
@@ -559,7 +559,7 @@ handle_mouse_event(struct mpdclient *c)
        int row;
        if (screen_get_mouse_event(c, &bstate, &row) ||
            list_window_mouse(lw, bstate, row)) {
-               screen_queue_repaint();
+               screen_queue_paint();
                return true;
        }
 
@@ -593,7 +593,7 @@ handle_mouse_event(struct mpdclient *c)
        }
 
        screen_queue_save_selection();
-       screen_queue_repaint();
+       screen_queue_paint();
 
        return true;
 }
@@ -619,20 +619,20 @@ screen_queue_cmd(struct mpdclient *c, command_t cmd)
 
        if (list_window_cmd(lw, cmd)) {
                screen_queue_save_selection();
-               screen_queue_repaint();
+               screen_queue_paint();
                return true;
        }
 
        switch(cmd) {
        case CMD_SCREEN_UPDATE:
                center_playing_item(c->status, prev_cmd == CMD_SCREEN_UPDATE);
-               screen_queue_repaint();
+               screen_queue_paint();
                return false;
        case CMD_SELECT_PLAYING:
                list_window_set_cursor(lw, playlist_get_index(&c->playlist,
                                                              c->song));
                screen_queue_save_selection();
-               screen_queue_repaint();
+               screen_queue_paint();
                return true;
 
        case CMD_LIST_FIND:
@@ -641,12 +641,12 @@ screen_queue_cmd(struct mpdclient *c, command_t cmd)
        case CMD_LIST_RFIND_NEXT:
                screen_find(lw, cmd, screen_queue_lw_callback, NULL);
                screen_queue_save_selection();
-               screen_queue_repaint();
+               screen_queue_paint();
                return true;
        case CMD_LIST_JUMP:
                screen_jump(lw, screen_queue_lw_callback, NULL, NULL, NULL);
                screen_queue_save_selection();
-               screen_queue_repaint();
+               screen_queue_paint();
                return true;
 
 #ifdef HAVE_GETMOUSE
index 90e075fe96c95d2da9469a74c5bb5ac421d0b997..1465602ed2537fe49178acebb64cf99f2504c2ca 100644 (file)
@@ -112,16 +112,6 @@ lw_search_help_callback(unsigned idx, gcc_unused void *data)
        return help_text[idx];
 }
 
-static void
-screen_search_paint(void);
-
-static void
-search_repaint(void)
-{
-       screen_search_paint();
-       wrefresh(browser.lw->w);
-}
-
 /* sanity check search mode value */
 static void
 search_check_mode(void)
@@ -427,7 +417,7 @@ screen_search_update(struct mpdclient *c)
 {
        if (browser.filelist != NULL && c->events & MPD_IDLE_QUEUE) {
                screen_browser_sync_highlights(browser.filelist, &c->playlist);
-               search_repaint();
+               screen_search_paint();
        }
 }
 
@@ -444,18 +434,18 @@ screen_search_cmd(struct mpdclient *c, command_t cmd)
                /* fall through */
        case CMD_SCREEN_UPDATE:
                screen_search_reload(c);
-               search_repaint();
+               screen_search_paint();
                return true;
 
        case CMD_SCREEN_SEARCH:
                search_new(c);
-               search_repaint();
+               screen_search_paint();
                return true;
 
        case CMD_CLEAR:
                search_clear(true);
                list_window_reset(browser.lw);
-               search_repaint();
+               screen_search_paint();
                return true;
 
        default:
@@ -465,7 +455,7 @@ screen_search_cmd(struct mpdclient *c, command_t cmd)
        if (browser.filelist != NULL &&
            browser_cmd(&browser, c, cmd)) {
                if (screen_is_visible(&screen_search))
-                       search_repaint();
+                       screen_search_paint();
                return true;
        }
 
index c6d7d801e47299c3413079bc60577898d704f25f..1463ec6cd59a8289256c42ff558adc18968c8fd0 100644 (file)
@@ -112,19 +112,6 @@ screen_song_clear(void)
        }
 }
 
-static void
-screen_song_paint(void);
-
-/**
- * Repaint and update the screen.
- */
-static void
-screen_song_repaint(void)
-{
-       screen_song_paint();
-       wrefresh(lw->w);
-}
-
 static const char *
 screen_song_list_callback(unsigned idx, gcc_unused void *data)
 {
@@ -459,14 +446,14 @@ screen_song_update(struct mpdclient *c)
                mpdclient_handle_error(c);
 
        list_window_set_length(lw, current.lines->len);
-       screen_song_repaint();
+       screen_song_paint();
 }
 
 static bool
 screen_song_cmd(struct mpdclient *c, command_t cmd)
 {
        if (list_window_scroll_cmd(lw, cmd)) {
-               screen_song_repaint();
+               screen_song_paint();
                return true;
        }
 
@@ -512,7 +499,7 @@ screen_song_cmd(struct mpdclient *c, command_t cmd)
        if (screen_find(lw, cmd, screen_song_list_callback, NULL)) {
                /* center the row */
                list_window_center(lw, lw->selected);
-               screen_song_repaint();
+               screen_song_paint();
                return true;
        }