VirtualBox

Ticket #11482: VBoxSDL-kbd.patch

File VBoxSDL-kbd.patch, 2.0 KB (added by kabassanov, 10 years ago)
  • src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    old new  
    37193719            break;
    37203720        }
    37213721
    3722         case 0x45: /* Num Lock */
    3723         case 0x3a: /* Caps Lock */
    3724         {
    3725             /*
    3726              * SDL generates a KEYDOWN event if the lock key is active and a  KEYUP event
    3727              * if the lock key is inactive. See SDL_DISABLE_LOCK_KEYS.
    3728              */
    3729             if (ev->type == SDL_KEYDOWN || ev->type == SDL_KEYUP)
    3730             {
    3731                 gpKeyboard->PutScancode(keycode);
    3732                 gpKeyboard->PutScancode(keycode | 0x80);
    3733             }
    3734             return;
    3735         }
    3736     }
    3737 
    3738     if (ev->type != SDL_KEYDOWN)
    3739     {
    3740         /*
    3741          * Some keyboards (e.g. the one of mine T60) don't send a NumLock scan code on every
    3742          * press of the key. Both the guest and the host should agree on the NumLock state.
    3743          * If they differ, we try to alter the guest NumLock state by sending the NumLock key
    3744          * scancode. We will get a feedback through the KBD_CMD_SET_LEDS command if the guest
    3745          * tries to set/clear the NumLock LED. If a (silly) guest doesn't change the LED, don't
    3746          * bother him with NumLock scancodes. At least our BIOS, Linux and Windows handle the
    3747          * NumLock LED well.
    3748          */
    3749         if (   gcGuestNumLockAdaptions
    3750             && (gfGuestNumLockPressed ^ !!(SDL_GetModState() & KMOD_NUM)))
    3751         {
    3752             gcGuestNumLockAdaptions--;
    3753             gpKeyboard->PutScancode(0x45);
    3754             gpKeyboard->PutScancode(0x45 | 0x80);
    3755         }
    3756         if (   gcGuestCapsLockAdaptions
    3757             && (gfGuestCapsLockPressed ^ !!(SDL_GetModState() & KMOD_CAPS)))
    3758         {
    3759             gcGuestCapsLockAdaptions--;
    3760             gpKeyboard->PutScancode(0x3a);
    3761             gpKeyboard->PutScancode(0x3a | 0x80);
    3762         }
    37633722    }
    37643723
    37653724    /*

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy