1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-31 04:55:54 +01:00

- fixed the checkTimerHandlers() to flush the ASAP notification queue, even

if there are no timer handlers.
- an array was too small in TexturePanel.c (4 instead of 5).
This commit is contained in:
dan
1999-11-20 22:29:58 +00:00
parent 9eb9198bad
commit 8b062b07c1
3 changed files with 29 additions and 28 deletions

View File

@@ -360,6 +360,11 @@ checkTimerHandlers()
TimerHandler *handler; TimerHandler *handler;
struct timeval now; struct timeval now;
if (!timerHandler) {
W_FlushASAPNotificationQueue();
return;
}
rightNow(&now); rightNow(&now);
while (timerHandler && IS_AFTER(now, timerHandler->when)) { while (timerHandler && IS_AFTER(now, timerHandler->when)) {
@@ -919,17 +924,14 @@ void
WMNextEvent(Display *dpy, XEvent *event) WMNextEvent(Display *dpy, XEvent *event)
{ {
/* Check any expired timers */ /* Check any expired timers */
if (timerPending()) { checkTimerHandlers();
checkTimerHandlers();
}
while (XPending(dpy) == 0) { while (XPending(dpy) == 0) {
/* Do idle stuff */ /* Do idle stuff */
/* Do idle and timer stuff while there are no timer or X events */ /* Do idle and timer stuff while there are no timer or X events */
while (!XPending(dpy) && checkIdleHandlers()) { while (!XPending(dpy) && checkIdleHandlers()) {
/* dispatch timer events */ /* dispatch timer events */
if (timerPending()) checkTimerHandlers();
checkTimerHandlers();
} }
/* /*
@@ -941,9 +943,7 @@ WMNextEvent(Display *dpy, XEvent *event)
W_WaitForEvent(dpy, 0); W_WaitForEvent(dpy, 0);
/* Check any expired timers */ /* Check any expired timers */
if (timerPending()) { checkTimerHandlers();
checkTimerHandlers();
}
} }
XNextEvent(dpy, event); XNextEvent(dpy, event);
@@ -986,9 +986,7 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
timeoutOrInfty); timeoutOrInfty);
/* Check any expired timers */ /* Check any expired timers */
if (timerPending()) { checkTimerHandlers();
checkTimerHandlers();
}
} }
} }
#endif #endif
@@ -1014,9 +1012,7 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
W_WaitForEvent(dpy, mask); W_WaitForEvent(dpy, mask);
/* Check any expired timers */ /* Check any expired timers */
if (timerPending()) { checkTimerHandlers();
checkTimerHandlers();
}
} }
} }
#endif #endif

View File

@@ -311,6 +311,11 @@ checkTimerHandlers()
TimerHandler *handler; TimerHandler *handler;
struct timeval now; struct timeval now;
if (!timerHandler) {
W_FlushASAPNotificationQueue();
return;
}
rightNow(&now); rightNow(&now);
while (timerHandler && IS_AFTER(now, timerHandler->when)) { while (timerHandler && IS_AFTER(now, timerHandler->when)) {
@@ -333,7 +338,7 @@ delayUntilNextTimerEvent(struct timeval *delay)
if (!timerHandler) { if (!timerHandler) {
/* The return value of this function is only valid if there _are_ /* The return value of this function is only valid if there _are_
timers active. */ * active timers. */
delay->tv_sec = 0; delay->tv_sec = 0;
delay->tv_usec = 0; delay->tv_usec = 0;
return; return;
@@ -384,8 +389,10 @@ handleInputEvents(Bool waitForInput)
InputHandler *handler; InputHandler *handler;
int count, timeout, nfds, k; int count, timeout, nfds, k;
if (!inputHandler) if (!inputHandler) {
W_FlushASAPNotificationQueue();
return False; return False;
}
for (nfds = 0, handler = inputHandler; for (nfds = 0, handler = inputHandler;
handler != 0; handler = handler->next) nfds++; handler != 0; handler = handler->next) nfds++;
@@ -470,8 +477,10 @@ handleInputEvents(Bool waitForInput)
int count; int count;
InputHandler *handler = inputHandler; InputHandler *handler = inputHandler;
if (!inputHandler) if (!inputHandler) {
W_FlushASAPNotificationQueue();
return False; return False;
}
FD_ZERO(&rset); FD_ZERO(&rset);
FD_ZERO(&wset); FD_ZERO(&wset);
@@ -556,9 +565,7 @@ void
WHandleEvents() WHandleEvents()
{ {
/* Check any expired timers */ /* Check any expired timers */
if (timerPending()) { checkTimerHandlers();
checkTimerHandlers();
}
/* We need to make sure that we have some input handler before calling /* We need to make sure that we have some input handler before calling
* checkIdleHandlers() in a while loop, because else the while loop * checkIdleHandlers() in a while loop, because else the while loop
@@ -566,24 +573,22 @@ WHandleEvents()
*/ */
if (inputHandler) { if (inputHandler) {
/* Do idle and timer stuff while there are no input events */ /* 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)) { while (checkIdleHandlers() && inputHandler && !handleInputEvents(False)) {
/* dispatch timer events */ /* dispatch timer events */
if (timerPending()) checkTimerHandlers();
checkTimerHandlers();
} }
} else { } else {
checkIdleHandlers(); checkIdleHandlers();
/* dispatch timer events */ /* dispatch timer events */
if (timerPending()) checkTimerHandlers();
checkTimerHandlers();
} }
handleInputEvents(True); handleInputEvents(True);
/* Check any expired timers */ /* Check any expired timers */
if (timerPending()) { checkTimerHandlers();
checkTimerHandlers();
}
} }

View File

@@ -39,7 +39,7 @@
#include "TexturePanel.h" #include "TexturePanel.h"
#define MAX_SECTION_PARTS 4 #define MAX_SECTION_PARTS 5
typedef struct _TexturePanel { typedef struct _TexturePanel {
WMWindow *win; WMWindow *win;