regedit: Select a treeitem on right mouse click

Hugh McMaster hugh.mcmaster at outlook.com
Tue Jan 17 03:47:48 CST 2017


Fixes https://bugs.winehq.org/show_bug.cgi?id=14606

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/regedit/childwnd.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c
index 08eeec1..c9a35be 100644
--- a/programs/regedit/childwnd.c
+++ b/programs/regedit/childwnd.c
@@ -411,8 +411,19 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
 		g_pChildWnd->nFocusPanel = 0;
 		break;
             case NM_RCLICK: {
-		POINT pt;
+                POINT pt, client_pt;
+                TVHITTESTINFO ht;
+                HTREEITEM treeitem;
+                HWND hTree = ((NMHDR *)lParam)->hwndFrom;
+
                 GetCursorPos(&pt);
+                client_pt = pt;
+                ScreenToClient(hWnd, &client_pt);
+                ht.pt = client_pt;
+                treeitem = (HTREEITEM)SendMessageA(hTree, TVM_HITTEST, 0, (LPARAM)&ht);
+                if (!treeitem) return 1;
+                SendMessageW(hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)treeitem);
+
 		TrackPopupMenu(GetSubMenu(hPopupMenus, PM_NEW),
 			       TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
 		break;
-- 
2.7.4




More information about the wine-patches mailing list