From: Holger Schemel Date: Wed, 31 Jan 2018 19:20:09 +0000 (+0100) Subject: changed all event handling to always filter events X-Git-Tag: 4.0.1.1~5 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=c7bda2237780e82311e5ede18042f3619b257f8a;p=rocksndiamonds.git changed all event handling to always filter events --- diff --git a/src/events.c b/src/events.c index 10950bd9..2998066b 100644 --- a/src/events.c +++ b/src/events.c @@ -341,12 +341,10 @@ void EventLoop(void) void ClearEventQueue() { - while (PendingEvent()) - { - Event event; - - WaitEvent(&event); + Event event; + while (NextValidEvent(&event)) + { switch (event.type) { case EVENT_BUTTONRELEASE: @@ -393,7 +391,8 @@ void SleepWhileUnmapped() { Event event; - WaitEvent(&event); + if (!WaitEventFiltered(&event)) + continue; switch (event.type) { diff --git a/src/screens.c b/src/screens.c index 0a0f1f25..ab1d2be1 100644 --- a/src/screens.c +++ b/src/screens.c @@ -5604,12 +5604,10 @@ static Key getSetupKey() while (!got_key_event) { - if (PendingEvent()) /* got event */ - { - Event event; - - WaitEvent(&event); + Event event; + if (NextValidEvent(&event)) + { switch (event.type) { case EVENT_KEYPRESS: @@ -6290,12 +6288,10 @@ void CustomizeKeyboard(int player_nr) while (!finished) { - if (PendingEvent()) /* got event */ - { - Event event; - - WaitEvent(&event); + Event event; + if (NextValidEvent(&event)) + { switch (event.type) { case EVENT_KEYPRESS: diff --git a/src/tools.c b/src/tools.c index 9bde54c7..43df704a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -3777,12 +3777,10 @@ void WaitForEventToContinue() while (still_wait) { - if (PendingEvent()) - { - Event event; - - WaitEvent(&event); + Event event; + if (NextValidEvent(&event)) + { switch (event.type) { case EVENT_BUTTONPRESS: