wine: fix a memory error in the window list code
[sugaredwine.git] / patches / 0011-taskbar-show-a-context-menu-on-right-click.patch
blobf30b340f0b17c5efc8bc8b52612e6a84303cf324
1 From e7293d8dc4d36ebf1a2b90c048f352521e9ec678 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
6 ---
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 );
22 if (!taskbar_window)
24 diff --git a/programs/explorer/tasklist.c b/programs/explorer/tasklist.c
25 index dd08a05..ea4efe0 100644
26 --- a/programs/explorer/tasklist.c
27 +++ b/programs/explorer/tasklist.c
28 @@ -23,6 +23,8 @@
30 WINE_DEFAULT_DEBUG_CHANNEL(explorer);
32 +#define WM_POPUPSYSTEMMENU 0x0313
34 static HWND tasklist;
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 update_window_caption(result);
55 refresh_buttons();
56 @@ -262,6 +269,27 @@ static void handle_click(int index)
60 +static LRESULT WINAPI button_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
62 + switch (msg)
63 + {
64 + case WM_RBUTTONUP:
65 + {
66 + POINT pt;
67 + LONG_PTR id;
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));
74 + return 0;
75 + }
76 + }
78 + return CallWindowProcW(orig_button_proc, hwnd, msg, wparam, lparam);
81 static LRESULT WINAPI tasklist_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
83 switch (msg)
84 --
85 1.5.6.5