add Jtk_CheckEvent()
This commit is contained in:
parent
3a594b5355
commit
49c34907f5
@ -335,17 +335,15 @@ static bool ProcessXEvent(XEvent * x_event, Jtk_Event * event)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Jtk_WaitEvent(Jtk_Event * event)
|
||||
bool Jtk_CheckEvent(Jtk_Event * event)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
/* First check for an X event. */
|
||||
while (XPending(g_display) > 0)
|
||||
{
|
||||
XEvent x_event;
|
||||
XNextEvent(g_display, &x_event);
|
||||
if (ProcessXEvent(&x_event, event))
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Next check if any timer has expired. */
|
||||
@ -372,10 +370,20 @@ void Jtk_WaitEvent(Jtk_Event * event)
|
||||
}
|
||||
#endif
|
||||
Jtk_ServiceTimer(timer_id);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Finally, wait for something to happen. */
|
||||
return false;
|
||||
}
|
||||
|
||||
void Jtk_WaitEvent(Jtk_Event * event)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (Jtk_CheckEvent(event))
|
||||
return;
|
||||
|
||||
/* Wait for something to happen. */
|
||||
uint64_t time_to_wait = Jtk_TimeToNextTimerExpiration();
|
||||
if (time_to_wait > MAX_WAIT_TIME)
|
||||
{
|
||||
|
@ -52,6 +52,7 @@ typedef struct
|
||||
};
|
||||
} Jtk_Event;
|
||||
|
||||
bool Jtk_CheckEvent(Jtk_Event * event);
|
||||
void Jtk_WaitEvent(Jtk_Event * event);
|
||||
#if 0
|
||||
void Jtk_BeginKeyRepeat(Jtk_KeyEvent * key_event, uint32_t delay, uint32_t interval);
|
||||
|
Loading…
x
Reference in New Issue
Block a user