Author: tkreuzer
Date: Wed Jan 12 13:22:12 2011
New Revision: 50368
URL:
http://svn.reactos.org/svn/reactos?rev=50368&view=rev
Log:
[EXPLORER_NEW]
Open a context menu, when a task is right clicked.
Patch by greenie (greenie__ at hotmail dot com)
See issue #4671 for more details.
Modified:
trunk/reactos/base/shell/explorer-new/taskswnd.c
Modified: trunk/reactos/base/shell/explorer-new/taskswnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/ta…
==============================================================================
--- trunk/reactos/base/shell/explorer-new/taskswnd.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer-new/taskswnd.c [iso-8859-1] Wed Jan 12 13:22:12
2011
@@ -1715,6 +1715,64 @@
return FALSE;
}
+
+static VOID
+TaskSwitchWnd_HandleTaskItemRightClick(IN OUT PTASK_SWITCH_WND This,
+ IN OUT PTASK_ITEM TaskItem)
+{
+
+ HMENU hmenu = GetSystemMenu(TaskItem->hWnd, FALSE);
+
+ if (hmenu) {
+ POINT pt;
+ GetCursorPos(&pt);
+ int cmd = TrackPopupMenu(hmenu, TPM_LEFTBUTTON|TPM_RIGHTBUTTON|TPM_RETURNCMD,
pt.x, pt.y, 0, This->hWndToolbar, NULL);
+ if (cmd) {
+ SetForegroundWindow(TaskItem->hWnd); // reactivate window after the
context menu has closed
+ PostMessage(TaskItem->hWnd, WM_SYSCOMMAND, cmd, 0);
+ }
+ }
+}
+
+static VOID
+TaskSwitchWnd_HandleTaskGroupRightClick(IN OUT PTASK_SWITCH_WND This,
+ IN OUT PTASK_GROUP TaskGroup)
+{
+ /* TODO: Show task group right click menu */
+}
+
+static BOOL
+TaskSwitchWnd_HandleButtonRightClick(IN OUT PTASK_SWITCH_WND This,
+ IN WORD wIndex)
+{
+ PTASK_ITEM TaskItem;
+ PTASK_GROUP TaskGroup;
+ if (This->IsGroupingEnabled)
+ {
+ TaskGroup = FindTaskGroupByIndex(This,
+ (INT)wIndex);
+ if (TaskGroup != NULL && TaskGroup->IsCollapsed)
+ {
+ TaskSwitchWnd_HandleTaskGroupRightClick(This,
+ TaskGroup);
+ return TRUE;
+ }
+ }
+
+ TaskItem = FindTaskItemByIndex(This,
+ (INT)wIndex);
+
+ if (TaskItem != NULL)
+ {
+ TaskSwitchWnd_HandleTaskItemRightClick(This,
+ TaskItem);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
static LRESULT
TaskSwichWnd_HandleItemPaint(IN OUT PTASK_SWITCH_WND This,
IN OUT NMTBCUSTOMDRAW *nmtbcd)
@@ -2001,7 +2059,8 @@
(LPARAM)&pt);
if (iBtn >= 0)
{
- /* FIXME: Display the system menu of the window */
+ TaskSwitchWnd_HandleButtonRightClick(This,
+ iBtn);
}
else
goto ForwardContextMenuMsg;