diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-12-24 17:28:48 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-12-24 17:28:48 +0000 |
commit | dfdc4f3cf2bb5750e49e746261cb47106ef5dfac (patch) | |
tree | 914776ae6d7302a9b2819cee15e176b3664d9292 | |
parent | fix indent (diff) | |
download | w3m-dfdc4f3cf2bb5750e49e746261cb47106ef5dfac.tar.gz w3m-dfdc4f3cf2bb5750e49e746261cb47106ef5dfac.zip |
[w3m-dev 03597] Re: meta refresh
* main.c (Event): next, linked list
(N_EVENT_QUEUE): deleted
(eventQueue): deleted
(n_event_queue): deleted
(CurrentEvent): added
(main): event processing, add CurrentEvent linked list
(pushEvent): add Event to CurrentEvent
(SigAlarm): Currentbuf->event
* proto.h (pushEvent): rename args
From: Hiroaki Shimotsu <shim@d5.bs1.fc.nec.co.jp>
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | main.c | 53 | ||||
-rw-r--r-- | proto.h | 4 |
3 files changed, 49 insertions, 23 deletions
@@ -1,3 +1,16 @@ +2002-12-25 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 03597] Re: meta refresh + * main.c (Event): next, linked list + (N_EVENT_QUEUE): deleted + (eventQueue): deleted + (n_event_queue): deleted + (CurrentEvent): added + (main): event processing, add CurrentEvent linked list + (pushEvent): add Event to CurrentEvent + (SigAlarm): Currentbuf->event + * proto.h (pushEvent): rename args + 2002-12-25 Hiroaki Shimotsu <shim@d5.bs1.fc.nec.co.jp> * [w3m-dev 03596] LIST @@ -6049,4 +6062,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.643 2002/12/24 17:24:05 ukai Exp $ +$Id: ChangeLog,v 1.644 2002/12/24 17:28:48 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.177 2002/12/24 17:20:47 ukai Exp $ */ +/* $Id: main.c,v 1.178 2002/12/24 17:28:48 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -33,13 +33,12 @@ Hist *URLHist; Hist *ShellHist; Hist *TextHist; -typedef struct { +typedef struct _Event { int cmd; - void *user_data; + void *data; + struct _Event *next; } Event; -#define N_EVENT_QUEUE 10 -static Event eventQueue[N_EVENT_QUEUE]; -static int n_event_queue; +static Event *CurrentEvent = NULL; #ifdef USE_ALARM static AlarmEvent DefaultAlarm = { @@ -986,17 +985,17 @@ main(int argc, char **argv, char **envp) gotoLine(Currentbuf, a->start.line); Currentbuf->pos = a->start.pos; _followForm(TRUE); + continue; } /* event processing */ - if (n_event_queue > 0) { - for (i = 0; i < n_event_queue; i++) { - CurrentKey = -1; - CurrentKeyData = NULL; - CurrentCmdData = (char *)eventQueue[i].user_data; - w3mFuncList[eventQueue[i].cmd].func(); - } + if (CurrentEvent) { + CurrentKey = -1; + CurrentKeyData = NULL; + CurrentCmdData = (char *)CurrentEvent->data; + w3mFuncList[CurrentEvent->cmd].func(); CurrentCmdData = NULL; - n_event_queue = 0; + CurrentEvent = CurrentEvent->next; + continue; } /* get keypress event */ #ifdef USE_ALARM @@ -1010,6 +1009,7 @@ main(int argc, char **argv, char **envp) CurrentCmdData = (char *)CurrentAlarm->data; w3mFuncList[CurrentAlarm->cmd].func(); CurrentCmdData = NULL; + continue; } } else @@ -1088,13 +1088,18 @@ keyPressEventProc(int c) } void -pushEvent(int event, void *user_data) +pushEvent(int cmd, void *data) { - if (n_event_queue < N_EVENT_QUEUE) { - eventQueue[n_event_queue].cmd = event; - eventQueue[n_event_queue].user_data = user_data; - n_event_queue++; - } + Event *event; + + event = New(Event); + event->cmd = cmd; + event->data = data; + event->next = NULL; + if (CurrentEvent) + CurrentEvent->next = event; + else + CurrentEvent = event; } static void @@ -5514,6 +5519,14 @@ SigAlarm(SIGNAL_ARG) CurrentAlarm->sec = 0; CurrentAlarm->status = AL_UNSET; } + if (Currentbuf->event) { + if (Currentbuf->event->status != AL_UNSET) + CurrentAlarm = Currentbuf->event; + else + Currentbuf->event = NULL; + } + if (!Currentbuf->event) + CurrentAlarm = &DefaultAlarm; if (CurrentAlarm->sec > 0) { signal(SIGALRM, SigAlarm); alarm(CurrentAlarm->sec); @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.73 2002/12/18 16:20:54 ukai Exp $ */ +/* $Id: proto.h,v 1.74 2002/12/24 17:28:49 ukai Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -7,7 +7,7 @@ */ extern int main(int argc, char **argv, char **envp); extern void nulcmd(void); -extern void pushEvent(int event, void *user_data); +extern void pushEvent(int cmd, void *data); extern MySignalHandler intTrap(SIGNAL_ARG); extern void pgFore(void); extern void pgBack(void); |