From 347c877fe9faab6ae6c6d1606006b28a2b3c7b64 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 18 Jul 2024 15:32:11 +0100 Subject: ash: ignore hidden/iconified state Some third-party terminal programs have a hidden console host to interact with console applications. When the busybox-w32 shell was used with such a terminal the hidden console host could be revealed because the shell expected it to be iconified. Since it doesn't much matter in this case whether the console host is hidden or iconified treat these states as equivalent. The user's preference set by the 'noiconify' option will still be respected when a console window is concealed. (GitHub issue #430) --- shell/ash.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/shell/ash.c b/shell/ash.c index 15c0e56a3..4b063217a 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2981,17 +2981,10 @@ static int console_state(void) DECLARE_PROC_ADDR(BOOL, ShowWindow, HWND, int); if (INIT_PROC_ADDR(user32.dll, ShowWindow)) { - BOOL state; + BOOL visible = IsWindowVisible(GetConsoleWindow()); + BOOL iconified = IsIconic(GetConsoleWindow()); - if (noiconify) { - state = IsWindowVisible(GetConsoleWindow()); - if (state >= 0) - return state == 0; - } else { - state = IsIconic(GetConsoleWindow()); - if (state >= 0) - return state != 0; - } + return !visible || iconified; } return 2; } -- cgit v1.2.3-55-g6feb