SDL-mirror/src/video
Sam Lantinga 572de23fec 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
..
android Fixes Bug 2134 - [Android] Black screen after resume (sometimes) 2013-10-10 00:30:03 -03:00
bwindow Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings 2013-10-20 21:56:15 -07:00
cocoa Corrected typo in source comment. 2013-11-02 11:42:00 +01:00
directfb Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings 2013-10-20 21:56:15 -07:00
dummy Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x) 2013-08-29 08:29:51 -07:00
pandora Made PND_setwindowgrab() a no-op. It was a cut/paste of PND_destroywindow(). 2013-07-15 20:30:04 -04:00
psp OCD fixes: Adds a space after /* (glory to regular expressions!) 2013-08-21 09:47:10 -03:00
raspberry Backed out changeset c8a0b7c05db8, done testing Buildbot changes. 2013-10-20 20:24:00 -04:00
uikit Fixed the status bar visibility in iOS 7 2013-10-20 23:05:53 -07:00
windows Fixed some warnings building for 64-bit Windows 2013-10-21 01:16:16 -07:00
x11 Fixed bug 1990 - focus/keyboard events not generated correctly for multiple windows 2013-11-03 09:55:27 -08:00
SDL_blit.c Check for negative source rectangle in SDL_SoftBlit() (thanks John!) 2013-07-30 20:57:26 -07:00
SDL_blit.h Fixed bug 1638 - Blit Alpha surface bug 2013-08-01 01:29:07 -07:00
SDL_blit_0.c Updated blend semantics so blending uses the following formula: 2013-07-23 08:06:49 -07:00
SDL_blit_1.c Updated blend semantics so blending uses the following formula: 2013-07-23 08:06:49 -07:00
SDL_blit_A.c Removed unused variables (thanks Joseph!) 2013-10-06 13:50:36 -07:00
SDL_blit_auto.c Updated blend semantics so blending uses the following formula: 2013-07-23 08:06:49 -07:00
SDL_blit_auto.h Happy New Year! 2013-02-15 08:47:44 -08:00
SDL_blit_copy.c Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings 2013-10-20 21:56:15 -07:00
SDL_blit_copy.h Happy New Year! 2013-02-15 08:47:44 -08:00
SDL_blit_N.c Added surface conversion support for ARGB2101010 formats 2013-07-07 12:34:21 -07:00
SDL_blit_slow.c Happy New Year! 2013-02-15 08:47:44 -08:00
SDL_blit_slow.h Happy New Year! 2013-02-15 08:47:44 -08:00
SDL_bmp.c Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x) 2013-08-29 08:29:51 -07:00
SDL_clipboard.c Christoph Mallon: Replace strlen(x) == 0 (O(n)) by x[0] == '\0' (O(1)). 2013-08-29 08:30:21 -07:00
SDL_egl.c Fixes Bug #2191,incorrect test for egl_context validity 2013-10-31 10:02:21 -03:00
SDL_egl.h Fixes bug #2037, common EGL code for Android and X11 2013-08-19 16:29:46 -03:00
SDL_fillrect.c Fix a couple of warnings 2013-08-21 10:34:32 -03:00
SDL_pixels.c Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
SDL_pixels_c.h The palette unused value is treated as alpha and updated when setting the colorkey. 2013-03-24 09:51:01 -07:00
SDL_rect.c Fixed bug 2012 - Algorithm logic getting wrong in ComputeOutCode 2013-10-21 00:25:43 -07:00
SDL_rect_c.h Fixed bug 1763 - Constify SDL_UpdateWindowSurfaceRects() 2013-03-19 21:53:33 -07:00
SDL_RLEaccel.c Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
SDL_RLEaccel_c.h Happy New Year! 2013-02-15 08:47:44 -08:00
SDL_shape.c OCD fixes: Adds a space after /* (glory to regular expressions!) 2013-08-21 09:47:10 -03:00
SDL_shape_internals.h Happy New Year! 2013-02-15 08:47:44 -08:00
SDL_stretch.c OCD fixes: Adds a space after /* (glory to regular expressions!) 2013-08-21 09:47:10 -03:00
SDL_surface.c Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings 2013-10-20 21:56:15 -07:00
SDL_sysvideo.h Added SDL_GL_FRAMEBUFFER_SRGB_CAPABLE (thanks, David!). 2013-10-20 21:18:05 -04:00
SDL_video.c Better cleanup if OpenGL initialization fails 2013-10-21 00:15:24 -07:00
sdlgenblit.pl Updated blend semantics so blending uses the following formula: 2013-07-23 08:06:49 -07:00