From 2d5758c66089501bd41015c718dfb3eeb934373f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 10 Oct 2009 17:45:19 +0200 Subject: [PATCH] list_window: added function list_window_resize() Call this function instead of manually setting the "cols" and "rows" attributes. --- src/list_window.c | 7 +++++++ src/list_window.h | 3 +++ src/screen_artist.c | 3 +-- src/screen_file.c | 3 +-- src/screen_help.c | 3 +-- src/screen_keydef.c | 3 +-- src/screen_outputs.c | 3 +-- src/screen_play.c | 3 +-- src/screen_search.c | 3 +-- src/screen_song.c | 3 +-- src/screen_text.h | 3 +-- 11 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/list_window.c b/src/list_window.c index d7da155..ba25429 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -111,6 +111,13 @@ list_window_check_selected(struct list_window *lw) } } +void +list_window_resize(struct list_window *lw, unsigned width, unsigned height) +{ + lw->cols = width; + lw->rows = height; +} + void list_window_set_length(struct list_window *lw, unsigned length) { diff --git a/src/list_window.h b/src/list_window.h index 99f7028..edb3e26 100644 --- a/src/list_window.h +++ b/src/list_window.h @@ -66,6 +66,9 @@ void list_window_free(struct list_window *lw); /* reset a list window (selected=0, start=0) */ void list_window_reset(struct list_window *lw); +void +list_window_resize(struct list_window *lw, unsigned width, unsigned height); + void list_window_set_length(struct list_window *lw, unsigned length); diff --git a/src/screen_artist.c b/src/screen_artist.c index cb6629a..a1ba469 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -313,8 +313,7 @@ screen_artist_open(struct mpdclient *c) static void screen_artist_resize(int cols, int rows) { - browser.lw->cols = cols; - browser.lw->rows = rows; + list_window_resize(browser.lw, cols, rows); } static void diff --git a/src/screen_file.c b/src/screen_file.c index 8e1cf5b..7fae5f2 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -265,8 +265,7 @@ screen_file_init(WINDOW *w, int cols, int rows) static void screen_file_resize(int cols, int rows) { - browser.lw->cols = cols; - browser.lw->rows = rows; + list_window_resize(browser.lw, cols, rows); } static void diff --git a/src/screen_help.c b/src/screen_help.c index cf2a40f..316231b 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -229,8 +229,7 @@ help_init(WINDOW *w, int cols, int rows) static void help_resize(int cols, int rows) { - lw->cols = cols; - lw->rows = rows; + list_window_resize(lw, cols, rows); } static void diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 71efe48..cea71b4 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -235,8 +235,7 @@ keydef_init(WINDOW *w, int cols, int rows) static void keydef_resize(int cols, int rows) { - lw->cols = cols; - lw->rows = rows; + list_window_resize(lw, cols, rows); } static void diff --git a/src/screen_outputs.c b/src/screen_outputs.c index a1ee33d..39d67d3 100644 --- a/src/screen_outputs.c +++ b/src/screen_outputs.c @@ -154,8 +154,7 @@ outputs_init(WINDOW *w, int cols, int rows) static void outputs_resize(int cols, int rows) { - lw->cols = cols; - lw->rows = rows; + list_window_resize(lw, cols, rows); } static void diff --git a/src/screen_play.c b/src/screen_play.c index 37825e6..66649b2 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -522,8 +522,7 @@ screen_playlist_close(void) static void screen_playlist_resize(int cols, int rows) { - lw->cols = cols; - lw->rows = rows; + list_window_resize(lw, cols, rows); } diff --git a/src/screen_search.c b/src/screen_search.c index 24a6a91..7c35fd2 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -391,8 +391,7 @@ screen_search_open(G_GNUC_UNUSED struct mpdclient *c) static void screen_search_resize(int cols, int rows) { - browser.lw->cols = cols; - browser.lw->rows = rows; + list_window_resize(browser.lw, cols, rows); } static void diff --git a/src/screen_song.c b/src/screen_song.c index 82e4cd4..121599e 100644 --- a/src/screen_song.c +++ b/src/screen_song.c @@ -115,8 +115,7 @@ screen_song_exit(void) static void screen_song_resize(int cols, int rows) { - lw->cols = cols; - lw->rows = rows; + list_window_resize(lw, cols, rows); } static const char * diff --git a/src/screen_text.h b/src/screen_text.h index a64b858..5358feb 100644 --- a/src/screen_text.h +++ b/src/screen_text.h @@ -56,8 +56,7 @@ screen_text_deinit(struct screen_text *text) static inline void screen_text_resize(struct screen_text *text, int cols, int rows) { - text->lw->cols = cols; - text->lw->rows = rows; + list_window_resize(text->lw, cols, rows); } static inline bool -- 2.30.2