1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-08 06:44:11 +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;
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

View File

@@ -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();
}

View File

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