1 From 0f408fe294bf2ca08eca3320deee6f460b7f60a6 Mon Sep 17 00:00:00 2001
2 From: Vincent Povirk <vincent@codeweavers.com>
3 Date: Fri, 29 Aug 2008 08:37:32 -0500
4 Subject: [PATCH] taskbar: show a context menu on right-click
7 programs/explorer/taskbar.c | 2 +-
8 programs/explorer/tasklist.c | 28 ++++++++++++++++++++++++++++
9 2 files changed, 29 insertions(+), 1 deletions(-)
11 diff --git a/programs/explorer/taskbar.c b/programs/explorer/taskbar.c
12 index 0a7becf..f79a4c9 100644
13 --- a/programs/explorer/taskbar.c
14 +++ b/programs/explorer/taskbar.c
15 @@ -178,7 +178,7 @@ void initialize_taskbar(void)
18 /* create the taskbar */
19 - taskbar_window = CreateWindowExW( WS_EX_TOOLWINDOW, classname, winname,
20 + taskbar_window = CreateWindowExW( WS_EX_TOOLWINDOW|WS_EX_NOACTIVATE, classname, winname,
21 WS_POPUP|WS_CLIPCHILDREN, 0, 0, 0, 0, 0, 0, 0, 0 );
24 diff --git a/programs/explorer/tasklist.c b/programs/explorer/tasklist.c
25 index 802345a..a244165 100644
26 --- a/programs/explorer/tasklist.c
27 +++ b/programs/explorer/tasklist.c
30 WINE_DEFAULT_DEBUG_CHANNEL(explorer);
32 +#define WM_POPUPSYSTEMMENU 0x0313
36 static WCHAR classname[] = {'t','a','s','k','l','i','s','t',0};
37 @@ -44,6 +46,9 @@ HWND foreground;
38 #define MAX_BUTTON_WIDTH 150
39 static int button_width = 0;
41 +static LRESULT WINAPI button_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
42 +WNDPROC orig_button_proc = NULL;
44 /* get the index of a window in the toplevels list; this can change */
45 static int get_toplevel(HWND hwnd)
47 @@ -114,6 +119,8 @@ static int add_hwnd(HWND hwnd)
49 toplevels[result].button = CreateWindowW(buttonW, buttonW, WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_LEFT, 0, 0, 0, 0, tasklist, (HMENU)result, NULL, NULL);
51 + orig_button_proc = (WNDPROC)SetWindowLongPtrW(toplevels[result].button, GWLP_WNDPROC, (LONG_PTR)button_wndproc);
53 toplevels[result].caption = NULL;
55 update_window_caption(result);
56 @@ -264,6 +271,27 @@ static void handle_click(int index)
60 +static LRESULT WINAPI button_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
68 + id = GetWindowLongPtrW(hwnd, GWLP_ID);
69 + pt.x = LOWORD(lparam);
70 + pt.y = HIWORD(lparam);
71 + ClientToScreen(hwnd, &pt);
72 + SetForegroundWindow(toplevels[id].hwnd);
73 + PostMessageW(toplevels[id].hwnd, WM_POPUPSYSTEMMENU, 0, MAKELONG(pt.x, pt.y));
78 + return CallWindowProcW(orig_button_proc, hwnd, msg, wparam, lparam);
81 static LRESULT WINAPI tasklist_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)