comparison 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
comparison
equal deleted inserted replaced
3501:467e67d301f3 3502:98a819296cdc
650 { 650 {
651 SDL_Keyboard *keyboard = SDL_GetKeyboard(index); 651 SDL_Keyboard *keyboard = SDL_GetKeyboard(index);
652 int i; 652 int i;
653 SDL_bool focus; 653 SDL_bool focus;
654 654
655 if (!keyboard || (keyboard->focus == windowID)) { 655 if (!keyboard) {
656 return; 656 return;
657 } 657 }
658 658
659 /* See if the current window has lost focus */ 659 /* See if the current window has lost focus */
660 if (keyboard->focus) { 660 if (keyboard->focus && keyboard->focus != windowID) {
661 focus = SDL_FALSE; 661 focus = SDL_FALSE;
662 for (i = 0; i < SDL_num_keyboards; ++i) { 662 for (i = 0; i < SDL_num_keyboards; ++i) {
663 SDL_Keyboard *check;
664 if (i != index) { 663 if (i != index) {
665 check = SDL_GetKeyboard(i); 664 SDL_Keyboard *check = SDL_GetKeyboard(i);
666 if (check && check->focus == keyboard->focus) { 665 if (check && check->focus == keyboard->focus) {
667 focus = SDL_TRUE; 666 focus = SDL_TRUE;
668 break; 667 break;
669 } 668 }
670 } 669 }
676 } 675 }
677 676
678 keyboard->focus = windowID; 677 keyboard->focus = windowID;
679 678
680 if (keyboard->focus) { 679 if (keyboard->focus) {
681 focus = SDL_FALSE; 680 SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
682 for (i = 0; i < SDL_num_keyboards; ++i) { 681 0, 0);
683 SDL_Keyboard *check;
684 if (i != index) {
685 check = SDL_GetKeyboard(i);
686 if (check && check->focus == keyboard->focus) {
687 focus = SDL_TRUE;
688 break;
689 }
690 }
691 }
692 if (!focus) {
693 SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_GAINED,
694 0, 0);
695 }
696 } 682 }
697 } 683 }
698 684
699 int 685 int
700 SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode) 686 SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode)