comctl32: Fix message sequence when right-clicking a treeview

Daniel Jelinski djelinski1 at gmail.com
Tue May 15 13:30:47 CDT 2012


Patch dropped out of the pending list, resending.
-------------- next part --------------
From f940541b3cb1ae82342b7db71fac0f8c39f59b25 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Thu, 19 Apr 2012 22:02:25 +0200
Subject: comctl32: Fix message sequence when right-clicking a treeview

The message sequence obtained from testing native comctl32 was:
- first send NM_RCLICK
- then only if NM_RCLICK returned 0, send WM_CONTEXTMENU to parent
- send the above messages also when clicked below the last item
This fixes the issue described in bug 19222.
---
 dlls/comctl32/treeview.c |   35 ++++++++++-------------------------
 1 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 3f4fdc6..7ea02f3 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -4034,8 +4034,6 @@ TREEVIEW_TrackMouse(const TREEVIEW_INFO *infoPtr, POINT pt)
 	    else if (msg.message >= WM_LBUTTONDOWN &&
 		     msg.message <= WM_RBUTTONDBLCLK)
 	    {
-		if (msg.message == WM_RBUTTONUP)
-		    TREEVIEW_RButtonUp(infoPtr, &pt);
 		break;
 	    }
 
@@ -4250,31 +4248,18 @@ TREEVIEW_RButtonDown(TREEVIEW_INFO *infoPtr, LPARAM lParam)
     }
     else
     {
-	SetFocus(infoPtr->hwnd);
-	TREEVIEW_SendSimpleNotify(infoPtr, NM_RCLICK);
-    }
-
-    return 0;
-}
-
-static LRESULT
-TREEVIEW_RButtonUp(const TREEVIEW_INFO *infoPtr, const POINT *pPt)
-{
-    TVHITTESTINFO ht;
-
-    ht.pt = *pPt;
-
-    TREEVIEW_HitTest(infoPtr, &ht);
-
-    if (ht.hItem)
-    {
-        /* Change to screen coordinate for WM_CONTEXTMENU */
-        ClientToScreen(infoPtr->hwnd, &ht.pt);
+        SetFocus(infoPtr->hwnd);
+        if (!TREEVIEW_SendSimpleNotify(infoPtr, NM_RCLICK))
+        {
+            /* Change to screen coordinate for WM_CONTEXTMENU */
+            ClientToScreen(infoPtr->hwnd, &ht.pt);
 
-        /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
-        SendMessageW(infoPtr->hwnd, WM_CONTEXTMENU,
-            (WPARAM)infoPtr->hwnd, MAKELPARAM(ht.pt.x, ht.pt.y));
+            /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
+            SendMessageW(infoPtr->hwndNotify, WM_CONTEXTMENU,
+                (WPARAM)infoPtr->hwnd, MAKELPARAM(ht.pt.x, ht.pt.y));
+        }
     }
+
     return 0;
 }
 
-- 
1.7.5.4


More information about the wine-patches mailing list