1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

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
This commit is contained in:
Timo Sirainen 2001-08-28 12:24:46 +00:00 committed by cras
parent d1e0a0f44f
commit 6597d2d1c6

View File

@ -22,6 +22,7 @@
#include "signals.h" #include "signals.h"
#include "misc.h" #include "misc.h"
#include "settings.h" #include "settings.h"
#include "commands.h"
#include "screen.h" #include "screen.h"
#include "gui-readline.h" #include "gui-readline.h"
@ -65,8 +66,10 @@ static int init_screen_int(void);
static void deinit_screen_int(void); static void deinit_screen_int(void);
#ifdef SIGWINCH #ifdef SIGWINCH
static int resize_timeout_tag;
#endif
static int resize_timeout_tag, resize_needed; static int resize_needed;
static int resize_timeout(void) static int resize_timeout(void)
{ {
@ -108,12 +111,19 @@ static int resize_timeout(void)
return TRUE; return TRUE;
} }
#ifdef SIGWINCH
static void sig_winch(int p) static void sig_winch(int p)
{ {
resize_needed = TRUE; resize_needed = TRUE;
} }
#endif #endif
static void cmd_resize(void)
{
resize_needed = TRUE;
resize_timeout();
}
static void read_settings(void) static void read_settings(void)
{ {
int old_colors = use_colors; int old_colors = use_colors;
@ -210,6 +220,7 @@ int init_screen(void)
signal_add("beep", (SIGNAL_FUNC) beep); signal_add("beep", (SIGNAL_FUNC) beep);
signal_add("setup changed", (SIGNAL_FUNC) read_settings); signal_add("setup changed", (SIGNAL_FUNC) read_settings);
command_bind("resize", NULL, (SIGNAL_FUNC) cmd_resize);
#ifdef SIGWINCH #ifdef SIGWINCH
resize_timeout_tag = g_timeout_add(RESIZE_TIMEOUT, resize_timeout_tag = g_timeout_add(RESIZE_TIMEOUT,
@ -227,6 +238,7 @@ void deinit_screen(void)
g_source_remove(resize_timeout_tag); g_source_remove(resize_timeout_tag);
#endif #endif
command_unbind("resize", (SIGNAL_FUNC) cmd_resize);
signal_remove("beep", (SIGNAL_FUNC) beep); signal_remove("beep", (SIGNAL_FUNC) beep);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings); signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
} }