Window_SetVisible -> Window_Show

We never actually need to hide the window, so it's useless having code to do this
This commit is contained in:
UnknownShadow200 2019-09-15 15:57:39 +10:00
parent e06091a9fe
commit ddd81db6e2
4 changed files with 18 additions and 37 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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) { }

View File

@ -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. */