aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuutaW <17158086+Trumeet@users.noreply.github.com>2019-06-30 18:16:13 -0700
committerTrumeet <17158086+Trumeet@users.noreply.github.com>2019-06-30 18:16:13 -0700
commita71c1962222419bcc66eaa256c0e4ce7546097c6 (patch)
tree3cf2b2fa22429fd0b5c2e815ad133c5670235cf0
parent18075a43d41d5084ac5ae57a75981e27f2041352 (diff)
downloadAero-a71c1962222419bcc66eaa256c0e4ce7546097c6.tar
Aero-a71c1962222419bcc66eaa256c0e4ce7546097c6.tar.gz
Aero-a71c1962222419bcc66eaa256c0e4ce7546097c6.tar.bz2
Aero-a71c1962222419bcc66eaa256c0e4ce7546097c6.zip
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>
-rw-r--r--src/mingwMain/kotlin/moe/yuuta/aero/Aero.kt14
1 files 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<Int>()
- }
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<Int>()
+ }
ShowWindow(hwnd, nCmdShow)
msgLoop()
}