[w3m-dev 02723] cleanup resizing

From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2001-12-25 12:41:08 +00:00
parent 0693cb0572
commit bc13c3bffe
4 changed files with 45 additions and 40 deletions
+14 -1
View File
@@ -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> 2001-12-25 Fumitoshi UKAI <ukai@debian.or.jp>
* [w3m-dev 02721] * [w3m-dev 02721]
@@ -1487,4 +1500,4 @@
* release-0-2-1 * release-0-2-1
* import w3m-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 $
+29 -33
View File
@@ -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 #define MAINPROGRAM
#include "fm.h" #include "fm.h"
#include <signal.h> #include <signal.h>
@@ -46,8 +46,10 @@ static MySignalHandler SigAlarm(SIGNAL_ARG);
#endif #endif
#ifdef SIGWINCH #ifdef SIGWINCH
static int resized = 0; static int need_resize_screen = FALSE;
MySignalHandler resize_handler(SIGNAL_ARG); static MySignalHandler resize_hook(SIGNAL_ARG);
static MySignalHandler resize_handler(SIGNAL_ARG);
static void resize_screen(void);
#endif #endif
#ifdef USE_MARK #ifdef USE_MARK
@@ -673,18 +675,6 @@ MAIN(int argc, char **argv, char **envp)
COLS = 80; 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 #ifdef USE_BINMODE_STREAM
setmode(fileno(stdout), O_BINARY); setmode(fileno(stdout), O_BINARY);
#endif #endif
@@ -697,7 +687,17 @@ MAIN(int argc, char **argv, char **envp)
CurrentMenuData = NULL; CurrentMenuData = NULL;
#endif /* MENU */ #endif /* MENU */
fmInit(); 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); orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc);
err_msg = Strnew(); err_msg = Strnew();
if (load_argc == 0) { if (load_argc == 0) {
@@ -895,13 +895,6 @@ MAIN(int argc, char **argv, char **envp)
UseAutoDetect = TRUE; UseAutoDetect = TRUE;
#endif #endif
#ifdef SIGWINCH
signal(SIGWINCH, resize_hook);
#else /* not SIGWINCH */
setlinescols();
setupscreen();
#endif /* not SIGWINCH */
Currentbuf = Firstbuf; Currentbuf = Firstbuf;
displayBuffer(Currentbuf, B_NORMAL); displayBuffer(Currentbuf, B_NORMAL);
if (line_str) { if (line_str) {
@@ -942,12 +935,9 @@ MAIN(int argc, char **argv, char **envp)
} }
#endif #endif
#ifdef SIGWINCH #ifdef SIGWINCH
if (resized) { if (need_resize_screen) {
resized = 0; need_resize_screen = FALSE;
setlinescols(); resize_screen();
setupscreen();
if (Currentbuf)
displayBuffer(Currentbuf, B_FORCE_REDRAW);
} }
signal(SIGWINCH, resize_handler); signal(SIGWINCH, resize_handler);
#endif #endif
@@ -1179,23 +1169,29 @@ intTrap(SIGNAL_ARG)
} }
#ifdef SIGWINCH #ifdef SIGWINCH
MySignalHandler static MySignalHandler
resize_hook(SIGNAL_ARG) resize_hook(SIGNAL_ARG)
{ {
resized = 1; need_resize_screen = TRUE;
signal(SIGWINCH, resize_hook); signal(SIGWINCH, resize_hook);
SIGNAL_RETURN; SIGNAL_RETURN;
} }
MySignalHandler static MySignalHandler
resize_handler(SIGNAL_ARG) resize_handler(SIGNAL_ARG)
{
resize_screen();
signal(SIGWINCH, resize_handler);
SIGNAL_RETURN;
}
static void
resize_screen(void)
{ {
setlinescols(); setlinescols();
setupscreen(); setupscreen();
if (Currentbuf) if (Currentbuf)
displayBuffer(Currentbuf, B_FORCE_REDRAW); displayBuffer(Currentbuf, B_FORCE_REDRAW);
signal(SIGWINCH, resize_handler);
SIGNAL_RETURN;
} }
#endif /* SIGWINCH */ #endif /* SIGWINCH */
+1 -2
View File
@@ -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. * This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended. * Manual editing not recommended.
@@ -9,7 +9,6 @@ extern int main(int argc, char **argv, char **envp);
extern void nulcmd(void); extern void nulcmd(void);
extern void pushEvent(int event, void *user_data); extern void pushEvent(int event, void *user_data);
extern MySignalHandler intTrap(SIGNAL_ARG); extern MySignalHandler intTrap(SIGNAL_ARG);
extern MySignalHandler resize_hook(SIGNAL_ARG);
extern void pgFore(void); extern void pgFore(void);
extern void pgBack(void); extern void pgBack(void);
extern void lup1(void); extern void lup1(void);
+1 -4
View File
@@ -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 * An original curses library for EUC-kanji by Akinori ITO, December 1989
* revised by Akinori ITO, January 1995 * revised by Akinori ITO, January 1995
@@ -2033,9 +2033,6 @@ mouse_init()
if (is_xterm) { if (is_xterm) {
XTERM_ON; XTERM_ON;
} }
#ifdef SIGWINCH
signal(SIGWINCH, resize_hook);
#endif
mouseActive = 1; mouseActive = 1;
} }