VirtualBox

Changeset 3098 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jun 12, 2007 2:38:12 PM (18 years ago)
Author:
vboxsync
Message:

fixed the mess with caps lock / num lock / scroll lock on SDL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r3094 r3098  
    682682        return 1;
    683683    }
     684
     685#ifdef __LINUX
     686    /*
     687     * Lock keys on SDL behave different from normal keys: A KeyPress event is generated
     688     * if the lock mode gets active and a keyRelease event is genereated if the lock mode
     689     * gets inactive, that is KeyPress and KeyRelease are sent when pressing the lock key
     690     * to change the mode. The current lock mode is reflected in SDL_GetModState().
     691     *
     692     * Debian patched libSDL to make the lock keys behave like normal keys generating a
     693     * KeyPress/KeyRelease event if the lock key was pressed/released. But the lock status
     694     * is not reflected in the mod status anymore. We disable the Debian-specific extension
     695     * to ensure a defined environment and work around the missing KeyPress/KeyRelease
     696     * events in ProcessKeys().
     697     */
     698    setenv("SDL_DISABLE_LOCK_KEYS", 1, 1);
     699#endif
    684700
    685701    /*
     
    31323148        case 0x3a: /* Caps Lock */
    31333149        {
    3134             /* SDL does not send the key up event, so we generate it.
    3135              * r=frank: This is not true for never SDL versions. */
    3136             if (ev->type == SDL_KEYDOWN)
     3150            /*
     3151             * SDL generates a KEYDOWN event if the lock key is active and a  KEYUP event
     3152             * if the lock key is inactive. See SDL_DISABLE_LOCK_KEYS.
     3153             */
     3154            if (ev->type == SDL_KEYDOWN || ev->type == SDL_KEYUP)
    31373155            {
    31383156                gKeyboard->PutScancode(keycode);
     
    31613179            gKeyboard->PutScancode(0x45 | 0x80);
    31623180        }
    3163 #if 0  /* For some reason SDL_GetModState() does not return KMOD_CAPS correctly */
    31643181        if (   gcGuestCapsLockAdaptions
    31653182            && (gfGuestCapsLockPressed ^ !!(SDL_GetModState() & KMOD_CAPS)))
     
    31693186            gKeyboard->PutScancode(0x3a | 0x80);
    31703187        }
    3171 #endif
    31723188    }
    31733189
Note: See TracChangeset for help on using the changeset viewer.

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