summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/wee-command.c2
-rw-r--r--src/core/wee-config.c4
-rw-r--r--src/gui/curses/gui-curses-main.c6
-rw-r--r--src/gui/curses/gui-curses-window.c12
-rw-r--r--src/gui/gtk/gui-gtk-window.c4
-rw-r--r--src/gui/gui-bar-window.c2
-rw-r--r--src/gui/gui-bar.c20
-rw-r--r--src/gui/gui-window.c13
-rw-r--r--src/gui/gui-window.h3
9 files changed, 42 insertions, 24 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index ea9c20db2..10295959c 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -3334,7 +3334,7 @@ command_window (void *data, struct t_gui_buffer *buffer,
/* refresh screen */
if (string_strcasecmp (argv[1], "refresh") == 0)
{
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (2);
return WEECHAT_RC_OK;
}
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 7fa206fe7..df2eb12bb 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -252,7 +252,7 @@ config_change_buffer_time_format (void *data, struct t_config_option *option)
gui_chat_time_length = util_get_time_length (CONFIG_STRING(config_look_buffer_time_format));
gui_chat_change_time_format ();
if (gui_ok)
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
/*
@@ -280,7 +280,7 @@ config_change_read_marker (void *data, struct t_config_option *option)
(void) data;
(void) option;
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
/*
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index 3736ed272..d31decd8f 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -234,7 +234,7 @@ gui_main_signal_sigwinch ()
gui_term_lines = new_height;
}
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
/*
@@ -251,7 +251,7 @@ gui_main_refreshs ()
/* refresh window if needed */
if (gui_window_refresh_needed)
{
- gui_window_refresh_screen ();
+ gui_window_refresh_screen ((gui_window_refresh_needed > 1) ? 1 : 0);
gui_window_refresh_needed = 0;
}
@@ -326,7 +326,7 @@ gui_main_loop ()
hook_fd_keyboard = hook_fd (NULL, STDIN_FILENO, 1, 0, 0,
&gui_keyboard_read_cb, NULL);
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
while (!weechat_quit)
{
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index 6d7dc0080..125e8560f 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -1073,7 +1073,7 @@ gui_window_resize (struct t_gui_window *window, int percentage)
1) < 0)
parent->split_pct = old_split_pct;
else
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
}
@@ -1322,15 +1322,19 @@ gui_window_switch_right (struct t_gui_window *window)
/*
* gui_window_refresh_screen: called when term size is modified
- * force == 1 when Ctrl+L is pressed
+ * full_refresh == 1 when Ctrl+L is pressed
*/
void
-gui_window_refresh_screen ()
+gui_window_refresh_screen (int full_refresh)
{
if (gui_ok)
{
- refresh ();
+ if (full_refresh)
+ {
+ endwin ();
+ refresh ();
+ }
gui_window_refresh_windows ();
}
}
diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c
index aee7b046d..627448c2e 100644
--- a/src/gui/gtk/gui-gtk-window.c
+++ b/src/gui/gtk/gui-gtk-window.c
@@ -778,8 +778,10 @@ gui_window_switch_right (struct t_gui_window *window)
*/
void
-gui_window_refresh_screen ()
+gui_window_refresh_screen (int full_refresh)
{
+ (void) full_refresh;
+
/* TODO: write this function for Gtk */
}
diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c
index a9687a7c6..e702ac60b 100644
--- a/src/gui/gui-bar-window.c
+++ b/src/gui/gui-bar-window.c
@@ -878,7 +878,7 @@ gui_bar_window_set_current_size (struct t_gui_bar_window *bar_window,
if (window)
window->refresh_needed = 1;
else
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
}
}
diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c
index 0f5c86b89..7c9f7895d 100644
--- a/src/gui/gui-bar.c
+++ b/src/gui/gui-bar.c
@@ -565,7 +565,7 @@ gui_bar_refresh (struct t_gui_bar *bar)
struct t_gui_window *ptr_win;
if (CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_TYPE]) == GUI_BAR_TYPE_ROOT)
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
else
{
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
@@ -627,7 +627,7 @@ gui_bar_apply_current_size (struct t_gui_bar *bar)
gui_bar_window_set_current_size (bar->bar_window,
NULL,
CONFIG_INTEGER(bar->options[GUI_BAR_OPTION_SIZE]));
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
else
{
@@ -759,7 +759,7 @@ gui_bar_config_change_hidden (void *data, struct t_config_option *option)
}
}
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
/*
@@ -815,7 +815,7 @@ gui_bar_config_change_priority (void *data, struct t_config_option *option)
}
}
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
/*
@@ -850,7 +850,7 @@ gui_bar_config_change_conditions (void *data, struct t_config_option *option)
}
}
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
/*
@@ -869,7 +869,7 @@ gui_bar_config_change_position (void *data, struct t_config_option *option)
if (ptr_bar && !CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
gui_bar_refresh (ptr_bar);
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
/*
@@ -888,7 +888,7 @@ gui_bar_config_change_filling (void *data, struct t_config_option *option)
if (ptr_bar && !CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
gui_bar_refresh (ptr_bar);
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
/*
@@ -987,7 +987,7 @@ gui_bar_config_change_size_max (void *data, struct t_config_option *option)
(void) data;
(void) option;
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
/*
@@ -1638,7 +1638,7 @@ gui_bar_new_with_options (const char *name,
{
/* create only one window for bar */
gui_bar_window_new (new_bar, NULL);
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
else
{
@@ -2214,7 +2214,7 @@ gui_bar_free (struct t_gui_bar *bar)
if (bar->bar_window)
{
gui_bar_window_free (bar->bar_window, NULL);
- gui_window_refresh_needed = 1;
+ gui_window_ask_refresh (1);
}
else
gui_bar_free_bar_windows (bar);
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index e1b19a5a9..31d68325b 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -54,7 +54,7 @@ int gui_init_ok = 0; /* = 1 if GUI is initialized*/
int gui_ok = 0; /* = 1 if GUI is ok */
/* (0 when size too small) */
int gui_window_refresh_needed = 0; /* = 1 if refresh needed */
-
+ /* = 2 for full refresh */
struct t_gui_window *gui_windows = NULL; /* first window */
struct t_gui_window *last_gui_window = NULL; /* last window */
struct t_gui_window *gui_current_window = NULL; /* current window */
@@ -63,6 +63,17 @@ struct t_gui_window_tree *gui_windows_tree = NULL; /* windows tree */
/*
+ * gui_window_ask_refresh: set "gui_window_refresh_needed" flag
+ */
+
+void
+gui_window_ask_refresh (int refresh)
+{
+ if (refresh > gui_window_refresh_needed)
+ gui_window_refresh_needed = refresh;
+}
+
+/*
* gui_window_tree_init: create first entry in windows tree
*/
diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h
index 222ac33a6..fce3221fe 100644
--- a/src/gui/gui-window.h
+++ b/src/gui/gui-window.h
@@ -103,6 +103,7 @@ extern struct t_gui_window *gui_current_window;
extern struct t_gui_window_tree *gui_windows_tree;
/* window functions */
+extern void gui_window_ask_refresh (int refresh);
extern int gui_window_tree_init (struct t_gui_window *window);
extern void gui_window_tree_node_to_leaf (struct t_gui_window_tree *node,
struct t_gui_window *window);
@@ -168,7 +169,7 @@ extern void gui_window_switch_up (struct t_gui_window *window);
extern void gui_window_switch_down (struct t_gui_window *window);
extern void gui_window_switch_left (struct t_gui_window *window);
extern void gui_window_switch_right (struct t_gui_window *window);
-extern void gui_window_refresh_screen ();
+extern void gui_window_refresh_screen (int full_refresh);
extern void gui_window_title_set ();
extern void gui_window_title_reset ();
extern void gui_window_objects_print_log (struct t_gui_window *window);