diff src/events/SDL_keyboard.c @ 3502:98a819296cdc

Whenever a window becomes fullscreen, shown, unminimized, and has input focus it will change the display to the corresponding fullscreen video mode. If it loses any of those properties the desktop mode will be restored.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 01 Dec 2009 08:56:12 +0000
parents 00cace2d9080
children 64ce267332c6
line wrap: on
line diff
--- a/src/events/SDL_keyboard.c	Tue Dec 01 06:15:10 2009 +0000
+++ b/src/events/SDL_keyboard.c	Tue Dec 01 08:56:12 2009 +0000
@@ -652,17 +652,16 @@
     int i;
     SDL_bool focus;
 
-    if (!keyboard || (keyboard->focus == windowID)) {
+    if (!keyboard) {
         return;
     }
 
     /* See if the current window has lost focus */
-    if (keyboard->focus) {
+    if (keyboard->focus && keyboard->focus != windowID) {
         focus = SDL_FALSE;
         for (i = 0; i < SDL_num_keyboards; ++i) {
-            SDL_Keyboard *check;
             if (i != index) {
-                check = SDL_GetKeyboard(i);
+                SDL_Keyboard *check = SDL_GetKeyboard(i);
                 if (check && check->focus == keyboard->focus) {
                     focus = SDL_TRUE;
                     break;
@@ -678,21 +677,8 @@
     keyboard->focus = windowID;
 
     if (keyboard->focus) {
-        focus = SDL_FALSE;
-        for (i = 0; i < SDL_num_keyboards; ++i) {
-            SDL_Keyboard *check;
-            if (i != index) {
-                check = SDL_GetKeyboard(i);
-                if (check && check->focus == keyboard->focus) {
-                    focus = SDL_TRUE;
-                    break;
-                }
-            }
-        }
-        if (!focus) {
-            SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
-                                0, 0);
-        }
+        SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
+                            0, 0);
     }
 }