Simple Directmedia Layer
Go to file
Sam Lantinga f2224e1fc7 Fixed bug 1990 - focus/keyboard events not generated correctly for multiple windows
Mai Lavelle

I've recently tried to create multiple windows and process key events for them, and found that key events weren't being generated for most of the windows. After some investigating I've observed the following effects. All but the most recently created window experience these effects...

- a focus lost event is generated immediately after the focus gained event, even tho window still has focus
- key events report window id 0 rather than the id of the window which has focus, SDL thinks no window has focus?
- giving focus to a non SDL window and then selecting an SDL window causes events to be generated as expected, but only until focus changes again

Focus change events are queued and delayed (200 ticks) before they are dispatched.  The problem occurs when a focus out and focus in event are received on the same tick.  When these delayed events are dispatched they will be sent in the order determined by the window list rather than the order in which they are received.

The focus out dispatch is implemented by calling SDL_SetKeyboardFocus(NULL).  This will remove focus from any window, regardless of whether it is the one originally targeted by the X11 event.

Since SDL_SetKeyboardFocus() will always dispatch a focus lost event as needed, the easiest solution is simply to only call SDL_SetKeyboardFocus(NULL) when SDL_GetKeyboardFocus() matches the target window.
2013-11-03 09:55:27 -08:00
VisualC Fixed project conflict during commit 2013-10-14 09:14:09 -07:00
Xcode Fixed bug 2168 - Mac: SDL_filesystem.h not exported to public header folder when building framework 2013-10-21 02:46:16 -07:00
Xcode-iOS Testing fullscreen window in the accelerometer test. 2013-10-22 21:53:42 -07:00
acinclude Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
android-project Fixed bug 2156 - Android: Accelerometer values fed to joystick driver are inverted for the X axis and wrong for Z 2013-10-20 23:52:02 -07:00
build-scripts Do a full sysroot for the Raspberry Pi buildbot. 2013-10-11 10:58:05 -04:00
cmake Fixed bug 2108 - CMake does not set X11 includes properly for sdl2-config and friends 2013-10-18 00:49:59 -07:00
debian Updated Debian package version to 2.0.1 2013-10-23 16:32:56 -07:00
include Clarified that SDL_memset4 is a 32-bit assignment and fixed a compiler warning 2013-11-03 09:42:23 -08:00
src Fixed bug 1990 - focus/keyboard events not generated correctly for multiple windows 2013-11-03 09:55:27 -08:00
test Changed parameter name for gesture template save functions from "src" to "dst". 2013-11-02 12:07:21 +01:00
.hgignore Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Android.mk Fixed bug 2146 - Enable static linking of libSDL on Android 2013-10-10 21:51:39 -07:00
BUGS.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
CMakeLists.txt Fixed bug 2061 - SDL_filesystem API not built using cmake 2013-10-21 00:22:07 -07:00
COPYING.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
CREDITS.txt Added Julian Winter to the credits for the SDL 2.0 website. 2013-08-12 08:45:37 -07:00
INSTALL.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
Makefile.in Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Makefile.minimal Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Makefile.pandora Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Makefile.psp Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Makefile.wiz Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-SDL.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-android.txt Fixed bug 2146 - Enable static linking of libSDL on Android 2013-10-10 21:51:39 -07:00
README-cmake.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-directfb.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-gesture.txt Changed parameter name for gesture template save functions from "src" to "dst". 2013-11-02 12:07:21 +01:00
README-hg.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-ios.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-macosx.txt Mac: Better handling when someone else is the app delegate. 2013-10-07 16:01:40 -07:00
README-pandora.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-platforms.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-porting.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-psp.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-raspberrypi.txt Prevent keystrokes from leaking through to the console when using evdev. 2013-10-13 17:15:43 -03:00
README-touch.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-wince.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
SDL2.spec.in Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
TODO.txt Added __WINDOWS__ to reflect both 32 and 64-bit windows platforms 2013-10-20 20:41:30 -07:00
VisualC.html Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
WhatsNew.txt Added patch notes for 2.0.1 2013-10-21 22:27:07 -07:00
autogen.sh Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
configure Fixed bug 2149 - Don't search for libusbhid except on BSD 2013-10-13 19:49:45 -07:00
configure.in Fixed bug 2149 - Don't search for libusbhid except on BSD 2013-10-13 19:49:45 -07:00
sdl2-config.in Revert fix for bug 1392 because it breaks linking with mingw32 2013-10-21 10:28:57 -07:00
sdl2.m4 Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
sdl2.pc.in Revert fix for bug 1392 because it breaks linking with mingw32 2013-10-21 10:28:57 -07: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.

SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
Support for other platforms may be found in the source code.

SDL is written in C, works natively with C++, and there are bindings 
available for several other languages, including C# and Python.

This library is distributed under the zlib license, which can be found
in the file "COPYING.txt".

The best way to learn how to use SDL is to check out the header files in
the "include" subdirectory and the programs in the "test" subdirectory.
The header files and test programs are well commented and always up to date.
More documentation and FAQs are available online at:
	http://wiki.libsdl.org/

If you need help with the library, or just want to discuss SDL related
issues, you can join the developers mailing list:
	http://www.libsdl.org/mailing-list.php

Enjoy!
	Sam Lantinga				(slouken@libsdl.org)