changed all event handling to always filter events
authorHolger Schemel <info@artsoft.org>
Wed, 31 Jan 2018 19:20:09 +0000 (20:20 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 31 Jan 2018 19:20:09 +0000 (20:20 +0100)
src/events.c
src/screens.c
src/tools.c

index 10950bd9513e2a993531382756a07658583c7996..2998066b98230577aae3198ddbc0b861877646bc 100644 (file)
@@ -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)
     {
index 0a0f1f25b7a22a8092be8511a199641347d6e98c..ab1d2be1188928f23ee4fc54d066a8de9c5fee02 100644 (file)
@@ -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:
index 9bde54c7531aff5b7a1dc16d0e083808701f40d3..43df704a17ea08c8301600f8276b3b75b79263c2 100644 (file)
@@ -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: