From 50a074ed227f11dc8891883b96e41d6d2f8ee6f5 Mon Sep 17 00:00:00 2001 From: jfreegman Date: Sun, 21 Nov 2021 20:16:02 -0500 Subject: [PATCH] Remove some unnecessary calls to flag_interface_refresh() --- src/line_info.c | 6 ++---- src/toxic.c | 1 + src/windows.c | 6 ++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/line_info.c b/src/line_info.c index dc4d59c..ae49cd5 100644 --- a/src/line_info.c +++ b/src/line_info.c @@ -448,8 +448,6 @@ int line_info_add(ToxWindow *self, bool show_timestamp, const char *name1, const hst->queue[hst->queue_size++] = new_line; - flag_interface_refresh(); - return new_line->id; } @@ -475,8 +473,6 @@ static void line_info_check_queue(ToxWindow *self) if (!self->scroll_pause) { line_info_reset_start(self, hst); } - - flag_interface_refresh(); } void line_info_print(ToxWindow *self) @@ -703,6 +699,8 @@ void line_info_print(ToxWindow *self) line = line->next; } + flag_interface_refresh(); + /* keep calling until queue is empty */ if (hst->queue_size > 0) { line_info_print(self); diff --git a/src/toxic.c b/src/toxic.c index 45e678e..efefcc7 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -1642,6 +1642,7 @@ int main(int argc, char **argv) pthread_mutex_lock(&Winthread.lock); print_init_messages(prompt); + flag_interface_refresh(); pthread_mutex_unlock(&Winthread.lock); cleanup_init_messages(); diff --git a/src/windows.c b/src/windows.c index f18e34d..3303be3 100644 --- a/src/windows.c +++ b/src/windows.c @@ -433,7 +433,7 @@ void set_active_window_index(uint8_t index) /* Displays the next window if `ch` is equal to the next window key binding. * Otherwise displays the previous window. */ -void set_next_window(int ch) +static void set_next_window(int ch) { uint8_t index = 0; @@ -456,8 +456,6 @@ void set_next_window(int ch) } set_active_window_index(index); - - flag_interface_refresh(); } /* Deletes window w and cleans up */ @@ -955,7 +953,7 @@ size_t get_num_active_windows_type(WINDOW_TYPE type) /* destroys all chat and conference windows (should only be called on shutdown) */ void kill_all_windows(Tox *m) { - for (uint8_t i = 2; i < MAX_WINDOWS_NUM; ++i) { + for (size_t i = 2; i < MAX_WINDOWS_NUM; ++i) { ToxWindow *w = windows[i]; if (w == NULL) {