diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-12-25 12:41:08 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-12-25 12:41:08 +0000 |
commit | bc13c3bffe0537f232a3a8a5b05e0ba18b77d7b8 (patch) | |
tree | fd2d4bd440cf338a549fb0b91cd2f91589a8a698 | |
parent | [w3m-dev 02721] (diff) | |
download | w3m-bc13c3bffe0537f232a3a8a5b05e0ba18b77d7b8.tar.gz w3m-bc13c3bffe0537f232a3a8a5b05e0ba18b77d7b8.zip |
[w3m-dev 02723] cleanup resizing
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | main.c | 62 | ||||
-rw-r--r-- | proto.h | 3 | ||||
-rw-r--r-- | terms.c | 5 |
4 files changed, 45 insertions, 40 deletions
@@ -1,3 +1,16 @@ +2001-12-25 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 02723] cleanup resizing + * main.c (resized): renamed to need_resize_screen + * main.c (need_resize_screen): added + * main.c (resize_hook): prototype here + * main.c (resize_handler): ditto + * main.c (MAIN): move signal initialization + * main.c (MAIN): remove duplicate signal initialization + * main.c (resize_screen): added + * proto.h (resize_hook): deleted + * terms.c (mouse_init): remove signal + 2001-12-25 Fumitoshi UKAI <ukai@debian.or.jp> * [w3m-dev 02721] @@ -1487,4 +1500,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.168 2001/12/25 09:59:38 ukai Exp $ +$Id: ChangeLog,v 1.169 2001/12/25 12:41:08 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.45 2001/12/25 09:59:39 ukai Exp $ */ +/* $Id: main.c,v 1.46 2001/12/25 12:41:08 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -46,8 +46,10 @@ static MySignalHandler SigAlarm(SIGNAL_ARG); #endif #ifdef SIGWINCH -static int resized = 0; -MySignalHandler resize_handler(SIGNAL_ARG); +static int need_resize_screen = FALSE; +static MySignalHandler resize_hook(SIGNAL_ARG); +static MySignalHandler resize_handler(SIGNAL_ARG); +static void resize_screen(void); #endif #ifdef USE_MARK @@ -673,18 +675,6 @@ MAIN(int argc, char **argv, char **envp) COLS = 80; } - if (isatty(1) && !w3m_dump) { -#ifdef SIGWINCH - signal(SIGWINCH, resize_hook); -#else /* not SIGWINCH */ - setlinescols(); - setupscreen(); -#endif /* not SIGWINCH */ - } -#ifdef SIGCHLD - signal(SIGCHLD, sig_chld); -#endif - #ifdef USE_BINMODE_STREAM setmode(fileno(stdout), O_BINARY); #endif @@ -697,7 +687,17 @@ MAIN(int argc, char **argv, char **envp) CurrentMenuData = NULL; #endif /* MENU */ fmInit(); +#ifdef SIGWINCH + signal(SIGWINCH, resize_hook); +#else /* not SIGWINCH */ + setlinescols(); + setupscreen(); +#endif /* not SIGWINCH */ } +#ifdef SIGCHLD + signal(SIGCHLD, sig_chld); +#endif + orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc); err_msg = Strnew(); if (load_argc == 0) { @@ -895,13 +895,6 @@ MAIN(int argc, char **argv, char **envp) UseAutoDetect = TRUE; #endif -#ifdef SIGWINCH - signal(SIGWINCH, resize_hook); -#else /* not SIGWINCH */ - setlinescols(); - setupscreen(); -#endif /* not SIGWINCH */ - Currentbuf = Firstbuf; displayBuffer(Currentbuf, B_NORMAL); if (line_str) { @@ -942,12 +935,9 @@ MAIN(int argc, char **argv, char **envp) } #endif #ifdef SIGWINCH - if (resized) { - resized = 0; - setlinescols(); - setupscreen(); - if (Currentbuf) - displayBuffer(Currentbuf, B_FORCE_REDRAW); + if (need_resize_screen) { + need_resize_screen = FALSE; + resize_screen(); } signal(SIGWINCH, resize_handler); #endif @@ -1179,23 +1169,29 @@ intTrap(SIGNAL_ARG) } #ifdef SIGWINCH -MySignalHandler +static MySignalHandler resize_hook(SIGNAL_ARG) { - resized = 1; + need_resize_screen = TRUE; signal(SIGWINCH, resize_hook); SIGNAL_RETURN; } -MySignalHandler +static MySignalHandler resize_handler(SIGNAL_ARG) { + resize_screen(); + signal(SIGWINCH, resize_handler); + SIGNAL_RETURN; +} + +static void +resize_screen(void) +{ setlinescols(); setupscreen(); if (Currentbuf) displayBuffer(Currentbuf, B_FORCE_REDRAW); - signal(SIGWINCH, resize_handler); - SIGNAL_RETURN; } #endif /* SIGWINCH */ @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.17 2001/12/10 17:02:44 ukai Exp $ */ +/* $Id: proto.h,v 1.18 2001/12/25 12:41:08 ukai Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -9,7 +9,6 @@ extern int main(int argc, char **argv, char **envp); extern void nulcmd(void); extern void pushEvent(int event, void *user_data); extern MySignalHandler intTrap(SIGNAL_ARG); -extern MySignalHandler resize_hook(SIGNAL_ARG); extern void pgFore(void); extern void pgBack(void); extern void lup1(void); @@ -1,4 +1,4 @@ -/* $Id: terms.c,v 1.25 2001/12/17 15:39:32 ukai Exp $ */ +/* $Id: terms.c,v 1.26 2001/12/25 12:41:08 ukai Exp $ */ /* * An original curses library for EUC-kanji by Akinori ITO, December 1989 * revised by Akinori ITO, January 1995 @@ -2033,9 +2033,6 @@ mouse_init() if (is_xterm) { XTERM_ON; } -#ifdef SIGWINCH - signal(SIGWINCH, resize_hook); -#endif mouseActive = 1; } |