From 1f0183e21837104249a9855c402a3876f544aec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Zalewski?= Date: Sun, 13 May 2007 21:03:27 +0200 Subject: [PATCH] comctl32: status: Send a NMMOUSE in mouse notifications, not a NMHDR. --- dlls/comctl32/status.c | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c index 522123c7b29..5f09520f27f 100644 --- a/dlls/comctl32/status.c +++ b/dlls/comctl32/status.c @@ -310,6 +310,20 @@ STATUSBAR_Refresh (STATUS_INFO *infoPtr, HDC hdc) } +static int +STATUSBAR_InternalHitTest(const STATUS_INFO *infoPtr, const LPPOINT pt) +{ + int i; + if (infoPtr->simple) + return 255; + + for (i = 0; i < infoPtr->numParts; i++) + if (pt->x >= infoPtr->parts[i].bound.left && pt->x <= infoPtr->parts[i].bound.right) + return i; + return -2; +} + + static void STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr) { @@ -1211,15 +1225,20 @@ STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd) static LRESULT -STATUSBAR_SendNotify (const STATUS_INFO *infoPtr, UINT code) +STATUSBAR_SendMouseNotify(const STATUS_INFO *infoPtr, UINT code, LPARAM lParam) { - NMHDR nmhdr; + NMMOUSE nm; - TRACE("code %04x\n", code); - nmhdr.hwndFrom = infoPtr->Self; - nmhdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID); - nmhdr.code = code; - SendMessageW (infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nmhdr); + TRACE("code %04x, lParam=%lx\n", code, lParam); + nm.hdr.hwndFrom = infoPtr->Self; + nm.hdr.idFrom = GetWindowLongPtrW(infoPtr->Self, GWLP_ID); + nm.hdr.code = code; + nm.pt.x = (short)LOWORD(lParam); + nm.pt.y = (short)HIWORD(lParam); + nm.dwItemSpec = STATUSBAR_InternalHitTest(infoPtr, &nm.pt); + nm.dwItemData = 0; + nm.dwHitInfo = 0x30000; /* seems constant */ + SendMessageW(infoPtr->Notify, WM_NOTIFY, 0, (LPARAM)&nm); return 0; } @@ -1320,10 +1339,10 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return STATUSBAR_GetTextLength (infoPtr, 0); case WM_LBUTTONDBLCLK: - return STATUSBAR_SendNotify (infoPtr, NM_DBLCLK); + return STATUSBAR_SendMouseNotify(infoPtr, NM_DBLCLK, lParam); case WM_LBUTTONUP: - return STATUSBAR_SendNotify (infoPtr, NM_CLICK); + return STATUSBAR_SendMouseNotify(infoPtr, NM_CLICK, lParam); case WM_MOUSEMOVE: return STATUSBAR_Relay2Tip (infoPtr, msg, wParam, lParam); @@ -1347,10 +1366,10 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return STATUSBAR_WMPaint (infoPtr, (HDC)wParam); case WM_RBUTTONDBLCLK: - return STATUSBAR_SendNotify (infoPtr, NM_RDBLCLK); + return STATUSBAR_SendMouseNotify(infoPtr, NM_RDBLCLK, lParam); case WM_RBUTTONUP: - return STATUSBAR_SendNotify (infoPtr, NM_RCLICK); + return STATUSBAR_SendMouseNotify(infoPtr, NM_RCLICK, lParam); case WM_SETFONT: return STATUSBAR_WMSetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));