diff --git a/WINGs/wevent.c b/WINGs/wevent.c index e5a19245..a90a67fa 100644 --- a/WINGs/wevent.c +++ b/WINGs/wevent.c @@ -360,6 +360,11 @@ checkTimerHandlers() TimerHandler *handler; struct timeval now; + if (!timerHandler) { + W_FlushASAPNotificationQueue(); + return; + } + rightNow(&now); while (timerHandler && IS_AFTER(now, timerHandler->when)) { @@ -919,17 +924,14 @@ void WMNextEvent(Display *dpy, XEvent *event) { /* Check any expired timers */ - if (timerPending()) { - checkTimerHandlers(); - } + checkTimerHandlers(); while (XPending(dpy) == 0) { /* Do idle stuff */ /* Do idle and timer stuff while there are no timer or X events */ while (!XPending(dpy) && checkIdleHandlers()) { /* dispatch timer events */ - if (timerPending()) - checkTimerHandlers(); + checkTimerHandlers(); } /* @@ -941,9 +943,7 @@ WMNextEvent(Display *dpy, XEvent *event) W_WaitForEvent(dpy, 0); /* Check any expired timers */ - if (timerPending()) { - checkTimerHandlers(); - } + checkTimerHandlers(); } XNextEvent(dpy, event); @@ -986,9 +986,7 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event) timeoutOrInfty); /* Check any expired timers */ - if (timerPending()) { - checkTimerHandlers(); - } + checkTimerHandlers(); } } #endif @@ -1014,9 +1012,7 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event) W_WaitForEvent(dpy, mask); /* Check any expired timers */ - if (timerPending()) { - checkTimerHandlers(); - } + checkTimerHandlers(); } } #endif diff --git a/WINGs/wutil.c b/WINGs/wutil.c index 3ab91e60..32e31262 100644 --- a/WINGs/wutil.c +++ b/WINGs/wutil.c @@ -311,6 +311,11 @@ checkTimerHandlers() TimerHandler *handler; struct timeval now; + if (!timerHandler) { + W_FlushASAPNotificationQueue(); + return; + } + rightNow(&now); while (timerHandler && IS_AFTER(now, timerHandler->when)) { @@ -333,7 +338,7 @@ delayUntilNextTimerEvent(struct timeval *delay) if (!timerHandler) { /* The return value of this function is only valid if there _are_ - timers active. */ + * active timers. */ delay->tv_sec = 0; delay->tv_usec = 0; return; @@ -384,8 +389,10 @@ handleInputEvents(Bool waitForInput) InputHandler *handler; int count, timeout, nfds, k; - if (!inputHandler) + if (!inputHandler) { + W_FlushASAPNotificationQueue(); return False; + } for (nfds = 0, handler = inputHandler; handler != 0; handler = handler->next) nfds++; @@ -470,8 +477,10 @@ handleInputEvents(Bool waitForInput) int count; InputHandler *handler = inputHandler; - if (!inputHandler) + if (!inputHandler) { + W_FlushASAPNotificationQueue(); return False; + } FD_ZERO(&rset); FD_ZERO(&wset); @@ -556,9 +565,7 @@ void WHandleEvents() { /* Check any expired timers */ - if (timerPending()) { - checkTimerHandlers(); - } + checkTimerHandlers(); /* We need to make sure that we have some input handler before calling * checkIdleHandlers() in a while loop, because else the while loop @@ -566,24 +573,22 @@ WHandleEvents() */ if (inputHandler) { /* Do idle and timer stuff while there are no input events */ + /* We check InputHandler again because some idle handler could have + * removed them */ while (checkIdleHandlers() && inputHandler && !handleInputEvents(False)) { /* dispatch timer events */ - if (timerPending()) - checkTimerHandlers(); + checkTimerHandlers(); } } else { checkIdleHandlers(); /* dispatch timer events */ - if (timerPending()) - checkTimerHandlers(); + checkTimerHandlers(); } handleInputEvents(True); /* Check any expired timers */ - if (timerPending()) { - checkTimerHandlers(); - } + checkTimerHandlers(); } diff --git a/WPrefs.app/TexturePanel.c b/WPrefs.app/TexturePanel.c index 74464d1f..c0f20f61 100644 --- a/WPrefs.app/TexturePanel.c +++ b/WPrefs.app/TexturePanel.c @@ -39,7 +39,7 @@ #include "TexturePanel.h" -#define MAX_SECTION_PARTS 4 +#define MAX_SECTION_PARTS 5 typedef struct _TexturePanel { WMWindow *win;