mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
- Fixed problem calling W_FlushIdleNotificationQueue() when there was no idle
handler installed. - Fixed some problem with ASAP notification queues - fixed a memleak related to notification queues.
This commit is contained in:
@@ -217,8 +217,6 @@ WMPostNotification(WMNotification *notification)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WMReleaseNotification(notification);
|
WMReleaseNotification(notification);
|
||||||
|
|
||||||
W_FlushASAPNotificationQueue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -491,6 +489,7 @@ WMEnqueueCoalesceNotification(WMNotificationQueue *queue,
|
|||||||
switch (postingStyle) {
|
switch (postingStyle) {
|
||||||
case WMPostNow:
|
case WMPostNow:
|
||||||
WMPostNotification(notification);
|
WMPostNotification(notification);
|
||||||
|
WMReleaseNotification(notification);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WMPostASAP:
|
case WMPostASAP:
|
||||||
@@ -514,6 +513,7 @@ W_FlushASAPNotificationQueue()
|
|||||||
WMNotification *tmp = WMGetFromBag(queue->asapQueue, 0);
|
WMNotification *tmp = WMGetFromBag(queue->asapQueue, 0);
|
||||||
|
|
||||||
WMPostNotification(tmp);
|
WMPostNotification(tmp);
|
||||||
|
WMReleaseNotification(tmp);
|
||||||
WMDeleteFromBag(queue->asapQueue, 0);
|
WMDeleteFromBag(queue->asapQueue, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,6 +532,7 @@ W_FlushIdleNotificationQueue()
|
|||||||
WMNotification *tmp = WMGetFromBag(queue->idleQueue, 0);
|
WMNotification *tmp = WMGetFromBag(queue->idleQueue, 0);
|
||||||
|
|
||||||
WMPostNotification(tmp);
|
WMPostNotification(tmp);
|
||||||
|
WMReleaseNotification(tmp);
|
||||||
WMDeleteFromBag(queue->idleQueue, 0);
|
WMDeleteFromBag(queue->idleQueue, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -327,7 +327,9 @@ checkIdleHandlers()
|
|||||||
IdleHandler *handler, *tmp;
|
IdleHandler *handler, *tmp;
|
||||||
|
|
||||||
if (!idleHandler) {
|
if (!idleHandler) {
|
||||||
return False;
|
W_FlushIdleNotificationQueue();
|
||||||
|
/* make sure an observer in queue didn't added an idle handler */
|
||||||
|
return (idleHandler!=NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
handler = idleHandler;
|
handler = idleHandler;
|
||||||
@@ -344,7 +346,10 @@ checkIdleHandlers()
|
|||||||
handler = tmp;
|
handler = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return True;
|
W_FlushIdleNotificationQueue();
|
||||||
|
|
||||||
|
/* this is not necesarrily False, because one handler can re-add itself */
|
||||||
|
return (idleHandler!=NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -922,9 +927,6 @@ WMNextEvent(Display *dpy, XEvent *event)
|
|||||||
/* 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()) {
|
||||||
|
|
||||||
W_FlushIdleNotificationQueue();
|
|
||||||
|
|
||||||
/* dispatch timer events */
|
/* dispatch timer events */
|
||||||
if (timerPending())
|
if (timerPending())
|
||||||
checkTimerHandlers();
|
checkTimerHandlers();
|
||||||
@@ -959,9 +961,6 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
|||||||
while (!XCheckMaskEvent(dpy, mask, event)) {
|
while (!XCheckMaskEvent(dpy, mask, event)) {
|
||||||
/* Do idle stuff while there are no timer or X events */
|
/* Do idle stuff while there are no timer or X events */
|
||||||
while (checkIdleHandlers()) {
|
while (checkIdleHandlers()) {
|
||||||
|
|
||||||
W_FlushIdleNotificationQueue();
|
|
||||||
|
|
||||||
if (XCheckMaskEvent(dpy, mask, event))
|
if (XCheckMaskEvent(dpy, mask, event))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1007,9 +1006,6 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
|||||||
while (!XCheckMaskEvent(dpy, mask, event)) {
|
while (!XCheckMaskEvent(dpy, mask, event)) {
|
||||||
/* Do idle stuff while there are no timer or X events */
|
/* Do idle stuff while there are no timer or X events */
|
||||||
while (checkIdleHandlers()) {
|
while (checkIdleHandlers()) {
|
||||||
|
|
||||||
W_FlushIdleNotificationQueue();
|
|
||||||
|
|
||||||
if (XCheckMaskEvent(dpy, mask, event))
|
if (XCheckMaskEvent(dpy, mask, event))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ static InputHandler *inputHandler=NULL;
|
|||||||
|
|
||||||
#define timerPending() (timerHandler)
|
#define timerPending() (timerHandler)
|
||||||
|
|
||||||
#define idlePending() (idleHandler)
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rightNow(struct timeval *tv) {
|
rightNow(struct timeval *tv) {
|
||||||
@@ -274,14 +272,15 @@ WMDeleteInputHandler(WMHandlerID handlerID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static Bool
|
||||||
checkIdleHandlers()
|
checkIdleHandlers()
|
||||||
{
|
{
|
||||||
IdleHandler *handler, *tmp;
|
IdleHandler *handler, *tmp;
|
||||||
|
|
||||||
if (!idleHandler) {
|
if (!idleHandler) {
|
||||||
W_FlushIdleNotificationQueue();
|
W_FlushIdleNotificationQueue();
|
||||||
return;
|
/* make sure an observer in queue didn't added an idle handler */
|
||||||
|
return (idleHandler!=NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
handler = idleHandler;
|
handler = idleHandler;
|
||||||
@@ -297,7 +296,11 @@ checkIdleHandlers()
|
|||||||
|
|
||||||
handler = tmp;
|
handler = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
W_FlushIdleNotificationQueue();
|
W_FlushIdleNotificationQueue();
|
||||||
|
|
||||||
|
/* this is not necesarrily False, because one handler can re-add itself */
|
||||||
|
return (idleHandler!=NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -563,15 +566,12 @@ 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 */
|
||||||
while (idlePending() && inputHandler && !handleInputEvents(False)) {
|
while (checkIdleHandlers() && inputHandler && !handleInputEvents(False)) {
|
||||||
if (idlePending())
|
|
||||||
checkIdleHandlers();
|
|
||||||
/* dispatch timer events */
|
/* dispatch timer events */
|
||||||
if (timerPending())
|
if (timerPending())
|
||||||
checkTimerHandlers();
|
checkTimerHandlers();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (idlePending())
|
|
||||||
checkIdleHandlers();
|
checkIdleHandlers();
|
||||||
/* dispatch timer events */
|
/* dispatch timer events */
|
||||||
if (timerPending())
|
if (timerPending())
|
||||||
|
|||||||
Reference in New Issue
Block a user