Patchwork [1/2] Fix clearing modifiers on focus loss

login
register
mail settings
Submitter Brad Jorsch
Date May 5, 2010, 4:17 a.m.
Message ID <1273033029-15622-2-git-send-email-anomie@users.sourceforge.net>
Download mbox | patch
Permalink /patch/51705/
State New
Headers show

Comments

Brad Jorsch - May 5, 2010, 4:17 a.m.
It seems there is an intention to clear all modifier keys (in the SDL
front-end) when the window loses focus, but it seems that it doesn't
work right. Let's just explicitly do it when we lose input focus.

Signed-off-by: Brad Jorsch <anomie@users.sourceforge.net>
---
 sdl.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch

diff --git a/sdl.c b/sdl.c
index f6fabf1..c155113 100644
--- a/sdl.c
+++ b/sdl.c
@@ -728,6 +728,9 @@  static void sdl_refresh(DisplayState *ds)
             }
             break;
         case SDL_ACTIVEEVENT:
+            if (ev->active.state == SDL_APPINPUTFOCUS && !ev->active.gain) {
+                reset_keys();
+            }
             if (gui_grab && ev->active.state == SDL_APPINPUTFOCUS &&
                 !ev->active.gain && !gui_fullscreen_initial_grab) {
                 sdl_grab_end();