mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
to avoid code duplication. - simplified wevent.c and wutil.c - renamed WMAddEternalTimerHandler() to WMAddPersistentTimerHandler()
43 lines
1.0 KiB
C
43 lines
1.0 KiB
C
|
|
|
|
/*
|
|
* Handle events for non-GUI based applications
|
|
*/
|
|
|
|
#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();
|
|
/* dispatch timer events */
|
|
W_CheckTimerHandlers();
|
|
}
|
|
|
|
W_HandleInputEvents(True, -1);
|
|
|
|
/* Check any expired timers */
|
|
W_CheckTimerHandlers();
|
|
}
|
|
|
|
|