From bc6b55b3d3f1048efe15d0e79dc60d348d6836c5 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 4 Feb 2019 00:02:06 -0500 Subject: [PATCH] Hide window when creating, resize/maximize, and *then* show it. --- src/window.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 7a371dfc..66fb4d67 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -200,20 +200,24 @@ Window::Window() { glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); #endif glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE); - - if (settings.windowSize.isZero()) { - glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); - } + glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // Create window - win = glfwCreateWindow(settings.windowSize.x, settings.windowSize.y, "", NULL, NULL); + win = glfwCreateWindow(800, 600, "", NULL, NULL); if (!win) { osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Could not open GLFW window. Does your graphics card support OpenGL 2.0 or greater? If so, make sure you have the latest graphics drivers installed."); exit(1); } glfwSetWindowSizeLimits(win, 800, 600, GLFW_DONT_CARE, GLFW_DONT_CARE); - glfwSetWindowPos(win, settings.windowPos.x, settings.windowPos.y); + if (settings.windowSize.isZero()) { + glfwMaximizeWindow(win); + } + else { + glfwSetWindowPos(win, settings.windowPos.x, settings.windowPos.y); + glfwSetWindowSize(win, settings.windowSize.x, settings.windowSize.y); + } + glfwShowWindow(win); glfwSetWindowUserPointer(win, this); glfwSetInputMode(win, GLFW_LOCK_KEY_MODS, 1);