[DEVMGR] Ensure clicking on item when opening property sheet (#4196)

Fix a bug related to the device manager, where double-clicking anywhere when an item is already selected opens the property sheet.

CORE-17207
This commit is contained in:
Jesús Sanz del Rey 2021-12-29 16:52:41 +01:00 committed by GitHub
parent dc483bd700
commit 5831427ef9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 1 deletions

View file

@ -124,6 +124,27 @@ CDeviceView::OnSize(
return 0;
}
LRESULT
CDeviceView::OnDoubleClick(
_In_ LPNMHDR NmHdr
)
{
TVHITTESTINFO hitInfo;
HTREEITEM hItem;
GetCursorPos(&hitInfo.pt);
ScreenToClient(m_hTreeView, &hitInfo.pt);
// Check if we are trying to double click an item
hItem = TreeView_HitTest(m_hTreeView, &hitInfo);
if (hItem != NULL && (hitInfo.flags & (TVHT_ONITEM | TVHT_ONITEMICON)))
{
DisplayPropertySheet();
}
return 0;
}
LRESULT
CDeviceView::OnRightClick(
_In_ LPNMHDR NmHdr

View file

@ -45,6 +45,10 @@ public:
_In_ int cy
);
LRESULT OnDoubleClick(
_In_ LPNMHDR NmHdr
);
LRESULT OnRightClick(
_In_ LPNMHDR NmHdr
);

View file

@ -515,7 +515,7 @@ CDeviceManager::OnNotify(_In_ LPARAM lParam)
case NM_DBLCLK:
{
m_DeviceView->DisplayPropertySheet();
Ret = m_DeviceView->OnDoubleClick(NmHdr);
break;
}