Simple Directmedia Layer
Go to file
Sam Lantinga 0694baf260 Fixed bug 2736 - X11 doesn't set KMOD_NUM and KMOD_CAPS to system state
Zack Middleton

Using X11 (on Debian Wheezy), SDL_GetModState() & KMOD_NUM and KMOD_CAPS are not set to system state (numlock/capslock LEDs). Pressing numlock or capslock toggles the mod state, though if num/caps lock is enabled before starting the program it's still reversed from system state. This makes getting KMOD_NUM and KMOD_CAPS in programs unreliable. This can be seen using the checkkeys test program.

The function that appears to have handle this in SDL 1.2 is X11_SetKeyboardState. The function call is commented out with "FIXME:" in SDL 2.

Using Windows backend through WINE; on first key press if numlock and/or capslock is enabled on system, numlock/capslock SDL_SendKeyboardKey is run and toggles KMOD_NUM/KMOD_CAPS to the correct state. On X11 this does not happen.

The attached patch makes X11 backend set keyboard state on window focus if no window was previously focused. It sets all keys to system up/down state and toggles KMOD_NUM/KMOD_CAPS via SDL_SendKeyboardKey to match system if needed. The patch is based on SDL 1.2's X11_SetKeyboardState.
2015-05-28 09:33:47 -07:00
VisualC Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
VisualC-WinRT Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Xcode Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Xcode-iOS Fixed building the iOS Demo files in debug mode 2015-05-06 12:42:14 -03:00
acinclude Fix a libtool issue with some mingw-w64 cross compilers (thanks, Ozkan!). 2015-05-26 19:54:06 -04:00
android-project Android: Added basic drop file support (thanks, "noxalus"!). 2015-05-26 20:36:45 -04:00
build-scripts Script from Sylvain to automate updating the copyright year 2015-05-26 06:27:12 -07:00
cmake Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
debian Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
docs Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
include X11: Add Xdbe support to message boxes (thanks, Melker!). 2015-05-28 00:30:21 -04:00
premake X11: Add Xdbe support to message boxes (thanks, Melker!). 2015-05-28 00:30:21 -04:00
src Fixed bug 2736 - X11 doesn't set KMOD_NUM and KMOD_CAPS to system state 2015-05-28 09:33:47 -07:00
test Stack hint should look for 0, not -1, and not care about environment variables. 2015-05-26 21:19:23 -04:00
visualtest Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
.hgignore Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Android.mk Android: Replaced spaces with tab in Android.mk file. 2015-05-06 21:11:06 +02:00
BUGS.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
CMakeLists.txt CMake: Slightly better fix for installation target (thanks, Anthony!). 2015-04-22 20:25:19 -04:00
COPYING.txt Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
CREDITS.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
INSTALL.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Makefile.in Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Makefile.minimal Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Makefile.pandora Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Makefile.psp Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
Makefile.wiz Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
README-SDL.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
README.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
SDL2.spec.in Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
TODO.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
VisualC.html Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
WhatsNew.txt Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
autogen.sh Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
cmake_uninstall.cmake.in Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
configure X11: Add Xdbe support to message boxes (thanks, Melker!). 2015-05-28 00:30:21 -04:00
configure.in X11: Add Xdbe support to message boxes (thanks, Melker!). 2015-05-28 00:30:21 -04:00
sdl2-config.in Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
sdl2.m4 Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00
sdl2.pc.in Windows: Always set the system timer resolution to 1ms by default. 2015-04-20 12:22:44 -04:00

README.txt

                         Simple DirectMedia Layer

                                  (SDL)

                                Version 2.0

---
http://www.libsdl.org/

Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games.

More extensive documentation is available in the docs directory, starting
with README.md

Enjoy!
	Sam Lantinga				(slouken@libsdl.org)