comparison src/video/SDL_video.c @ 3701:fb905d5674cc

Fixed showing and hiding fullscreen windows
author Sam Lantinga <slouken@libsdl.org>
date Mon, 01 Feb 2010 01:19:37 +0000
parents f7b03b6838cb
children 9fa97c6b0014
comparison
equal deleted inserted replaced
3700:076c12750bc4 3701:fb905d5674cc
108 #define CHECK_WINDOW_MAGIC(window, retval) \ 108 #define CHECK_WINDOW_MAGIC(window, retval) \
109 if (!_this) { \ 109 if (!_this) { \
110 SDL_UninitializedVideo(); \ 110 SDL_UninitializedVideo(); \
111 return retval; \ 111 return retval; \
112 } \ 112 } \
113 if (!window || window->magic != &_this->window_magic) { \ 113 if (!window || window->magic != &_this->window_magic) { \
114 SDL_SetError("Invalid window"); \ 114 SDL_SetError("Invalid window"); \
115 return retval; \ 115 return retval; \
116 } 116 }
117 117
118 #define CHECK_TEXTURE_MAGIC(texture, retval) \ 118 #define CHECK_TEXTURE_MAGIC(texture, retval) \
119 if (!_this) { \ 119 if (!_this) { \
120 SDL_UninitializedVideo(); \ 120 SDL_UninitializedVideo(); \
121 return retval; \ 121 return retval; \
122 } \ 122 } \
123 if (!texture || texture->magic != &_this->texture_magic) { \ 123 if (!texture || texture->magic != &_this->texture_magic) { \
124 SDL_SetError("Invalid texture"); \ 124 SDL_SetError("Invalid texture"); \
125 return retval; \ 125 return retval; \
126 } 126 }
127 127
128 /* Various local functions */ 128 /* Various local functions */
770 770
771 static void 771 static void
772 SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool attempt) 772 SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool attempt)
773 { 773 {
774 SDL_VideoDisplay *display = window->display; 774 SDL_VideoDisplay *display = window->display;
775 int i;
776 775
777 /* See if we're already processing a window */ 776 /* See if we're already processing a window */
778 if (display->updating_fullscreen) { 777 if (display->updating_fullscreen) {
779 return; 778 return;
780 } 779 }
797 } 796 }
798 } 797 }
799 798
800 if (FULLSCREEN_VISIBLE(window)) { 799 if (FULLSCREEN_VISIBLE(window)) {
801 /* Hide any other fullscreen windows */ 800 /* Hide any other fullscreen windows */
802 for (i = 0; i < display->num_windows; ++i) { 801 SDL_Window *other;
803 SDL_Window *other = &display->windows[i]; 802 for (other = display->windows; other; other = other->next) {
804 if (other != window && FULLSCREEN_VISIBLE(other)) { 803 if (other != window && FULLSCREEN_VISIBLE(other)) {
805 SDL_MinimizeWindow(other); 804 SDL_MinimizeWindow(other);
806 } 805 }
807 } 806 }
808 } 807 }
809 808
810 display->updating_fullscreen = SDL_FALSE; 809 display->updating_fullscreen = SDL_FALSE;
811 810
812 /* See if there are any fullscreen windows */ 811 /* See if there are any fullscreen windows */
813 for (i = 0; i < display->num_windows; ++i) { 812 for (window = display->windows; window; window = window->next) {
814 window = &display->windows[i];
815 if (FULLSCREEN_VISIBLE(window)) { 813 if (FULLSCREEN_VISIBLE(window)) {
816 SDL_DisplayMode fullscreen_mode; 814 SDL_DisplayMode fullscreen_mode;
817 if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) { 815 if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
818 SDL_SetDisplayModeForDisplay(display, &fullscreen_mode); 816 SDL_SetDisplayModeForDisplay(display, &fullscreen_mode);
819 display->fullscreen_window = window; 817 display->fullscreen_window = window;