Module: wine Branch: stable Commit: 95f2e76bd4bc3bf875ca87414f26d07561efef01 URL: http://source.winehq.org/git/wine.git/?a=commit;h=95f2e76bd4bc3bf875ca87414f... Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Mon Apr 17 09:15:36 2017 +0000 regedit: Select the targeted treeview item on right mouse click. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit ab0d0c6ee4325670f66a68af4f06fbd9acbb6151) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- programs/regedit/childwnd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c index 74e30f8..b24e358 100644 --- a/programs/regedit/childwnd.c +++ b/programs/regedit/childwnd.c @@ -363,9 +363,14 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa break; case WM_CONTEXTMENU: { - int x = GET_X_LPARAM(lParam); - int y = GET_Y_LPARAM(lParam); - TrackPopupMenu(GetSubMenu(hPopupMenus, PM_NEW), TPM_RIGHTBUTTON, x, y, 0, hFrameWnd, NULL); + POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; + TVHITTESTINFO ht; + ht.pt = pt; + ScreenToClient(g_pChildWnd->hTreeWnd, &ht.pt); + if (SendMessageW(g_pChildWnd->hTreeWnd, TVM_HITTEST, 0, (LPARAM)&ht)) + SendMessageW(g_pChildWnd->hTreeWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)ht.hItem); + TrackPopupMenu(GetSubMenu(hPopupMenus, PM_NEW), TPM_RIGHTBUTTON, + pt.x, pt.y, 0, hFrameWnd, NULL); } case WM_KEYDOWN: