commit ded172c6a5bc853908d2330f387ed5861bf541aa
parent 7b54cc24044728f15be56799a09cad1581cb0605
Author: ukai <ukai>
Date: Tue, 24 Dec 2002 17:28:48 +0000
[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>
Diffstat:
3 files changed, 46 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -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
diff --git a/main.c b/main.c
@@ -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);
diff --git a/proto.h b/proto.h
@@ -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);