From: Max Kellermann Date: Mon, 20 Mar 2017 12:08:01 +0000 (+0100) Subject: screen_*: eliminate redundant wrefresh() calls X-Git-Tag: v0.26~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e52df3dd5be37471c4fceceb683479bd81bdec27;p=ncmpc.git screen_*: eliminate redundant wrefresh() calls This is already called by screen_refresh(). --- diff --git a/src/screen_artist.c b/src/screen_artist.c index 52b81d0..f8d50d0 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -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; } diff --git a/src/screen_file.c b/src/screen_file.c index af0dbd0..5399c85 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -42,16 +42,6 @@ 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: diff --git a/src/screen_help.c b/src/screen_help.c index 7497c11..c1a592f 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -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; } diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 31c3582..44b191c 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -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: diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index a195fd7..b937e79 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -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: diff --git a/src/screen_outputs.c b/src/screen_outputs.c index ce8fdc6..b2c9590 100644 --- a/src/screen_outputs.c +++ b/src/screen_outputs.c @@ -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: diff --git a/src/screen_queue.c b/src/screen_queue.c index d3624d1..5b3b5f7 100644 --- a/src/screen_queue.c +++ b/src/screen_queue.c @@ -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 diff --git a/src/screen_search.c b/src/screen_search.c index 90e075f..1465602 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -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; } diff --git a/src/screen_song.c b/src/screen_song.c index c6d7d80..1463ec6 100644 --- a/src/screen_song.c +++ b/src/screen_song.c @@ -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; }