diff --git a/app/main.cpp b/app/main.cpp index 9f538b9..4ecbf55 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -24,6 +24,10 @@ #include +#if defined(_WIN32) +# include +#endif + namespace { constexpr i32 kInitialWidth = 1200; @@ -233,6 +237,16 @@ void ProcessMouseEvent(App *app, const MouseEvent &event) { int main(int argc, char **argv) { SDL_SetMainReady(); + // Detach the console when we are its only process (Explorer double-click). + // Keep it when launched from an existing terminal so stderr/stdout still work. +#if defined(_WIN32) + DWORD process_ids[2]; + DWORD count = GetConsoleProcessList(process_ids, 2); + if (count == 1) { + FreeConsole(); + } +#endif + Arena *arena = ArenaAlloc(GB(1)); // --screenshot : draw one frame, save it, exit. Everything else on the