diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index d60fe0cc..b2c0300e 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -1717,7 +1717,9 @@ int main(int argc, char* argv[]) { LOG_MSG("---"); /* Init SDL */ - putenv(const_cast("SDL_DISABLE_LOCK_KEYS=1")); //Workaround debian/ubuntu fixes for SDL. +#if SDL_VERSION_ATLEAST(1, 2, 14) + putenv(const_cast("SDL_DISABLE_LOCK_KEYS=1")); +#endif if ( SDL_Init( SDL_INIT_AUDIO|SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_CDROM |SDL_INIT_NOPARACHUTE ) < 0 ) E_Exit("Can't init SDL %s",SDL_GetError()); diff --git a/src/ints/bios_keyboard.cpp b/src/ints/bios_keyboard.cpp index e26c11a2..ef56885b 100644 --- a/src/ints/bios_keyboard.cpp +++ b/src/ints/bios_keyboard.cpp @@ -26,11 +26,14 @@ #include "regs.h" #include "inout.h" #include "dos_inc.h" +#include "SDL.h" /* SDL by default treats numlock and scrolllock different from all other keys. - * Some linux distros disable this bad behaviour. (for example debian) + * In recent versions this can disabled by a environment variable which we set in sdlmain.cpp * Define the following if this is the case */ -//#define CAN_USE_LOCK 1 +#if SDL_VERSION_ATLEAST(1, 2, 14) +#define CAN_USE_LOCK 1 +#endif static Bitu call_int16,call_irq1,call_irq6; @@ -243,6 +246,7 @@ static Bitu IRQ1_Handler(void) { flags2&=~(0x40+0x20);//remove numlock/capslock pressed (hack for sdl only reporting states) #endif if (DOS_LayoutKey(scancode,flags1,flags2,flags3)) return CBRET_NONE; +LOG_MSG("key input %d %d %d %d",scancode,flags1,flags2,flags3); switch (scancode) { /* First the hard ones */ case 0xfa: /* ack. Do nothing for now */ @@ -588,8 +592,9 @@ static void InitBiosSegment(void) { mem_writew(BIOS_KEYBOARD_BUFFER_TAIL,0x1e); Bit8u flag1 = 0; Bit8u leds = 16; /* Ack recieved */ - if(startup_state_capslock) { flag1|=0x40; leds|=0x04;} - if(startup_state_numlock){ flag1|=0x20; leds|=0x02;} +//MAPPER_Init takes care of this now ? +// if(startup_state_capslock) { flag1|=0x40; leds|=0x04;} +// if(startup_state_numlock){ flag1|=0x20; leds|=0x02;} mem_writeb(BIOS_KEYBOARD_FLAGS1,flag1); mem_writeb(BIOS_KEYBOARD_FLAGS2,0); mem_writeb(BIOS_KEYBOARD_FLAGS3,16); /* Enhanced keyboard installed */