https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5831427ef91804afd2608…
commit 5831427ef91804afd2608ebd93d0bce1307f164d
Author: Jesús Sanz del Rey <jesussanz2003(a)gmail.com>
AuthorDate: Wed Dec 29 16:52:41 2021 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Dec 29 16:52:41 2021 +0100
[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
---
dll/win32/devmgr/devmgmt/DeviceView.cpp | 21 +++++++++++++++++++++
dll/win32/devmgr/devmgmt/DeviceView.h | 4 ++++
dll/win32/devmgr/devmgmt/MainWindow.cpp | 2 +-
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/dll/win32/devmgr/devmgmt/DeviceView.cpp
b/dll/win32/devmgr/devmgmt/DeviceView.cpp
index 0f8bebe05e5..8fae7fbb601 100644
--- a/dll/win32/devmgr/devmgmt/DeviceView.cpp
+++ b/dll/win32/devmgr/devmgmt/DeviceView.cpp
@@ -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
diff --git a/dll/win32/devmgr/devmgmt/DeviceView.h
b/dll/win32/devmgr/devmgmt/DeviceView.h
index 04a69da10a0..7d6fde223ca 100644
--- a/dll/win32/devmgr/devmgmt/DeviceView.h
+++ b/dll/win32/devmgr/devmgmt/DeviceView.h
@@ -45,6 +45,10 @@ public:
_In_ int cy
);
+ LRESULT OnDoubleClick(
+ _In_ LPNMHDR NmHdr
+ );
+
LRESULT OnRightClick(
_In_ LPNMHDR NmHdr
);
diff --git a/dll/win32/devmgr/devmgmt/MainWindow.cpp
b/dll/win32/devmgr/devmgmt/MainWindow.cpp
index a687d7d9788..a29db2d7576 100644
--- a/dll/win32/devmgr/devmgmt/MainWindow.cpp
+++ b/dll/win32/devmgr/devmgmt/MainWindow.cpp
@@ -515,7 +515,7 @@ CDeviceManager::OnNotify(_In_ LPARAM lParam)
case NM_DBLCLK:
{
- m_DeviceView->DisplayPropertySheet();
+ Ret = m_DeviceView->OnDoubleClick(NmHdr);
break;
}