mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
- better and more robust handling of events (timer, idle, input, X) in
WMMaskEvent() - fixed a bug where input and timer events were not treated for undefined periods of time under some circumstances.
This commit is contained in:
@@ -13,7 +13,9 @@ Changes since wmaker 0.64.0:
|
|||||||
and X events (also fixed some problems the old handling logic had)
|
and X events (also fixed some problems the old handling logic had)
|
||||||
- moved timer, dile and input handler definitions and prototypes from
|
- moved timer, dile and input handler definitions and prototypes from
|
||||||
WINGs.h to WUtil.h because they're not GUI related.
|
WINGs.h to WUtil.h because they're not GUI related.
|
||||||
|
- better and more robust handling of events (timer, idle, input, X) in
|
||||||
|
WMMaskEvent(). Also fixed a bug where input and timer events were not
|
||||||
|
treated for undefined periods of time under some circumstances.
|
||||||
|
|
||||||
changes since wmaker 0.63.1:
|
changes since wmaker 0.63.1:
|
||||||
............................
|
............................
|
||||||
|
|||||||
@@ -382,9 +382,19 @@ WMIsDoubleClick(XEvent *event)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If waitForInput is False, it will just peek to see if input is available
|
* Check for X and input events. If X events are present input events will
|
||||||
* then return without processing input but the return value will show
|
* not be checked.
|
||||||
* if input is available or not.
|
*
|
||||||
|
* Return value: True if a X event is available or any input event was
|
||||||
|
* processed, false otherwise (including return because of
|
||||||
|
* some timer handler expired).
|
||||||
|
*
|
||||||
|
* If waitForInput is False, it will just peek for available input and return
|
||||||
|
* without processing. Return vaue will be True if input is available.
|
||||||
|
*
|
||||||
|
* If waitForInput is True, it will wait until an input event arrives on the
|
||||||
|
* registered input handlers and ConnectionNumber(dpy), or will return when
|
||||||
|
* a timer handler expires if no input event arrived until then.
|
||||||
*/
|
*/
|
||||||
static Bool
|
static Bool
|
||||||
waitForEvent(Display *dpy, unsigned long xeventmask, Bool waitForInput)
|
waitForEvent(Display *dpy, unsigned long xeventmask, Bool waitForInput)
|
||||||
@@ -412,7 +422,7 @@ WMNextEvent(Display *dpy, XEvent *event)
|
|||||||
W_CheckTimerHandlers();
|
W_CheckTimerHandlers();
|
||||||
|
|
||||||
while (XPending(dpy) == 0) {
|
while (XPending(dpy) == 0) {
|
||||||
/* Do idle and timer stuff while there are no timer or X events */
|
/* Do idle and timer stuff while there are no input or X events */
|
||||||
while (!waitForEvent(dpy, 0, False) && W_CheckIdleHandlers()) {
|
while (!waitForEvent(dpy, 0, False) && W_CheckIdleHandlers()) {
|
||||||
/* dispatch timer events */
|
/* dispatch timer events */
|
||||||
W_CheckTimerHandlers();
|
W_CheckTimerHandlers();
|
||||||
@@ -435,6 +445,9 @@ WMNextEvent(Display *dpy, XEvent *event)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* Is this comment still valid?
|
||||||
|
* waitForEvent seems now to understand masked events. -Dan
|
||||||
|
*
|
||||||
* Cant use this because XPending() will make waitForEvent
|
* Cant use this because XPending() will make waitForEvent
|
||||||
* return even if the event in the queue is not what we want,
|
* return even if the event in the queue is not what we want,
|
||||||
* and if we block until some new event arrives from the
|
* and if we block until some new event arrives from the
|
||||||
@@ -444,13 +457,18 @@ WMNextEvent(Display *dpy, XEvent *event)
|
|||||||
void
|
void
|
||||||
WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
||||||
{
|
{
|
||||||
|
/* Check any expired timers */
|
||||||
|
W_CheckTimerHandlers();
|
||||||
|
|
||||||
while (!XCheckMaskEvent(dpy, mask, event)) {
|
while (!XCheckMaskEvent(dpy, mask, event)) {
|
||||||
/* Do idle stuff while there are no timer or X events */
|
/* Do idle and timer stuff while there are no input or X events */
|
||||||
while (W_CheckIdleHandlers()) {
|
while (!waitForEvent(dpy, mask, False) && W_CheckIdleHandlers()) {
|
||||||
if (XCheckMaskEvent(dpy, mask, event))
|
W_CheckTimerHandlers();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (XCheckMaskEvent(dpy, mask, event))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Wait for input on the X connection socket or another input handler */
|
/* Wait for input on the X connection socket or another input handler */
|
||||||
waitForEvent(dpy, mask, True);
|
waitForEvent(dpy, mask, True);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user