1
0
Fork 0

Fix startup detection of numlock and capslock.

Improve behaviour with SDL 1.2.14 with respect to lock keys.
What works:
- dosbox compiled against SDL < 1.2.14 used with SDL < 1.2.14
- dosbox compiled against SDL < 1.2.14 used with SDL >= 1.2.14
- dosbox compiled against SDL >=1.2.14 used with SDL >= 1.2.14
What doesn't work:
- dosbox compiled against SDL >=1.2.14 used with SDL < 1.2.14
- debian/ubuntu SDL < 1.2.14. (Check comment in src/gui/sdlmain.cpp on how to fix it.)
Untested:
- debian/ubuntu SDL >=1.2.14.


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3689
This commit is contained in:
Peter Veenstra 2011-03-24 10:46:56 +00:00
parent 38a357021c
commit b25d481e66
3 changed files with 20 additions and 5 deletions

View file

@ -2362,17 +2362,21 @@ void MAPPER_Init(void) {
if (!MAPPER_LoadBinds()) CreateDefaultBinds();
if (SDL_GetModState()&KMOD_CAPS) {
for (CBindList_it bit=caps_lock_event->bindlist.begin();bit!=caps_lock_event->bindlist.end();bit++) {
(*bit)->ActivateBind(32767,true,true);
#if SDL_VERSION_ATLEAST(1, 2, 14)
(*bit)->ActivateBind(32767,true,false);
(*bit)->DeActivateBind(false);
#else
(*bit)->ActivateBind(32767,true,true); //Skip the action itself as bios_keyboard.cpp handles the startup state.
#endif
}
}
if (SDL_GetModState()&KMOD_NUM) {
for (CBindList_it bit=num_lock_event->bindlist.begin();bit!=num_lock_event->bindlist.end();bit++) {
(*bit)->ActivateBind(32767,true,true);
#if SDL_VERSION_ATLEAST(1, 2, 14)
(*bit)->ActivateBind(32767,true,false);
(*bit)->DeActivateBind(false);
#else
(*bit)->ActivateBind(32767,true,true);
#endif
}
}

View file

@ -1770,6 +1770,10 @@ int main(int argc, char* argv[]) {
/* Init SDL */
#if SDL_VERSION_ATLEAST(1, 2, 14)
/* Or debian/ubuntu with older libsdl version as they have done this themselves, but then differently.
* with this variable they will work correctly. I've only tested the 1.2.14 behaviour against the windows version
* of libsdl
*/
putenv(const_cast<char*>("SDL_DISABLE_LOCK_KEYS=1"));
#endif
if ( SDL_Init( SDL_INIT_AUDIO|SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_CDROM