From 9580ae1f0619b89d9064f89e480903103efa22e7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Mar 2014 10:50:37 +0000 Subject: fixes: #502 (Profile manager: context menu can't be reached from the keyboard) #579 (only 10 profiles are visible in Profile Manager) git-svn-id: http://svn.miranda-ng.org/main/trunk@8773 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/database/profilemanager.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/modules/database') diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index ea5b7e1a3b..a221e29a44 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -392,7 +392,7 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, ListView_InsertColumn(hwndList, 0, &col); col.pszText = TranslateT("Driver"); - col.cx = 150; + col.cx = 150 - GetSystemMetrics(SM_CXVSCROLL); ListView_InsertColumn(hwndList, 1, &col); col.pszText = TranslateT("Size"); @@ -455,11 +455,24 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, lvht.pt.x = GET_X_LPARAM(lParam); lvht.pt.y = GET_Y_LPARAM(lParam); ScreenToClient(hwndList, &lvht.pt); - if (ListView_HitTest(hwndList, &lvht) < 0) - break; - lvht.pt.x = GET_X_LPARAM(lParam); - lvht.pt.y = GET_Y_LPARAM(lParam); + if (ListView_HitTest(hwndList, &lvht) < 0) { + if (lParam != -1) + break; + + lvht.iItem = ListView_GetSelectionMark(hwndList); + RECT rc = { 0 }; + if (!ListView_GetItemRect(hwndList, lvht.iItem, &rc, LVIR_LABEL)) + break; + + lvht.pt.x = rc.left; + lvht.pt.y = rc.bottom; + ClientToScreen(hwndList, &lvht.pt); + } + else { + lvht.pt.x = GET_X_LPARAM(lParam); + lvht.pt.y = GET_Y_LPARAM(lParam); + } HMENU hMenu = CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, 1, TranslateT("Run")); -- cgit v1.2.3