[w3m-dev 02449] reimplemented meta refresh support
From: Tsutomu Okada <okada@furuno.co.jp>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user