aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2001-12-25 12:41:08 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2001-12-25 12:41:08 +0000
commitbc13c3bffe0537f232a3a8a5b05e0ba18b77d7b8 (patch)
treefd2d4bd440cf338a549fb0b91cd2f91589a8a698
parent[w3m-dev 02721] (diff)
downloadw3m-bc13c3bffe0537f232a3a8a5b05e0ba18b77d7b8.tar.gz
w3m-bc13c3bffe0537f232a3a8a5b05e0ba18b77d7b8.zip
[w3m-dev 02723] cleanup resizing
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r--ChangeLog15
-rw-r--r--main.c62
-rw-r--r--proto.h3
-rw-r--r--terms.c5
4 files changed, 45 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index bf49b03..f931cd5 100644
--- 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]
@@ -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 $
diff --git a/main.c b/main.c
index 2f79a01..918907b 100644
--- a/main.c
+++ b/main.c
@@ -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 */
diff --git a/proto.h b/proto.h
index 1ca9753..e53e806 100644
--- a/proto.h
+++ b/proto.h
@@ -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);
diff --git a/terms.c b/terms.c
index 302b592..3ce3ef8 100644
--- a/terms.c
+++ b/terms.c
@@ -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;
}