src/events/SDL_keyboard.c
changeset 3502 98a819296cdc
parent 3280 00cace2d9080
child 3685 64ce267332c6
     1.1 --- a/src/events/SDL_keyboard.c	Tue Dec 01 06:15:10 2009 +0000
     1.2 +++ b/src/events/SDL_keyboard.c	Tue Dec 01 08:56:12 2009 +0000
     1.3 @@ -652,17 +652,16 @@
     1.4      int i;
     1.5      SDL_bool focus;
     1.6  
     1.7 -    if (!keyboard || (keyboard->focus == windowID)) {
     1.8 +    if (!keyboard) {
     1.9          return;
    1.10      }
    1.11  
    1.12      /* See if the current window has lost focus */
    1.13 -    if (keyboard->focus) {
    1.14 +    if (keyboard->focus && keyboard->focus != windowID) {
    1.15          focus = SDL_FALSE;
    1.16          for (i = 0; i < SDL_num_keyboards; ++i) {
    1.17 -            SDL_Keyboard *check;
    1.18              if (i != index) {
    1.19 -                check = SDL_GetKeyboard(i);
    1.20 +                SDL_Keyboard *check = SDL_GetKeyboard(i);
    1.21                  if (check && check->focus == keyboard->focus) {
    1.22                      focus = SDL_TRUE;
    1.23                      break;
    1.24 @@ -678,21 +677,8 @@
    1.25      keyboard->focus = windowID;
    1.26  
    1.27      if (keyboard->focus) {
    1.28 -        focus = SDL_FALSE;
    1.29 -        for (i = 0; i < SDL_num_keyboards; ++i) {
    1.30 -            SDL_Keyboard *check;
    1.31 -            if (i != index) {
    1.32 -                check = SDL_GetKeyboard(i);
    1.33 -                if (check && check->focus == keyboard->focus) {
    1.34 -                    focus = SDL_TRUE;
    1.35 -                    break;
    1.36 -                }
    1.37 -            }
    1.38 -        }
    1.39 -        if (!focus) {
    1.40 -            SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
    1.41 -                                0, 0);
    1.42 -        }
    1.43 +        SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
    1.44 +                            0, 0);
    1.45      }
    1.46  }
    1.47