mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:52:56 +00:00
[SHELL32] Improve icon selection upon right click (#2063)
If the Right-Clicked item is not being selected, then reset the selection and select the Right-Clicked item. CORE-16519
This commit is contained in:
parent
871d322f92
commit
79b030219f
1 changed files with 18 additions and 5 deletions
|
@ -1426,6 +1426,24 @@ LRESULT CDefView::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &b
|
||||||
if (!m_hContextMenu)
|
if (!m_hContextMenu)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
|
if (lParam != ~0) // unless app key (menu key) was pressed
|
||||||
|
{
|
||||||
|
x = GET_X_LPARAM(lParam);
|
||||||
|
y = GET_Y_LPARAM(lParam);
|
||||||
|
|
||||||
|
LV_HITTESTINFO hittest = { { x, y } };
|
||||||
|
ScreenToClient(&hittest.pt);
|
||||||
|
m_ListView.HitTest(&hittest);
|
||||||
|
|
||||||
|
// Right-Clicked item is selected? If selected, no selection change.
|
||||||
|
// If not selected, then reset the selection and select the item.
|
||||||
|
if ((hittest.flags & LVHT_ONITEM) &&
|
||||||
|
m_ListView.GetItemState(hittest.iItem, LVIS_SELECTED) != LVIS_SELECTED)
|
||||||
|
{
|
||||||
|
SelectItem(hittest.iItem, SVSI_SELECT | SVSI_DESELECTOTHERS | SVSI_ENSUREVISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_cidl = m_ListView.GetSelectedCount();
|
m_cidl = m_ListView.GetSelectedCount();
|
||||||
|
|
||||||
hResult = GetItemObject( m_cidl ? SVGIO_SELECTION : SVGIO_BACKGROUND, IID_PPV_ARG(IContextMenu, &m_pCM));
|
hResult = GetItemObject( m_cidl ? SVGIO_SELECTION : SVGIO_BACKGROUND, IID_PPV_ARG(IContextMenu, &m_pCM));
|
||||||
|
@ -1472,11 +1490,6 @@ LRESULT CDefView::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &b
|
||||||
x = pt.x;
|
x = pt.x;
|
||||||
y = pt.y;
|
y = pt.y;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
x = GET_X_LPARAM(lParam);
|
|
||||||
y = GET_Y_LPARAM(lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
uCommand = TrackPopupMenu(m_hContextMenu,
|
uCommand = TrackPopupMenu(m_hContextMenu,
|
||||||
TPM_LEFTALIGN | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
|
TPM_LEFTALIGN | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue