comctl32: status: send a NMMOUSE in mouse notifications, not a NMHDR (fixes bug #8373)

Mikołaj Zalewski mikolaj at zalewski.pl
Sun May 13 14:04:18 CDT 2007


-------------- next part --------------
From 70978a556ad0510fe3f9f26e7bbbf4eeebee226c Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Miko=C5=82aj_Zalewski?= <mikolaj at zalewski.pl>
Date: Sun, 13 May 2007 21:03:27 +0200
Subject: [PATCH] comctl32: status: send a NMMOUSE in mouse notifications, not a NMHDR (fixes bug #8373)

---
 dlls/comctl32/status.c |   43 +++++++++++++++++++++++++++++++------------
 1 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c
index 522123c..5f09520 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;
-
-    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);
+    NMMOUSE  nm;
+
+    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));
-- 
1.4.4.2


More information about the wine-patches mailing list