X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fsystem.c;h=3c1823572889f7cc36416aaf537e798d4ba0feb5;hb=52189f4b3b797e08699f67880198b585320cf8bf;hp=71b248e805e6d5c4deea6805460420bf08fb6c79;hpb=36357e8399d0a42ac45a1cd096aee24a9008b5f5;p=rocksndiamonds.git diff --git a/src/system.c b/src/system.c index 71b248e8..3c182357 100644 --- a/src/system.c +++ b/src/system.c @@ -14,10 +14,6 @@ #include "main.h" -#ifdef USE_SDL_LIBRARY -#include "sdl.h" -#endif - inline void ClearRectangle(Bitmap bitmap, int x, int y, int width, int height) { #ifdef USE_SDL_LIBRARY @@ -105,14 +101,21 @@ inline void SyncDisplay() inline void KeyboardAutoRepeatOn() { -#ifndef USE_SDL_LIBRARY +#ifdef USE_SDL_LIBRARY + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY / 2, + SDL_DEFAULT_REPEAT_INTERVAL / 2); + SDL_EnableUNICODE(1); +#else XAutoRepeatOn(display); #endif } inline void KeyboardAutoRepeatOff() { -#ifndef USE_SDL_LIBRARY +#ifdef USE_SDL_LIBRARY + SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL); + SDL_EnableUNICODE(0); +#else XAutoRepeatOff(display); #endif } @@ -152,6 +155,21 @@ inline void NextEvent(Event *event) #endif } +inline Key GetEventKey(KeyEvent *event, boolean with_modifiers) +{ +#ifdef USE_SDL_LIBRARY + if (with_modifiers && event->keysym.unicode != 0) + return event->keysym.unicode; + else + return event->keysym.sym; +#else + if (with_modifiers) + return XLookupKeysym(event, event->state); + else + return XLookupKeysym(event, 0); +#endif +} + inline void dummy() { #ifdef USE_SDL_LIBRARY