w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 1259e03a7800a7d64dfbdd0adb4217d3fcb6db10
parent 92c2f4059e0edbd55d909b59380c5f06f0ddcb7d
Author: ukai <ukai>
Date:   Tue, 25 Dec 2001 12:41:08 +0000

[w3m-dev 02723] cleanup resizing
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 13+++++++++++++
Mmain.c | 60++++++++++++++++++++++++++++--------------------------------
Mproto.h | 1-
Mterms.c | 3---
4 files changed, 41 insertions(+), 36 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -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] diff --git a/main.c b/main.c @@ -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 */ diff --git a/proto.h b/proto.h @@ -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); diff --git a/terms.c b/terms.c @@ -2033,9 +2033,6 @@ mouse_init() if (is_xterm) { XTERM_ON; } -#ifdef SIGWINCH - signal(SIGWINCH, resize_hook); -#endif mouseActive = 1; }