fix a few taskbar context menu bugs including Bugzilla entry 720
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.h
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp
2005-10-17 12:23:19 UTC (rev 18515)
+++ trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp
2005-10-17 12:41:52 UTC (rev 18516)
@@ -194,7 +194,7 @@
Point pt(lparam);
ScreenToClient(_htoolbar, &pt);
- if ((HWND)wparam==_htoolbar && SendMessage(_htoolbar,
TB_HITTEST, 0, (LPARAM)&pt)>0)
+ if ((HWND)wparam==_htoolbar && SendMessage(_htoolbar,
TB_HITTEST, 0, (LPARAM)&pt)>=0)
break; // avoid displaying context menu for
application button _and_ desktop bar at the same time
goto def;}
@@ -258,7 +258,7 @@
(it=_map.find_id(btninfo.idCommand))!=_map.end()) {
//TaskBarEntry& entry = it->second;
- ActivateApp(it, false);
+ ActivateApp(it, false, false); // don't
restore minimized windows on right button click
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of
29.10.2003)
static
DynamicFct<DWORD(STDAPICALLTYPE*)(RESTRICTIONS)>
pSHRestricted(TEXT("SHELL32"), "SHRestricted");
@@ -277,7 +277,7 @@
}
-void TaskBar::ActivateApp(TaskBarMap::iterator it, bool can_minimize)
+void TaskBar::ActivateApp(TaskBarMap::iterator it, bool can_minimize,
bool can_restore)
{
HWND hwnd = it->first;
@@ -285,7 +285,7 @@
(hwnd==GetForegroundWindow() || hwnd==_last_foreground_wnd);
// switch to selected application window
- if (!minimize_it)
+ if (can_restore && !minimize_it)
if (IsIconic(hwnd))
PostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
@@ -312,8 +312,10 @@
GetCursorPos(&pt);
int cmd = TrackPopupMenu(hmenu,
TPM_LEFTBUTTON|TPM_RIGHTBUTTON|TPM_RETURNCMD, pt.x, pt.y, 0, _hwnd,
NULL);
- if (cmd)
+ if (cmd) {
+ ActivateApp(it, false, false); // reactivate
window after the context menu has closed
PostMessage(it->first, WM_SYSCOMMAND, cmd, 0);
+ }
}
}
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.h
--- trunk/reactos/subsys/system/explorer/taskbar/taskbar.h
2005-10-17 12:23:19 UTC (rev 18515)
+++ trunk/reactos/subsys/system/explorer/taskbar/taskbar.h
2005-10-17 12:41:52 UTC (rev 18516)
@@ -94,7 +94,7 @@
int Command(int id, int code);
int Notify(int id, NMHDR* pnmh);
- void ActivateApp(TaskBarMap::iterator it, bool
can_minimize=true);
+ void ActivateApp(TaskBarMap::iterator it, bool
can_minimize=true, bool can_restore=true);
void ShowAppSystemMenu(TaskBarMap::iterator it);
static BOOL CALLBACK EnumWndProc(HWND hwnd, LPARAM lparam);