mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[SHELL32] CDefView: Improve the context menu positioning
Previously we would always show a menu on the focused item, but this should only be done when it is also selected.
This commit is contained in:
parent
7464241ada
commit
c96ba1aff2
1 changed files with 9 additions and 5 deletions
|
@ -1443,15 +1443,19 @@ LRESULT CDefView::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &b
|
||||||
/* There is no position requested, so try to find one */
|
/* There is no position requested, so try to find one */
|
||||||
if (lParam == ~0)
|
if (lParam == ~0)
|
||||||
{
|
{
|
||||||
int lvIndex;
|
HWND hFocus = ::GetFocus();
|
||||||
|
int lvIndex = -1;
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
|
||||||
/* Do we have a focused item, */
|
if (hFocus == m_ListView.m_hWnd || m_ListView.IsChild(hFocus))
|
||||||
if ((lvIndex = m_ListView.GetNextItem(-1, LVIS_FOCUSED)) < 0)
|
|
||||||
{
|
{
|
||||||
/* or a selected item? */
|
/* Is there an item focused and selected? */
|
||||||
lvIndex = m_ListView.GetNextItem(-1, LVIS_SELECTED);
|
lvIndex = m_ListView.GetNextItem(-1, LVIS_SELECTED|LVIS_FOCUSED);
|
||||||
|
/* If not, find the first selected item */
|
||||||
|
if (lvIndex < 0)
|
||||||
|
lvIndex = m_ListView.GetNextItem(-1, LVIS_SELECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We got something */
|
/* We got something */
|
||||||
if (lvIndex > -1)
|
if (lvIndex > -1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue