Re: regedit: Select a treeitem on right mouse click
On 17.01.2017 12:47, Hugh McMaster wrote:
Fixes https://bugs.winehq.org/show_bug.cgi?id=14606
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)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;
This looks like a workaround, according to https://bugs.winehq.org/show_bug.cgi?id=14606 you should be able to TVM_GETNEXTITEM with TVGN_CARET, as selection should happen automatically.
On Tuesday, 17 January 2017 11:26 PM, Nikolay Sivov wrote:
This looks like a workaround, according to https://bugs.winehq.org/show_bug.cgi?id=14606 you should be able to TVM_GETNEXTITEM with TVGN_CARET, as selection should happen automatically.
Sure, but not at the moment. It looks like comctl32/treeview.c is not providing the correct Windows right-click behaviour. I'll look into it.
participants (2)
-
Hugh McMaster -
Nikolay Sivov