[RAPPS] Show listview context menu when the keyboard menu button/Shift+F10 is pressed (#5620)

This commit is contained in:
Whindmar Saksit 2024-08-31 18:30:45 +02:00 committed by GitHub
parent 0197a5bcae
commit 163f3407c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 13 deletions

View file

@ -1569,15 +1569,6 @@ CApplicationView::ProcessWindowMessage(
}
}
break;
case NM_RCLICK:
{
if (((LPNMLISTVIEW)lParam)->iItem != -1)
{
ShowPopupMenuEx(m_hWnd, m_hWnd, 0, ID_INSTALL);
}
}
break;
}
}
else if (pNotifyHeader->hwndFrom == m_Toolbar->GetWindow())
@ -1613,6 +1604,30 @@ CApplicationView::ProcessWindowMessage(
OnCommand(wParam, lParam);
}
break;
case WM_CONTEXTMENU:
{
bool kbd = -1 == (int)(INT_PTR)lParam;
if ((HWND)wParam == m_ListView->m_hWnd)
{
int item = m_ListView->GetNextItem(-1, LVNI_FOCUSED | LVNI_SELECTED);
if (item != -1)
{
POINT *ppt = NULL, pt;
if (kbd)
{
RECT r;
ListView_GetItemRect((HWND)wParam, item, &r, LVIR_LABEL);
pt.x = r.left + (r.right - r.left) / 2;
pt.y = r.top + (r.bottom - r.top) / 2;
::ClientToScreen((HWND)wParam, ppt = &pt);
}
ShowPopupMenuEx(m_hWnd, m_hWnd, 0, ID_INSTALL, ppt);
return TRUE;
}
}
}
break;
}
return FALSE;
}