1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-10 07:44:14 +01:00

- simpler and more straightforward event handling for timer, idle, input

and X events (also fixed some problems the old handling logic had)
This commit is contained in:
dan
2001-03-21 01:29:22 +00:00
parent f5dcab0663
commit bc3b44acaa
7 changed files with 35 additions and 49 deletions

View File

@@ -7,28 +7,15 @@
#include "WINGsP.h"
void
WHandleEvents()
{
/* Check any expired timers */
W_CheckTimerHandlers();
/* We need to make sure that we have some input handler before calling
* W_CheckIdleHandlers() in a while loop, because else the while loop
* can run forever (if some idle handler reinitiates itself).
*/
if (W_HaveInputHandlers()) {
/* Do idle and timer stuff while there are no input events */
/* Check again if there are still input handlers, because some idle
* handler could have removed them */
while (W_CheckIdleHandlers() && W_HaveInputHandlers() &&
!W_HandleInputEvents(False, -1)) {
/* dispatch timer events */
W_CheckTimerHandlers();
}
} else {
W_CheckIdleHandlers();
/* Do idle and timer stuff while there are no input events */
/* Do not wait for input here. just peek to se if input is available */
while (!W_HandleInputEvents(False, -1) && W_CheckIdleHandlers()) {
/* dispatch timer events */
W_CheckTimerHandlers();
}