Opened 12 years ago
Closed 11 years ago
#11482 closed defect (fixed)
Caps Lock bug in SDL Frontend -> fixed in 4.3 series and later releases after 23. April 2014
Reported by: | lsturtevant | Owned by: | |
---|---|---|---|
Component: | other | Version: | VirtualBox 4.2.6 |
Keywords: | Cc: | ||
Guest type: | Windows | Host type: | Linux |
Description
I've experienced a bug with the SDL Frontend where the caps lock key is not working correctly. There's two symptoms of this. First, this bug behaves exactly like the bug in ticket:2025. Second, when I hit CapsLock, the first key I type will be in the previous case before switching to the lower case. For example. If the case is currently lower case and I press and release Caps Lock to upper case, the first character I type will be in lower case, then every other character will be in upper case. The same thing happens when I switch back to lower case.
I should note that this bug only occurs when using the SDL frontend.
Attachments (3)
Change History (13)
by , 12 years ago
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Guest type: | Linux → Windows |
---|---|
Host type: | Windows → Linux |
comment:3 by , 12 years ago
Could you please be more specific about what "exactly like the bug in ticket:2025" means? That you are using a French keyboard and shift lock behaves as caps lock in the guest? (Did you set the keyboard layout correctly in the guest as well as the host?)
comment:4 by , 11 years ago
Hi,
We have the same kind of issues with a "normal" French keyboard (that uses the same key to lock/unlock CAPS).
For instance, the sequence "a","a","Caps Lock","a","a","a" is mapped as "aaaAA" instead of "aaAAA" (first character typed after the CapsLock remains in the previous mode)
Sometimes, the observed behavior changes (with no reason) and while we are in CAPS mode, the only way to go back is to press a shift key.
Num pad does not function better due to a similar Num Lock key issue.
We made a small patch that seems to work correctly, but... we are unable to use VirtualBox extensions with our new binary.
by , 11 years ago
Attachment: | VBoxSDL-kbd.patch added |
---|
comment:5 by , 11 years ago
We made a small debug session and here is the result. I'll also put the debug patch.
# a -> a [BEFORE_SWITCH] 0x10 SDL_KEYDOWN [BEFORE_SWITCH] 0x10 SDL_KEYUP # a -> a [BEFORE_SWITCH] 0x10 SDL_KEYDOWN [BEFORE_SWITCH] 0x10 SDL_KEYUP # CAPS_LOCK (we can see SDL sends KEYDOWN and then KEYUP for CAPS LOCK like for normal keys so when we press caps lock once, the guest sees it pressed twice...) [BEFORE_SWITCH] 0x3a SDL_KEYDOWN [IN_CASE] 0x3a SDL_KEYDOWN [BEFORE_SWITCH] 0x10 SDL_KEYUP [IN_CASE] 0x3a SDL_KEYDOWN # a -> a (should be A, the FORCE CAPS LOCK code is called too late) [BEFORE_SWITCH] 0x10 SDL_KEYDOWN [BEFORE_SWITCH] 0x10 SDL_KEYUP [FORCE CAPS_LOCK] (gcGuestCapsLockAdaptations : 2 - gfGuestCapsLockPressed : 0 - SDL_GetModeState() & KMODS_CAPS: 8192) # a -> A [BEFORE_SWITCH] 0x10 SDL_KEYDOWN [BEFORE_SWITCH] 0x10 SDL_KEYUP # a -> A [BEFORE_SWITCH] 0x10 SDL_KEYDOWN [BEFORE_SWITCH] 0x10 SDL_KEYUP
by , 11 years ago
Attachment: | debug.patch added |
---|
comment:6 by , 11 years ago
Looking at the source shows that libSDL 1.2.14 added the environment variable Debian was using to the official sources but reversed its meaning.
comment:7 by , 11 years ago
Please try this patch:
Index: src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp =================================================================== --- src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp (revision 93351) +++ src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp (working copy) @@ -743,13 +743,23 @@ * gets inactive, that is KeyPress and KeyRelease are sent when pressing the lock key * to change the mode. The current lock mode is reflected in SDL_GetModState(). * - * Debian patched libSDL to make the lock keys behave like normal keys generating a - * KeyPress/KeyRelease event if the lock key was pressed/released. But the lock status - * is not reflected in the mod status anymore. We disable the Debian-specific extension - * to ensure a defined environment and work around the missing KeyPress/KeyRelease - * events in ProcessKeys(). + * Debian patched libSDL to make the lock keys behave like normal keys + * generating a KeyPress/KeyRelease event if the lock key was + * pressed/released. With the new behaviour, the lock status is not + * reflected in the mod status anymore, but the user can request the old + * behaviour by setting an environment variable. To confuse matters further + * version 1.2.14 (fortunately including the Debian packaged versions) + * adopted the Debian behaviour officially, but inverted the meaning of the + * environment variable to select the new behaviour, keeping the old as the + * default. We disable the new behaviour to ensure a defined environment + * and work around the missing KeyPress/KeyRelease events in ProcessKeys(). */ - RTEnvSet("SDL_DISABLE_LOCK_KEYS", "1"); + { + const SDL_version *pVersion = SDL_Linked_Version(); + if ( SDL_VERSIONNUM(pVersion->major, pVersion->minor, pVersion->patch) + < SDL_VERSIONNUM(1, 2, 14)) + RTEnvSet("SDL_DISABLE_LOCK_KEYS", "1"); + } #endif /*
comment:9 by , 11 years ago
Summary: | Caps Lock bug in SDL Frontend. → Caps Lock bug in SDL Frontend -> fixed in 4.3 series and later releases after 23. April 2014 |
---|
I mixed up the host and guest type. The host is Linux and the guest is Windows.