X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=122311d1a527345b924ce8bca12673dca7d216e8;hb=3ae70b9d27b4b2c038f35b0aa5985c368542a486;hp=d583d87305b3165cbc6663963f273d43391c79ae;hpb=61c3da024802ecc0268bab42d7499fc0346e4fd3;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index d583d873..122311d1 100644 --- a/src/events.c +++ b/src/events.c @@ -36,10 +36,21 @@ static unsigned int playfield_cursor_delay = 0; delay problems with lots of mouse motion events when mouse button not pressed (X11 can handle this with 'PointerMotionHintMask') */ -int FilterMouseMotionEvents(const Event *event) +/* event filter addition for SDL2: as SDL2 does not have a function to enable + or disable keyboard auto-repeat, filter repeated keyboard events instead */ + +int FilterEvents(const Event *event) { MotionEvent *motion; +#if defined(TARGET_SDL2) + /* skip repeated key press events if keyboard auto-repeat is disabled */ + if (event->type == EVENT_KEYPRESS && + event->key.repeat && + !keyrepeat_status) + return 0; +#endif + /* non-motion events are directly passed to event handler functions */ if (event->type != EVENT_MOTIONNOTIFY) return 1; @@ -59,8 +70,8 @@ int FilterMouseMotionEvents(const Event *event) if (button_status == MB_RELEASED && game_status != GAME_MODE_EDITOR && game_status != GAME_MODE_PLAYING) return 0; - else - return 1; + + return 1; } /* to prevent delay problems, skip mouse motion events if the very next @@ -318,7 +329,7 @@ void SleepWhileUnmapped() void HandleExposeEvent(ExposeEvent *event) { -#ifndef TARGET_SDL +#if !defined(TARGET_SDL) RedrawPlayfield(FALSE, event->x, event->y, event->width, event->height); FlushDisplay(); #endif