From 67ed7484be88e3be5a5a51f404f1325a569be173 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 20 Aug 2023 12:53:10 +0100 Subject: ash: detect console state on shell start up Set 'noconsole' to match the actual state of the console (normal/ iconified) when the shell is started. Thus ShowWindow() will only be called if the actual state differs from the default or user defined state. Costs 20-24 bytes. (GitHub issue #325) --- win32/mingw.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'win32/mingw.c') diff --git a/win32/mingw.c b/win32/mingw.c index dabb2a2e7..fec6df73a 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -2219,20 +2219,6 @@ int enumerate_links(const char *file, char *name) } #endif -#if ENABLE_ASH_NOCONSOLE -void hide_console(int hide) -{ - DECLARE_PROC_ADDR(BOOL, ShowWindow, HWND, int); - DECLARE_PROC_ADDR(BOOL, IsIconic, HWND); - - if (INIT_PROC_ADDR(user32.dll, ShowWindow) && - INIT_PROC_ADDR(user32.dll, IsIconic)) { - if (IsIconic(GetConsoleWindow()) == !hide) - ShowWindow(GetConsoleWindow(), hide ? SW_MINIMIZE : SW_NORMAL); - } -} -#endif - /* Return the length of the root of a UNC path, i.e. the '//host/share' * component, or 0 if the path doesn't look like that. */ int unc_root_len(const char *dir) -- cgit v1.2.3-55-g6feb