diff options
author | Ron Yorston <rmy@pobox.com> | 2024-07-18 15:32:11 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-07-18 15:32:11 +0100 |
commit | 347c877fe9faab6ae6c6d1606006b28a2b3c7b64 (patch) | |
tree | ce938308f019229d6573eb8d474fd94f2a8474f2 | |
parent | b1813ca864ed04f28b8ae0121c913fbe16aab8ee (diff) | |
download | busybox-w32-347c877fe9faab6ae6c6d1606006b28a2b3c7b64.tar.gz busybox-w32-347c877fe9faab6ae6c6d1606006b28a2b3c7b64.tar.bz2 busybox-w32-347c877fe9faab6ae6c6d1606006b28a2b3c7b64.zip |
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)
-rw-r--r-- | shell/ash.c | 13 |
1 files 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) | |||
2981 | DECLARE_PROC_ADDR(BOOL, ShowWindow, HWND, int); | 2981 | DECLARE_PROC_ADDR(BOOL, ShowWindow, HWND, int); |
2982 | 2982 | ||
2983 | if (INIT_PROC_ADDR(user32.dll, ShowWindow)) { | 2983 | if (INIT_PROC_ADDR(user32.dll, ShowWindow)) { |
2984 | BOOL state; | 2984 | BOOL visible = IsWindowVisible(GetConsoleWindow()); |
2985 | BOOL iconified = IsIconic(GetConsoleWindow()); | ||
2985 | 2986 | ||
2986 | if (noiconify) { | 2987 | return !visible || iconified; |
2987 | state = IsWindowVisible(GetConsoleWindow()); | ||
2988 | if (state >= 0) | ||
2989 | return state == 0; | ||
2990 | } else { | ||
2991 | state = IsIconic(GetConsoleWindow()); | ||
2992 | if (state >= 0) | ||
2993 | return state != 0; | ||
2994 | } | ||
2995 | } | 2988 | } |
2996 | return 2; | 2989 | return 2; |
2997 | } | 2990 | } |