mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	Remove SDL_WINDOW_SHOW flag, as redundant with SDL_WINDOW_HIDDEN
This commit is contained in:
		| @@ -13,7 +13,7 @@ int main(int argc, char *argv[]) { | ||||
|             "Hello SDL", | ||||
|             SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, | ||||
|             640, 480, | ||||
|             SDL_WINDOW_SHOWN | ||||
|             0 | ||||
|     ); | ||||
|     if (window == NULL) { | ||||
|         fprintf(stderr, "could not create window: %s\n", SDL_GetError()); | ||||
|   | ||||
| @@ -87,7 +87,7 @@ Here's a sample SDL snippet to verify everything is setup in your IDE: | ||||
|         SDL_Renderer* renderer = NULL; | ||||
|  | ||||
|         SDL_Init(SDL_INIT_VIDEO); | ||||
|         window = SDL_CreateWindow("Hello SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN); | ||||
|         window = SDL_CreateWindow("Hello SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, 0); | ||||
|         renderer = SDL_CreateRenderer(window, NULL, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); | ||||
|   | ||||
|         SDL_DestroyRenderer(renderer); | ||||
|   | ||||
| @@ -103,7 +103,6 @@ typedef enum | ||||
| { | ||||
|     SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window */ | ||||
|     SDL_WINDOW_OPENGL = 0x00000002,             /**< window usable with OpenGL context */ | ||||
|     SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */ | ||||
|     SDL_WINDOW_HIDDEN = 0x00000008,             /**< window is not visible */ | ||||
|     SDL_WINDOW_BORDERLESS = 0x00000010,         /**< no window decoration */ | ||||
|     SDL_WINDOW_RESIZABLE = 0x00000020,          /**< window can be resized */ | ||||
| @@ -656,9 +655,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); | ||||
|  * - `SDL_WINDOW_ALLOW_HIGHDPI`: window should be created in high-DPI mode if | ||||
|  *   supported (>= SDL 2.0.1) | ||||
|  * | ||||
|  * `SDL_WINDOW_SHOWN` is ignored by SDL_CreateWindow(). The SDL_Window is | ||||
|  * implicitly shown if SDL_WINDOW_HIDDEN is not set. `SDL_WINDOW_SHOWN` may be | ||||
|  * queried later using SDL_GetWindowFlags(). | ||||
|  * The SDL_Window is implicitly shown if SDL_WINDOW_HIDDEN is not set. | ||||
|  * | ||||
|  * On Apple's macOS, you **must** set the NSHighResolutionCapable Info.plist | ||||
|  * property to YES, otherwise you will not receive a High-DPI OpenGL canvas. | ||||
|   | ||||
| @@ -84,18 +84,16 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, | ||||
|     } | ||||
|     switch (windowevent) { | ||||
|     case SDL_WINDOWEVENT_SHOWN: | ||||
|         if (window->flags & SDL_WINDOW_SHOWN) { | ||||
|         if (!(window->flags & SDL_WINDOW_HIDDEN)) { | ||||
|             return 0; | ||||
|         } | ||||
|         window->flags &= ~(SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED); | ||||
|         window->flags |= SDL_WINDOW_SHOWN; | ||||
|         SDL_OnWindowShown(window); | ||||
|         break; | ||||
|     case SDL_WINDOWEVENT_HIDDEN: | ||||
|         if (!(window->flags & SDL_WINDOW_SHOWN)) { | ||||
|         if (window->flags & SDL_WINDOW_HIDDEN) { | ||||
|             return 0; | ||||
|         } | ||||
|         window->flags &= ~SDL_WINDOW_SHOWN; | ||||
|         window->flags |= SDL_WINDOW_HIDDEN; | ||||
|         SDL_OnWindowHidden(window); | ||||
|         break; | ||||
|   | ||||
| @@ -32,7 +32,7 @@ static const char *video_usage[] = { | ||||
|     "[--min-geometry WxH]", "[--max-geometry WxH]", "[--logical WxH]", | ||||
|     "[--scale N]", "[--depth N]", "[--refresh R]", "[--vsync]", "[--noframe]", | ||||
|     "[--resizable]", "[--minimize]", "[--maximize]", "[--grab]", "[--keyboard-grab]", | ||||
|     "[--shown]", "[--hidden]", "[--input-focus]", "[--mouse-focus]", | ||||
|     "[--hidden]", "[--input-focus]", "[--mouse-focus]", | ||||
|     "[--flash-on-focus-loss]", "[--allow-highdpi]", "[--confine-cursor X,Y,W,H]", | ||||
|     "[--usable-bounds]" | ||||
| }; | ||||
| @@ -453,10 +453,6 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index) | ||||
|         state->window_flags |= SDL_WINDOW_MAXIMIZED; | ||||
|         return 1; | ||||
|     } | ||||
|     if (SDL_strcasecmp(argv[index], "--shown") == 0) { | ||||
|         state->window_flags |= SDL_WINDOW_SHOWN; | ||||
|         return 1; | ||||
|     } | ||||
|     if (SDL_strcasecmp(argv[index], "--hidden") == 0) { | ||||
|         state->window_flags |= SDL_WINDOW_HIDDEN; | ||||
|         return 1; | ||||
| @@ -690,9 +686,6 @@ static void SDLTest_PrintWindowFlag(char *text, size_t maxlen, Uint32 flag) | ||||
|     case SDL_WINDOW_OPENGL: | ||||
|         SDL_snprintfcat(text, maxlen, "OPENGL"); | ||||
|         break; | ||||
|     case SDL_WINDOW_SHOWN: | ||||
|         SDL_snprintfcat(text, maxlen, "SHOWN"); | ||||
|         break; | ||||
|     case SDL_WINDOW_HIDDEN: | ||||
|         SDL_snprintfcat(text, maxlen, "HIDDEN"); | ||||
|         break; | ||||
| @@ -764,7 +757,6 @@ static void SDLTest_PrintWindowFlags(char *text, size_t maxlen, Uint32 flags) | ||||
|     const Uint32 window_flags[] = { | ||||
|         SDL_WINDOW_FULLSCREEN, | ||||
|         SDL_WINDOW_OPENGL, | ||||
|         SDL_WINDOW_SHOWN, | ||||
|         SDL_WINDOW_HIDDEN, | ||||
|         SDL_WINDOW_BORDERLESS, | ||||
|         SDL_WINDOW_RESIZABLE, | ||||
|   | ||||
| @@ -27,7 +27,7 @@ SDL_Window * | ||||
| SDL_CreateShapedWindow(const char *title, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Uint32 flags) | ||||
| { | ||||
|     SDL_Window *result = NULL; | ||||
|     result = SDL_CreateWindow(title, -1000, -1000, w, h, (flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /* & (~SDL_WINDOW_SHOWN) */); | ||||
|     result = SDL_CreateWindow(title, -1000, -1000, w, h, (flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE)); | ||||
|     if (result != NULL) { | ||||
|         if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) { | ||||
|             SDL_DestroyWindow(result); | ||||
|   | ||||
| @@ -110,7 +110,7 @@ struct SDL_Window | ||||
| }; | ||||
| #define FULLSCREEN_VISIBLE(W)                \ | ||||
|     (((W)->flags & SDL_WINDOW_FULLSCREEN) && \ | ||||
|      ((W)->flags & SDL_WINDOW_SHOWN) &&      \ | ||||
|      !((W)->flags & SDL_WINDOW_HIDDEN) &&      \ | ||||
|      !((W)->flags & SDL_WINDOW_MINIMIZED)) | ||||
|  | ||||
| /* | ||||
|   | ||||
| @@ -2453,7 +2453,7 @@ void SDL_ShowWindow(SDL_Window *window) | ||||
| { | ||||
|     CHECK_WINDOW_MAGIC(window, ); | ||||
|  | ||||
|     if (window->flags & SDL_WINDOW_SHOWN) { | ||||
|     if (!(window->flags & SDL_WINDOW_HIDDEN)) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
| @@ -2467,7 +2467,7 @@ void SDL_HideWindow(SDL_Window *window) | ||||
| { | ||||
|     CHECK_WINDOW_MAGIC(window, ); | ||||
|  | ||||
|     if (!(window->flags & SDL_WINDOW_SHOWN)) { | ||||
|     if (window->flags & SDL_WINDOW_HIDDEN) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
| @@ -2485,7 +2485,7 @@ void SDL_RaiseWindow(SDL_Window *window) | ||||
| { | ||||
|     CHECK_WINDOW_MAGIC(window, ); | ||||
|  | ||||
|     if (!(window->flags & SDL_WINDOW_SHOWN)) { | ||||
|     if (window->flags & SDL_WINDOW_HIDDEN) { | ||||
|         return; | ||||
|     } | ||||
|     if (_this->RaiseWindow) { | ||||
|   | ||||
| @@ -59,7 +59,6 @@ int Android_CreateWindow(_THIS, SDL_Window *window) | ||||
|     window->h = Android_SurfaceHeight; | ||||
|  | ||||
|     window->flags &= ~SDL_WINDOW_HIDDEN; | ||||
|     window->flags |= SDL_WINDOW_SHOWN; /* only one window on Android */ | ||||
|  | ||||
|     /* One window, it always has focus */ | ||||
|     SDL_SetMouseFocus(window); | ||||
|   | ||||
| @@ -1082,7 +1082,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window) | ||||
|         [self windowDidResize:aNotification]; | ||||
|  | ||||
|         /* FIXME: Why does the window get hidden? */ | ||||
|         if (window->flags & SDL_WINDOW_SHOWN) { | ||||
|         if (!(window->flags & SDL_WINDOW_HIDDEN)) { | ||||
|             Cocoa_ShowWindow(SDL_GetVideoDevice(), window); | ||||
|         } | ||||
|     } | ||||
| @@ -1645,9 +1645,9 @@ static int SetupWindowData(_THIS, SDL_Window *window, NSWindow *nswindow, NSView | ||||
|         [data.listener listen:data]; | ||||
|  | ||||
|         if ([nswindow isVisible]) { | ||||
|             window->flags |= SDL_WINDOW_SHOWN; | ||||
|             window->flags &= ~SDL_WINDOW_HIDDEN; | ||||
|         } else { | ||||
|             window->flags &= ~SDL_WINDOW_SHOWN; | ||||
|             window->flags |= SDL_WINDOW_HIDDEN; | ||||
|         } | ||||
|  | ||||
|         { | ||||
|   | ||||
| @@ -378,9 +378,9 @@ static int SetupWindowData(_THIS, SDL_Window *window, HWND hwnd, HWND parent, SD | ||||
|     { | ||||
|         DWORD style = GetWindowLong(hwnd, GWL_STYLE); | ||||
|         if (style & WS_VISIBLE) { | ||||
|             window->flags |= SDL_WINDOW_SHOWN; | ||||
|             window->flags &= ~SDL_WINDOW_HIDDEN; | ||||
|         } else { | ||||
|             window->flags &= ~SDL_WINDOW_SHOWN; | ||||
|             window->flags |= SDL_WINDOW_HIDDEN; | ||||
|         } | ||||
|         if (style & WS_POPUP) { | ||||
|             window->flags |= SDL_WINDOW_BORDERLESS; | ||||
|   | ||||
| @@ -489,7 +489,7 @@ void WINRT_VideoQuit(_THIS) | ||||
|     WINRT_QuitMouse(_this); | ||||
| } | ||||
|  | ||||
| static const Uint32 WINRT_DetectableFlags = SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_SHOWN | SDL_WINDOW_HIDDEN | SDL_WINDOW_MOUSE_FOCUS; | ||||
| static const Uint32 WINRT_DetectableFlags = SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_HIDDEN | SDL_WINDOW_MOUSE_FOCUS; | ||||
|  | ||||
| extern "C" Uint32 | ||||
| WINRT_DetectWindowFlags(SDL_Window *window) | ||||
| @@ -541,7 +541,7 @@ WINRT_DetectWindowFlags(SDL_Window *window) | ||||
|         } | ||||
|  | ||||
|         if (data->coreWindow->Visible) { | ||||
|             latestFlags |= SDL_WINDOW_SHOWN; | ||||
|             latestFlags &= ~SDL_WINDOW_HIDDEN; | ||||
|         } else { | ||||
|             latestFlags |= SDL_WINDOW_HIDDEN; | ||||
|         } | ||||
| @@ -693,7 +693,7 @@ int WINRT_CreateWindow(_THIS, SDL_Window *window) | ||||
|         /* TODO, WinRT: set SDL_Window size, maybe position too, from XAML control */ | ||||
|         window->x = 0; | ||||
|         window->y = 0; | ||||
|         window->flags |= SDL_WINDOW_SHOWN; | ||||
|         window->flags &= ~SDL_WINDOW_HIDDEN; | ||||
|         SDL_SetMouseFocus(NULL);    // TODO: detect this | ||||
|         SDL_SetKeyboardFocus(NULL); // TODO: detect this | ||||
|     } else { | ||||
|   | ||||
| @@ -306,9 +306,9 @@ static int SetupWindowData(_THIS, SDL_Window *window, Window w, BOOL created) | ||||
|         window->w = attrib.width; | ||||
|         window->h = attrib.height; | ||||
|         if (attrib.map_state != IsUnmapped) { | ||||
|             window->flags |= SDL_WINDOW_SHOWN; | ||||
|             window->flags &= SDL_WINDOW_HIDDEN; | ||||
|         } else { | ||||
|             window->flags &= ~SDL_WINDOW_SHOWN; | ||||
|             window->flags |= SDL_WINDOW_HIDDEN; | ||||
|         } | ||||
|         data->visual = attrib.visual; | ||||
|         data->colormap = attrib.colormap; | ||||
|   | ||||
| @@ -20,7 +20,7 @@ SDL_Window *_createVideoSuiteTestWindow(const char *title) | ||||
|     y = SDLTest_RandomIntegerInRange(1, 100); | ||||
|     w = SDLTest_RandomIntegerInRange(320, 1024); | ||||
|     h = SDLTest_RandomIntegerInRange(320, 768); | ||||
|     flags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_BORDERLESS; | ||||
|     flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_BORDERLESS; | ||||
|  | ||||
|     window = SDL_CreateWindow(title, x, y, w, h, flags); | ||||
|     SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,%d)", x, y, w, h, flags); | ||||
| @@ -164,7 +164,7 @@ int video_createWindowVariousPositions(void *arg) | ||||
|  | ||||
|             w = SDLTest_RandomIntegerInRange(32, 96); | ||||
|             h = SDLTest_RandomIntegerInRange(32, 96); | ||||
|             window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN); | ||||
|             window = SDL_CreateWindow(title, x, y, w, h, 0); | ||||
|             SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h); | ||||
|             SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL"); | ||||
|  | ||||
| @@ -220,7 +220,7 @@ int video_createWindowVariousSizes(void *arg) | ||||
|                 break; | ||||
|             } | ||||
|  | ||||
|             window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN); | ||||
|             window = SDL_CreateWindow(title, x, y, w, h, 0); | ||||
|             SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h); | ||||
|             SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL"); | ||||
|  | ||||
| @@ -266,7 +266,7 @@ int video_createWindowVariousFlags(void *arg) | ||||
|             flags = SDL_WINDOW_OPENGL; | ||||
|             break; | ||||
|         case 3: | ||||
|             flags = SDL_WINDOW_SHOWN; | ||||
|             flags = 0; | ||||
|             break; | ||||
|         case 4: | ||||
|             flags = SDL_WINDOW_HIDDEN; | ||||
| @@ -322,7 +322,7 @@ int video_getWindowFlags(void *arg) | ||||
|     Uint32 actualFlags; | ||||
|  | ||||
|     /* Reliable flag set always set in test window */ | ||||
|     flags = SDL_WINDOW_SHOWN; | ||||
|     flags = 0; | ||||
|  | ||||
|     /* Call against new test window */ | ||||
|     window = _createVideoSuiteTestWindow(title); | ||||
| @@ -1753,7 +1753,7 @@ int video_setWindowCenteredOnDisplay(void *arg) | ||||
|             expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2)); | ||||
|             expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2)); | ||||
|  | ||||
|             window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI); | ||||
|             window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_ALLOW_HIGHDPI); | ||||
|             SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h); | ||||
|             SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL"); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sylvain
					Sylvain