[1/2] comctl32: Fix message sequence when right-clicking a treeview
Daniel Jelinski
djelinski1 at gmail.com
Mon Jul 2 12:37:36 CDT 2012
Resend from last month
-------------- next part --------------
From e9d9c543589ea2120ac39962d9820699b220a576 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 click was in empty area
This fixes the issue described in bug 19222.
---
dlls/comctl32/treeview.c | 36 ++++++++++--------------------------
1 files changed, 10 insertions(+), 26 deletions(-)
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 8c93f8c..9a14ba9 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -208,7 +208,6 @@ static VOID TREEVIEW_Invalidate(const TREEVIEW_INFO *, const TREEVIEW_ITEM *);
static LRESULT TREEVIEW_DoSelectItem(TREEVIEW_INFO *, INT, HTREEITEM, INT);
static VOID TREEVIEW_SetFirstVisible(TREEVIEW_INFO *, TREEVIEW_ITEM *, BOOL);
static LRESULT TREEVIEW_EnsureVisible(TREEVIEW_INFO *, HTREEITEM, BOOL);
-static LRESULT TREEVIEW_RButtonUp(const TREEVIEW_INFO *, const POINT *);
static LRESULT TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel);
static VOID TREEVIEW_UpdateScrollBars(TREEVIEW_INFO *infoPtr);
static LRESULT TREEVIEW_HScroll(TREEVIEW_INFO *, WPARAM);
@@ -4043,8 +4042,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,31 +4256,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-devel
mailing list