regedit: Select a treeitem on right mouse click

Nikolay Sivov bunglehead at gmail.com
Tue Jan 17 06:26:08 CST 2017


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 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;
> 

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.



More information about the wine-devel mailing list