X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=365d79621582c8f9895e69d5842c964e29d4d13a;hb=20ac4856f1acb923be1793a0e9060987f15a1295;hp=604345d90f07054d1639ee0f285d45c1123547db;hpb=da14f69fd95c7bd5a0d70cdf4935af06f1f20a04;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index 604345d9..365d7962 100644 --- a/src/events.c +++ b/src/events.c @@ -1,14 +1,14 @@ /*********************************************************** -* Rocks'n'Diamonds -- McDuffin Strikes Back! * +* Rocks'n'Diamonds -- McDuffin Strikes Back! * *----------------------------------------------------------* -* (c) 1995-98 Artsoft Entertainment * -* Holger Schemel * -* Oststrasse 11a * -* 33604 Bielefeld * -* phone: ++49 +521 290471 * -* email: aeglos@valinor.owl.de * +* (c) 1995-2001 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * *----------------------------------------------------------* -* events.c * +* events.c * ***********************************************************/ #include "libgame/libgame.h" @@ -45,6 +45,23 @@ int FilterMouseMotionEvents(const Event *event) return 1; } +/* this is only really needed for non-SDL targets to filter unwanted events; + when using SDL with properly installed event filter, this function can be + replaced with a simple "NextEvent()" call, but it doesn't hurt either */ + +static boolean NextValidEvent(Event *event) +{ + while (PendingEvent()) + { + NextEvent(event); + + if (FilterMouseMotionEvents(event)) + return TRUE; + } + + return FALSE; +} + void EventLoop(void) { while(1) @@ -53,9 +70,7 @@ void EventLoop(void) { Event event; - NextEvent(&event); - - if (FilterMouseMotionEvents(&event)) + if (NextValidEvent(&event)) { switch(event.type) {