Commit a3528a76 authored by Peter Dons Tychsen's avatar Peter Dons Tychsen Committed by Alexandre Julliard

comctl32: Handle WM_NOTIFY correctly when the parent returns zero.

parent b3c38d3d
......@@ -1162,7 +1162,7 @@ STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd)
static LRESULT
STATUSBAR_SendMouseNotify(const STATUS_INFO *infoPtr, UINT code, LPARAM lParam)
STATUSBAR_SendMouseNotify(const STATUS_INFO *infoPtr, UINT code, UINT msg, WPARAM wParam, LPARAM lParam)
{
NMMOUSE nm;
......@@ -1175,7 +1175,12 @@ STATUSBAR_SendMouseNotify(const STATUS_INFO *infoPtr, UINT code, LPARAM lParam)
nm.dwItemSpec = STATUSBAR_InternalHitTest(infoPtr, &nm.pt);
nm.dwItemData = 0;
nm.dwHitInfo = 0x30000; /* seems constant */
SendMessageW(infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nm);
/* Do default processing if WM_NOTIFY returns zero */
if(!SendMessageW(infoPtr->Notify, WM_NOTIFY, nm.hdr.idFrom, (LPARAM)&nm))
{
return DefWindowProcW(infoPtr->Self, msg, wParam, lParam);
}
return 0;
}
......@@ -1276,10 +1281,10 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return STATUSBAR_GetTextLength (infoPtr, 0);
case WM_LBUTTONDBLCLK:
return STATUSBAR_SendMouseNotify(infoPtr, NM_DBLCLK, lParam);
return STATUSBAR_SendMouseNotify(infoPtr, NM_DBLCLK, msg, wParam, lParam);
case WM_LBUTTONUP:
return STATUSBAR_SendMouseNotify(infoPtr, NM_CLICK, lParam);
return STATUSBAR_SendMouseNotify(infoPtr, NM_CLICK, msg, wParam, lParam);
case WM_MOUSEMOVE:
return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam);
......@@ -1303,10 +1308,10 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return STATUSBAR_WMPaint (infoPtr, (HDC)wParam);
case WM_RBUTTONDBLCLK:
return STATUSBAR_SendMouseNotify(infoPtr, NM_RDBLCLK, lParam);
return STATUSBAR_SendMouseNotify(infoPtr, NM_RDBLCLK, msg, wParam, lParam);
case WM_RBUTTONUP:
return STATUSBAR_SendMouseNotify(infoPtr, NM_RCLICK, lParam);
return STATUSBAR_SendMouseNotify(infoPtr, NM_RCLICK, msg, wParam, lParam);
case WM_SETFONT:
return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
......
......@@ -494,6 +494,84 @@ static void test_gettext(void)
DestroyWindow(hwndStatus);
}
/* Notify events to parent */
static BOOL g_got_dblclk;
static BOOL g_got_click;
static BOOL g_got_rdblclk;
static BOOL g_got_rclick;
/* Messages to parent */
static BOOL g_got_contextmenu;
static LRESULT WINAPI test_notify_parent_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_NOTIFY:
{
NMHDR *hdr = ((LPNMHDR)lParam);
switch(hdr->code)
{
case NM_DBLCLK: g_got_dblclk = TRUE; break;
case NM_CLICK: g_got_click = TRUE; break;
case NM_RDBLCLK: g_got_rdblclk = TRUE; break;
case NM_RCLICK: g_got_rclick = TRUE; break;
}
/* Return zero to indicate default processing */
return 0;
}
case WM_CONTEXTMENU: g_got_contextmenu = TRUE; return 0;
default:
return( DefWindowProcA(hwnd, msg, wParam, lParam));
}
return 0;
}
/* Test that WM_NOTIFY messages from the status control works correctly */
static void test_notify(void)
{
HWND hwndParent;
HWND hwndStatus;
ATOM atom;
WNDCLASSA wclass = {0};
wclass.lpszClassName = "TestNotifyParentClass";
wclass.lpfnWndProc = test_notify_parent_proc;
atom = RegisterClassA(&wclass);
ok(atom, "RegisterClass failed!n");
/* create parent */
hwndParent = CreateWindow(wclass.lpszClassName, "parent", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, 300, 20, NULL, NULL, NULL, NULL);
ok(hwndParent != NULL, "Parent creation failed!\n");
/* create status bar */
hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, WS_VISIBLE | WS_CHILD,
0, 0, 300, 20, hwndParent, NULL, NULL, NULL);
ok(hwndStatus != NULL, "Status creation failed!\n");
/* Send various mouse event, and check that we get them */
g_got_dblclk = FALSE;
SendMessage(hwndStatus, WM_LBUTTONDBLCLK, 0, 0);
ok(g_got_dblclk, "WM_LBUTTONDBLCLK was not processed correctly!\n");
g_got_rdblclk = FALSE;
SendMessage(hwndStatus, WM_RBUTTONDBLCLK, 0, 0);
ok(g_got_rdblclk, "WM_RBUTTONDBLCLK was not processed correctly!\n");
g_got_click = FALSE;
SendMessage(hwndStatus, WM_LBUTTONUP, 0, 0);
ok(g_got_click, "WM_LBUTTONUP was not processed correctly!\n");
/* For R-UP, check that we also get the context menu from the default processing */
g_got_contextmenu = FALSE;
g_got_rclick = FALSE;
SendMessage(hwndStatus, WM_RBUTTONUP, 0, 0);
ok(g_got_rclick, "WM_RBUTTONUP was not processed correctly!\n");
ok(g_got_contextmenu, "WM_RBUTTONUP did not activate the context menu!\n");
}
START_TEST(status)
{
hinst = GetModuleHandleA(NULL);
......@@ -512,4 +590,5 @@ START_TEST(status)
test_height();
test_status_ownerdraw();
test_gettext();
test_notify();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment