From 6597d2d1c6804027ddd3fcf7ae1c05bc9a1a2e1f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 28 Aug 2001 12:24:46 +0000 Subject: [PATCH] Added command /RESIZE for resizing the terminal when SIGWINCH isn't supported. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1772 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/screen.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/fe-text/screen.c b/src/fe-text/screen.c index 600958e8..5d3e1f38 100644 --- a/src/fe-text/screen.c +++ b/src/fe-text/screen.c @@ -22,6 +22,7 @@ #include "signals.h" #include "misc.h" #include "settings.h" +#include "commands.h" #include "screen.h" #include "gui-readline.h" @@ -65,8 +66,10 @@ static int init_screen_int(void); static void deinit_screen_int(void); #ifdef SIGWINCH +static int resize_timeout_tag; +#endif -static int resize_timeout_tag, resize_needed; +static int resize_needed; static int resize_timeout(void) { @@ -108,12 +111,19 @@ static int resize_timeout(void) return TRUE; } +#ifdef SIGWINCH static void sig_winch(int p) { resize_needed = TRUE; } #endif +static void cmd_resize(void) +{ + resize_needed = TRUE; + resize_timeout(); +} + static void read_settings(void) { int old_colors = use_colors; @@ -210,6 +220,7 @@ int init_screen(void) signal_add("beep", (SIGNAL_FUNC) beep); signal_add("setup changed", (SIGNAL_FUNC) read_settings); + command_bind("resize", NULL, (SIGNAL_FUNC) cmd_resize); #ifdef SIGWINCH resize_timeout_tag = g_timeout_add(RESIZE_TIMEOUT, @@ -227,6 +238,7 @@ void deinit_screen(void) g_source_remove(resize_timeout_tag); #endif + command_unbind("resize", (SIGNAL_FUNC) cmd_resize); signal_remove("beep", (SIGNAL_FUNC) beep); signal_remove("setup changed", (SIGNAL_FUNC) read_settings); }