[PATCH] comctl32: Improve right-click handling in treeview controls

Hugh McMaster hugh.mcmaster at outlook.com
Tue Apr 4 07:42:49 CDT 2017


Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 dlls/comctl32/treeview.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 74206bd..9a37cf3 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -4347,7 +4347,12 @@ TREEVIEW_RButtonDown(TREEVIEW_INFO *infoPtr, LPARAM lParam)
     ht.pt.x = (short)LOWORD(lParam);
     ht.pt.y = (short)HIWORD(lParam);
 
-    TREEVIEW_HitTest(infoPtr, &ht);
+    if (TREEVIEW_HitTest(infoPtr, &ht))
+    {
+        infoPtr->focusedItem = ht.hItem;
+        TREEVIEW_InvalidateItem(infoPtr, infoPtr->focusedItem);
+        TREEVIEW_InvalidateItem(infoPtr, infoPtr->selectedItem);
+    }
 
     if (TREEVIEW_TrackMouse(infoPtr, ht.pt))
     {
@@ -4368,6 +4373,13 @@ TREEVIEW_RButtonDown(TREEVIEW_INFO *infoPtr, LPARAM lParam)
 	}
     }
 
+    if (ht.hItem)
+    {
+        TREEVIEW_InvalidateItem(infoPtr, infoPtr->focusedItem);
+        infoPtr->focusedItem = infoPtr->selectedItem;
+        TREEVIEW_InvalidateItem(infoPtr, infoPtr->focusedItem);
+    }
+
     return 0;
 }
 
-- 
2.7.4




More information about the wine-patches mailing list