aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2001-11-20 08:20:56 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2001-11-20 08:20:56 +0000
commitc9154ec566b4b43d6ad075019442c0117193a2bc (patch)
treec32b19661cfd9fa05aee350c495a9fea669658eb
parentremove gcc warnings (diff)
downloadw3m-c9154ec566b4b43d6ad075019442c0117193a2bc.tar.gz
w3m-c9154ec566b4b43d6ad075019442c0117193a2bc.zip
[w3m-dev 02449] reimplemented meta refresh support
From: Tsutomu Okada <okada@furuno.co.jp>
Diffstat (limited to '')
-rw-r--r--ChangeLog21
-rw-r--r--file.c15
-rw-r--r--fm.h13
-rw-r--r--main.c50
-rw-r--r--proto.h3
5 files changed, 78 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index dddb20a..c5a9630 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2001-11-20 Tsutomu Okada <okada@furuno.co.jp>
+
+ * file.c (HTMLtagproc1): reimplement meta refresh with
+ setAlarmEvent()
+
+ * fm.h: put back alarm related variables to main.c
+ add alarm related status flags
+
+ * main.c: put back alarm related variables from fm.h
+ alarm_once was renamed alarm_status
+ add alarm_buffer and setAlarmEvent()
+
+ * main.c (MAIN): cancel the alarm event if the buffer was
+ changed
+
+ * main.c (SigAlarm): ditto
+
+ * main.c (setAlarm): use setAlarmEvent()
+
+ * proto.h: add setAlarmEvent()
+
2001-11-20 Fumitoshi UKAI <ukai@debian.or.jp>
* w3mhelperpanel.c (extractMailcapEntry): remove unused variables
diff --git a/file.c b/file.c
index b755e24..a015176 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.7 2001/11/16 22:02:00 ukai Exp $ */
+/* $Id: file.c,v 1.8 2001/11/20 08:20:56 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -3579,13 +3579,18 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
}
#ifdef USE_ALARM
else if (!is_redisplay && refresh > 0 && MetaRefresh) {
- alarm_sec = refresh;
- alarm_once = TRUE;
- alarm_event.cmd = FUNCNAME_goURL;
- alarm_event.user_data = s_tmp->ptr;
+ setAlarmEvent(refresh, AL_IMPLICIT, FUNCNAME_goURL, s_tmp->ptr);
}
#endif
}
+#ifdef USE_ALARM
+ else if (!is_redisplay && refresh > 0 && MetaRefresh) {
+ tmp = Sprintf("Refresh (%d sec)", refresh);
+ push_str(obuf, 0, tmp, PC_ASCII);
+ flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ setAlarmEvent(refresh, AL_IMPLICIT, FUNCNAME_reload, NULL);
+ }
+#endif
}
return 1;
case HTML_BASE:
diff --git a/fm.h b/fm.h
index bfc897e..13cbfe6 100644
--- a/fm.h
+++ b/fm.h
@@ -1,4 +1,4 @@
-/* $Id: fm.h,v 1.5 2001/11/16 22:02:00 ukai Exp $ */
+/* $Id: fm.h,v 1.6 2001/11/20 08:20:56 ukai Exp $ */
/*
* w3m: WWW wo Miru utility
*
@@ -849,14 +849,11 @@ int backend( void );
extern void deleteFiles(void);
void w3m_exit( int i );
-typedef struct {
- int cmd;
- void *user_data;
-} Event;
#ifdef USE_ALARM
-global int alarm_sec init(0);
-global short alarm_once init(0);
-global Event alarm_event;
+#define AL_UNSET 0
+#define AL_EXPLICIT 1
+#define AL_IMPLICIT 2
+#define AL_IMPLICIT_DONE 3
#endif
/*
diff --git a/main.c b/main.c
index 3d62f32..55e6e19 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.9 2001/11/20 04:11:16 ukai Exp $ */
+/* $Id: main.c,v 1.10 2001/11/20 08:20:56 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -32,11 +32,19 @@ Hist *URLHist;
Hist *ShellHist;
Hist *TextHist;
+typedef struct {
+ int cmd;
+ void *user_data;
+} Event;
#define N_EVENT_QUEUE 10
static Event eventQueue[N_EVENT_QUEUE];
static int n_event_queue;
#ifdef USE_ALARM
+static int alarm_sec = 0;
+static short alarm_status = AL_UNSET;
+static Buffer *alarm_buffer;
+static Event alarm_event;
static MySignalHandler SigAlarm(SIGNAL_ARG);
#endif
@@ -845,6 +853,13 @@ MAIN(int argc, char **argv, char **envp)
mouse_active();
#endif /* MOUSE */
#ifdef USE_ALARM
+ if (alarm_status == AL_IMPLICIT) {
+ alarm_buffer = Currentbuf;
+ alarm_status = AL_IMPLICIT_DONE;
+ } else if (alarm_status == AL_IMPLICIT_DONE && alarm_buffer != Currentbuf) {
+ alarm_sec = 0;
+ alarm_status = AL_UNSET;
+ }
if (alarm_sec > 0) {
signal(SIGALRM, SigAlarm);
alarm(alarm_sec);
@@ -4609,10 +4624,17 @@ SigAlarm(SIGNAL_ARG)
#endif
w3mFuncList[alarm_event.cmd].func();
onA();
- if (alarm_once)
+ if (alarm_status == AL_IMPLICIT) {
+ alarm_buffer = Currentbuf;
+ alarm_status = AL_IMPLICIT_DONE;
+ } else if (alarm_status == AL_IMPLICIT_DONE && alarm_buffer != Currentbuf) {
alarm_sec = 0;
- signal(SIGALRM, SigAlarm);
- alarm(alarm_sec);
+ alarm_status = AL_UNSET;
+ }
+ if (alarm_sec > 0) {
+ signal(SIGALRM, SigAlarm);
+ alarm(alarm_sec);
+ }
}
SIGNAL_RETURN;
}
@@ -4639,15 +4661,23 @@ setAlarm(void)
cmd = getFuncList(getWord(&data), w3mFuncList, w3mNFuncList);
}
if (cmd >= 0) {
- alarm_sec = sec;
- alarm_once = FALSE;
- alarm_event.cmd = cmd;
- alarm_event.user_data = getQWord(&data);
- signal(SIGALRM, SigAlarm);
- alarm(alarm_sec);
+ setAlarmEvent(sec, AL_EXPLICIT, cmd, getQWord(&data));
} else {
alarm_sec = 0;
}
displayBuffer(Currentbuf, B_NORMAL);
}
+
+void
+setAlarmEvent(int sec, short status, int cmd, void *data)
+{
+ if (status == AL_EXPLICIT || (status == AL_IMPLICIT && alarm_status != AL_EXPLICIT)) {
+ alarm_sec = sec;
+ alarm_status = status;
+ alarm_event.cmd = cmd;
+ alarm_event.user_data = data;
+ signal(SIGALRM, SigAlarm);
+ alarm(alarm_sec);
+ }
+}
#endif
diff --git a/proto.h b/proto.h
index 6801c55..651bb87 100644
--- a/proto.h
+++ b/proto.h
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.4 2001/11/20 04:11:16 ukai Exp $ */
+/* $Id: proto.h,v 1.5 2001/11/20 08:20:56 ukai Exp $ */
/*
* This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended.
@@ -100,6 +100,7 @@ extern void linkbrz(void);
extern void curlno(void);
#ifdef USE_ALARM
extern void setAlarm(void);
+extern void setAlarmEvent(int sec, short status, int cmd, void *data);
#else
#define setAlarm nulcmd
#endif