[1/6] comctl32: clean up treeview's mouse tracking code

Daniel Jelinski djelinski1 at gmail.com
Fri Jul 13 14:37:09 CDT 2012


-------------- next part --------------
From e5e9e23854de0722a86f2c04af92e6d2a0f103f2 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Fri, 13 Jul 2012 19:53:40 +0200
Subject: [PATCH 1/6] comctl32: clean up treeview's mouse tracking code

This change does not affect the message order for standard right/left clicks.
It changes the messages send when both buttons are clicked - and this new order better matches whet can be seen with native comctl32.
It also puts NM_RCLICK and WM_CONTEXTMENU in the same function, which will allow me to repair NM_RCLICK behavior.

As another effect, TrackMouse does not reference any treeview-specific code, which will allow it to be reused for listview messages.

The only drawback of this change is that the coordinates sent with WM_CONTEXTMENU are now these from WM_RBUTTONDOWN instead of those from WM_RBUTTONUP, which may be up to 3 pixels away from the current mouse position.
---
 dlls/comctl32/treeview.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 8c93f8c..9e28ee2 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -4043,8 +4043,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;
 	    }
 
@@ -4259,6 +4257,7 @@ TREEVIEW_RButtonDown(TREEVIEW_INFO *infoPtr, LPARAM lParam)
     }
     else
     {
+	TREEVIEW_RButtonUp(infoPtr, &ht.pt);
 	SetFocus(infoPtr->hwnd);
 	TREEVIEW_SendSimpleNotify(infoPtr, NM_RCLICK);
     }
-- 
1.7.5.4


More information about the wine-patches mailing list