From 6a84f09c2edfb3fb7d4a34afa66552cef5042355 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sat, 28 Feb 2004 16:05:33 +0000 Subject: [PATCH] compatibility fix for "Sleipnir" web browser: minimizing by clicks on taskbar svn path=/trunk/; revision=8448 --- .../subsys/system/explorer/taskbar/taskbar.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/reactos/subsys/system/explorer/taskbar/taskbar.cpp b/reactos/subsys/system/explorer/taskbar/taskbar.cpp index 7bdbacd741e..5027c0c2ec4 100644 --- a/reactos/subsys/system/explorer/taskbar/taskbar.cpp +++ b/reactos/subsys/system/explorer/taskbar/taskbar.cpp @@ -201,19 +201,22 @@ int TaskBar::Notify(int id, NMHDR* pnmh) void TaskBar::ActivateApp(TaskBarMap::iterator it, bool can_minimize) { HWND hwnd = it->first; + bool minimize_it = can_minimize && (hwnd==GetForegroundWindow() || hwnd==_last_foreground_wnd); - if (can_minimize && (hwnd==GetForegroundWindow() || hwnd==_last_foreground_wnd)) { - PostMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); - _last_foreground_wnd = 0; - } else { - // switch to selected application window + // switch to selected application window + if (!minimize_it) if (IsIconic(hwnd)) PostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); - SetForegroundWindow(hwnd); + // In case minimize_it is true, we _have_ to switch to the app before + // posting SW_MINIMIZE to be compatible with some applications (e.g. "Sleipnir") + SetForegroundWindow(hwnd); + if (minimize_it) { + PostMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); + _last_foreground_wnd = 0; + } else _last_foreground_wnd = hwnd; - } Refresh(); }