Ticket #36070: 3689.diff

File 3689.diff, 2.9 KB (added by domiman@…, 12 years ago)
  • src/gui/sdl_mapper.cpp

     
    23622362        if (!MAPPER_LoadBinds()) CreateDefaultBinds();
    23632363        if (SDL_GetModState()&KMOD_CAPS) {
    23642364                for (CBindList_it bit=caps_lock_event->bindlist.begin();bit!=caps_lock_event->bindlist.end();bit++) {
    2365                         (*bit)->ActivateBind(32767,true,true);
    23662365#if SDL_VERSION_ATLEAST(1, 2, 14)
     2366                        (*bit)->ActivateBind(32767,true,false);
    23672367                        (*bit)->DeActivateBind(false);
     2368#else
     2369                        (*bit)->ActivateBind(32767,true,true); //Skip the action itself as bios_keyboard.cpp handles the startup state.
    23682370#endif
    23692371                }
    23702372        }
    23712373        if (SDL_GetModState()&KMOD_NUM) {
    23722374                for (CBindList_it bit=num_lock_event->bindlist.begin();bit!=num_lock_event->bindlist.end();bit++) {
    2373                         (*bit)->ActivateBind(32767,true,true);
    23742375#if SDL_VERSION_ATLEAST(1, 2, 14)
     2376                        (*bit)->ActivateBind(32767,true,false);
    23752377                        (*bit)->DeActivateBind(false);
     2378#else
     2379                        (*bit)->ActivateBind(32767,true,true);
    23762380#endif
    23772381                }
    23782382        }
  • src/gui/sdlmain.cpp

     
    17701770
    17711771        /* Init SDL */
    17721772#if SDL_VERSION_ATLEAST(1, 2, 14)
     1773        /* Or debian/ubuntu with older libsdl version as they have done this themselves, but then differently.
     1774         * with this variable they will work correctly. I've only tested the 1.2.14 behaviour against the windows version
     1775         * of libsdl
     1776         */
    17731777        putenv(const_cast<char*>("SDL_DISABLE_LOCK_KEYS=1"));
    17741778#endif
    17751779        if ( SDL_Init( SDL_INIT_AUDIO|SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_CDROM
  • src/ints/bios_keyboard.cpp

     
    3333 * Define the following if this is the case */
    3434#if SDL_VERSION_ATLEAST(1, 2, 14)
    3535#define CAN_USE_LOCK 1
     36/* For lower versions of SDL we also use a slight hack to get the startup states of numclock and capslock right.
     37 * The proper way is in the mapper, but the repeating key is an unwanted side effect for lower versions of SDL */
    3638#endif
    3739
    3840static Bitu call_int16,call_irq1,call_irq6;
     
    592594        mem_writew(BIOS_KEYBOARD_BUFFER_TAIL,0x1e);
    593595        Bit8u flag1 = 0;
    594596        Bit8u leds = 16; /* Ack recieved */
    595 //MAPPER_Init takes care of this now ?
    596 //      if(startup_state_capslock) { flag1|=0x40; leds|=0x04;}
    597 //      if(startup_state_numlock){ flag1|=0x20; leds|=0x02;}
     597
     598#if SDL_VERSION_ATLEAST(1, 2, 14)
     599//Nothing, mapper handles all.
     600#else
     601        if (startup_state_capslock) { flag1|=0x40; leds|=0x04;}
     602        if (startup_state_numlock)  { flag1|=0x20; leds|=0x02;}
     603#endif
     604
    598605        mem_writeb(BIOS_KEYBOARD_FLAGS1,flag1);
    599606        mem_writeb(BIOS_KEYBOARD_FLAGS2,0);
    600607        mem_writeb(BIOS_KEYBOARD_FLAGS3,16); /* Enhanced keyboard installed */