From a71c1962222419bcc66eaa256c0e4ce7546097c6 Mon Sep 17 00:00:00 2001 From: YuutaW <17158086+Trumeet@users.noreply.github.com> Date: Sun, 30 Jun 2019 18:16:13 -0700 Subject: feat: only fetch `nCmdShow` if it's actually going to display the window rather than the dialog Signed-off-by: Trumeet <17158086+Trumeet@users.noreply.github.com> --- src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt b/src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt index c2f6e3d..c1f76de 100644 --- a/src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt +++ b/src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt @@ -7,13 +7,6 @@ import platform.windows.* fun main() { SetProcessDPIAware() val hInstance = GetModuleHandleA(null) - val nCmdShow = memScoped { - val startUpInfo = nativeHeap.alloc<_STARTUPINFOA>() - GetStartupInfoA(startUpInfo.ptr) - val nCmdShow = startUpInfo.wShowWindow - nativeHeap.free(startUpInfo) - return@memScoped nCmdShow.convert() - } val className = "Main Window Class" @@ -71,6 +64,13 @@ fun main() { 0) } } else { + val nCmdShow = memScoped { + val startUpInfo = nativeHeap.alloc<_STARTUPINFOA>() + GetStartupInfoA(startUpInfo.ptr) + val nCmdShow = startUpInfo.wShowWindow + nativeHeap.free(startUpInfo) + return@memScoped nCmdShow.convert() + } ShowWindow(hwnd, nCmdShow) msgLoop() } -- cgit v1.2.3