diff --git a/WINGs/Extras/test.c b/WINGs/Extras/test.c index 17ade172..af341674 100644 --- a/WINGs/Extras/test.c +++ b/WINGs/Extras/test.c @@ -80,7 +80,7 @@ main(int argc, char **argv) WMInitializeApplication("test", &argc, argv); - scr = WMOpenScreen(); + scr = WMOpenScreen(NULL); win = WMCreateWindow(scr, "eweq"); diff --git a/WINGs/wevent.c b/WINGs/wevent.c index 5146bb0f..12e6e162 100644 --- a/WINGs/wevent.c +++ b/WINGs/wevent.c @@ -345,7 +345,6 @@ checkIdleHandlers() WMBag *handlerCopy; WMBagIterator iter; - if (!idleHandler || WMGetBagItemCount(idleHandler)==0) { W_FlushIdleNotificationQueue(); /* make sure an observer in queue didn't added an idle handler */ @@ -401,7 +400,7 @@ checkTimerHandlers() while (timerHandler && IS_ZERO(handler->when)) { handler = timerHandler; timerHandler = timerHandler->next; - + if (handler->nextDelay > 0) { handler->when = now; addmillisecs(&handler->when, handler->nextDelay); @@ -420,22 +419,26 @@ static void delayUntilNextTimerEvent(struct timeval *delay) { struct timeval now; + TimerHandler *handler; - if (!timerHandler) { + handler = timerHandler; + while (handler && IS_ZERO(handler->when)) handler = handler->next; + + if (!handler) { /* The return value of this function is only valid if there _are_ timers active. */ delay->tv_sec = 0; delay->tv_usec = 0; return; } - + rightNow(&now); - if (IS_AFTER(now, timerHandler->when)) { + if (IS_AFTER(now, handler->when)) { delay->tv_sec = 0; delay->tv_usec = 0; } else { - delay->tv_sec = timerHandler->when.tv_sec - now.tv_sec; - delay->tv_usec = timerHandler->when.tv_usec - now.tv_usec; + delay->tv_sec = handler->when.tv_sec - now.tv_sec; + delay->tv_usec = handler->when.tv_usec - now.tv_usec; if (delay->tv_usec < 0) { delay->tv_usec += 1000000; delay->tv_sec--; diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 91b0e27a..b5f29f11 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -472,6 +472,7 @@ extern Display *dpy; extern char *ProgName; extern unsigned int ValidModMask; extern char WProgramState; +extern char WProgramSigState; /****** Global Functions ******/ extern void wAbort(Bool dumpCore); diff --git a/src/startup.c b/src/startup.c index d4c9fa43..bb779af2 100644 --- a/src/startup.c +++ b/src/startup.c @@ -228,9 +228,10 @@ handleXIO(Display *xio_dpy) static void delayedAction(void *cdata) { - if (WDelatedActionSet == 0) + if (WDelayedActionSet == 0) { return; - WDelayedActionSet = 0; + } + WDelayedActionSet--; /* * Make the event dispatcher do whatever it needs to do, * including handling zombie processes, restart and exit @@ -265,7 +266,7 @@ handleExitSig(int sig) /* setup idle handler, so that this will be handled when * the select() is returned becaused of the signal, even if * there are no X events in the queue */ - WDelayedActionSet = 1; + WDelayedActionSet++; } else if (sig == SIGUSR2) { #ifdef SYS_SIGLIST_DECLARED wwarning(_("got signal %i (%s) - rereading defaults\n"), sig, sys_siglist[sig]); @@ -277,7 +278,7 @@ handleExitSig(int sig) /* setup idle handler, so that this will be handled when * the select() is returned becaused of the signal, even if * there are no X events in the queue */ - WDelayedActionSet = 1; + WDelayedActionSet++; } else if (sig == SIGINT || sig == SIGHUP) { #ifdef SYS_SIGLIST_DECLARED wwarning(_("got signal %i (%s) - exiting...\n"), sig, sys_siglist[sig]); @@ -287,7 +288,7 @@ handleExitSig(int sig) SIG_WCHANGE_STATE(WSTATE_NEED_EXIT); - WDelayedActionSet = 1; + WDelayedActionSet++; } sigprocmask(SIG_UNBLOCK, &sigs, NULL); @@ -418,7 +419,7 @@ buryChild(int foo) NotifyDeadProcess(pid, WEXITSTATUS(status)); } - WDelayedActionSet = 1; + WDelayedActionSet++; sigprocmask(SIG_UNBLOCK, &sigs, NULL);