diff --git a/src/Game.c b/src/Game.c index f23a6d9a2..38f3f4e3c 100644 --- a/src/Game.c +++ b/src/Game.c @@ -715,7 +715,7 @@ static void Game_RunLoop(void) { void Game_Run(int width, int height, const String* title) { Window_Create(width, height); Window_SetTitle(title); - Window_SetVisible(true); + Window_Show(); Game_Load(); Event_RaiseVoid(&WindowEvents.Resized); diff --git a/src/Launcher.c b/src/Launcher.c index cbb9cb00b..ef31851ed 100644 --- a/src/Launcher.c +++ b/src/Launcher.c @@ -243,7 +243,7 @@ void Launcher_Run(void) { static const String title = String_FromConst(GAME_APP_TITLE); Window_Create(640, 400); Window_SetTitle(&title); - Window_SetVisible(true); + Window_Show(); Drawer2D_Component.Init(); Game_UpdateDimensions(); diff --git a/src/Window.c b/src/Window.c index ad36989ef..f5f6939d8 100644 --- a/src/Window.c +++ b/src/Window.c @@ -469,14 +469,10 @@ void Clipboard_SetText(const String* value) { } } -void Window_SetVisible(bool visible) { - if (visible) { - ShowWindow(win_handle, SW_SHOW); - BringWindowToTop(win_handle); - SetForegroundWindow(win_handle); - } else { - ShowWindow(win_handle, SW_HIDE); - } +void Window_Show(void) { + ShowWindow(win_handle, SW_SHOW); + BringWindowToTop(win_handle); + SetForegroundWindow(win_handle); } int Window_GetWindowState(void) { @@ -881,13 +877,7 @@ void Clipboard_SetText(const String* value) { XSetSelectionOwner(win_display, xa_clipboard, win_handle, 0); } -void Window_SetVisible(bool visible) { - if (visible) { - XMapWindow(win_display, win_handle); - } else { - XUnmapWindow(win_display, win_handle); - } -} +void Window_Show(void) { XMapWindow(win_display, win_handle); } int Window_GetWindowState(void) { Atom prop_type; @@ -1870,14 +1860,11 @@ void Window_SetTitle(const String* title) { SetWindowTitleWithCFString(win_handle, titleCF); } -void Window_SetVisible(bool visible) { - if (visible) { - ShowWindow(win_handle); - RepositionWindow(win_handle, NULL, kWindowCenterOnMainScreen); - SelectWindow(win_handle); - } else { - HideWindow(win_handle); - } +void Window_Show(void) { + ShowWindow(win_handle); + /* TODO: Do we actually need to reposition */ + RepositionWindow(win_handle, NULL, kWindowCenterOnMainScreen); + SelectWindow(win_handle); } int Window_GetWindowState(void) { @@ -2106,13 +2093,7 @@ void Clipboard_SetText(const String* value) { SDL_SetClipboardText(str); } -void Window_SetVisible(bool visible) { - if (visible) { - SDL_ShowWindow(win_handle); - } else { - SDL_HideWindow(win_handle); - } -} +void Window_Show(void) { SDL_ShowWindow(win_handle); } int Window_GetWindowState(void) { Uint32 flags = SDL_GetWindowFlags(win_handle); @@ -2677,7 +2658,7 @@ void Clipboard_RequestText(RequestClipboardCallback callback, void* obj) { clipboard_obj = obj; } -void Window_SetVisible(bool visible) { } +void Window_Show(void) { } int Window_GetWindowState(void) { EmscriptenFullscreenChangeEvent status; @@ -2994,7 +2975,7 @@ void Clipboard_SetText(const String* value) { /* Always a fullscreen window */ -void Window_SetVisible(bool visible) { } +void Window_Show(void) { } int Window_GetWindowState(void) { return WINDOW_STATE_FULLSCREEN; } void Window_EnterFullscreen(void) { } void Window_ExitFullscreen(void) { } @@ -3746,7 +3727,7 @@ void Window_SetTitle(const String* title) { objc_msgSend(winHandle, sel_registerName("setTitle:"), titleCF); } -void Window_SetVisible(bool visible) { } +void Window_Show(void) { } int Window_GetWindowState(void) { return 0; } void Window_EnterFullscreen(void) { } void Window_ExitFullscreen(void) { } diff --git a/src/Window.h b/src/Window.h index b2fd2f0bf..973fa2c13 100644 --- a/src/Window.h +++ b/src/Window.h @@ -86,8 +86,8 @@ CC_API void Clipboard_SetText(const String* value); /* With emscripten however, the callback is instead called when a 'paste' event arrives. */ void Clipboard_RequestText(RequestClipboardCallback callback, void* obj); -/* Sets whether the window is visible on screen at all. */ -void Window_SetVisible(bool visible); +/* Makes the window visible on screen. */ +void Window_Show(void); /* Gets the current state of the window, see WindowState enum. */ int Window_GetWindowState(void); /* Switches the window to occupy the entire screen. */