From 8afcb2416d3010d06c71952369e9ae29adf60d63 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 29 Feb 2020 19:31:58 -0800 Subject: [PATCH] UI: Respect resize flag during graphics init. --- UI/NativeApp.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 10407bf07..e26223f95 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -142,8 +142,6 @@ static UI::Theme ui_theme; ScreenManager *screenManager; std::string config_filename; -bool g_graphicsInited; - // Really need to clean this mess of globals up... but instead I add more :P bool g_TakeScreenshot; static bool isOuya; @@ -792,6 +790,9 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) { ILOG("NativeInitGraphics"); _assert_msg_(G3D, graphicsContext, "No graphics context!"); + // We set this now so any resize during init is processed later. + resized = false; + using namespace Draw; Core_SetGraphicsContext(graphicsContext); g_draw = graphicsContext->GetDrawContext(); @@ -872,7 +873,6 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) { if (gpu) gpu->DeviceRestore(); - g_graphicsInited = true; ILOG("NativeInitGraphics completed"); return true; } @@ -883,7 +883,6 @@ void NativeShutdownGraphics() { if (gpu) gpu->DeviceLost(); - g_graphicsInited = false; ILOG("NativeShutdownGraphics"); #ifdef _WIN32 @@ -1307,12 +1306,8 @@ void NativeMessageReceived(const char *message, const char *value) { void NativeResized() { // NativeResized can come from any thread so we just set a flag, then process it later. - if (g_graphicsInited) { - ILOG("NativeResized - setting flag"); - resized = true; - } else { - ILOG("NativeResized ignored, not initialized"); - } + ILOG("NativeResized - setting flag"); + resized = true; } void NativeSetRestarting() {