From ea8d13724433cab8ccf53e76f9b8b553d76141ff Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周三, 08 5月 2024 13:38:24 +0800
Subject: [PATCH] minor tweaks

---
 src/core/contexts/win32windowcontext.cpp |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp
index a448ed6..e32142e 100644
--- a/src/core/contexts/win32windowcontext.cpp
+++ b/src/core/contexts/win32windowcontext.cpp
@@ -1388,8 +1388,7 @@
                                     // menu while Windows will create and execute a new event loop
                                     // until the menu returns
                                     iconButtonClickTime = ::GetTickCount64();
-                                    *result =
-                                        ::DefWindowProcW(hWnd, WM_NCLBUTTONDOWN, wParam, lParam);
+                                    *result = ::DefWindowProcW(hWnd, message, wParam, lParam);
                                     if (iconButtonClickLevel & IconButtonTriggersClose) {
                                         ::PostMessageW(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
                                     }
@@ -2176,14 +2175,23 @@
                         WH_MOUSE,
                         [](int nCode, WPARAM wParam, LPARAM lParam) {
                             if (nCode >= 0) {
-                                if (wParam == WM_LBUTTONDOWN || wParam == WM_LBUTTONDBLCLK) {
-                                    if (wParam == WM_LBUTTONDBLCLK) {
+                                switch (wParam) {
+                                    case WM_LBUTTONDBLCLK:
                                         mouseDoubleClicked = true;
+                                        Q_FALLTHROUGH();
+
+                                        // case WM_POINTERDOWN:
+
+                                    case WM_LBUTTONDOWN: {
+                                        auto pMouseStruct =
+                                            reinterpret_cast<MOUSEHOOKSTRUCT *>(lParam);
+                                        if (pMouseStruct) {
+                                            mouseClickPos = pMouseStruct->pt;
+                                        }
+                                        break;
                                     }
-                                    auto pMouseStruct = reinterpret_cast<MOUSEHOOKSTRUCT *>(lParam);
-                                    if (pMouseStruct) {
-                                        mouseClickPos = pMouseStruct->pt;
-                                    }
+                                    default:
+                                        break;
                                 }
                             }
                             return ::CallNextHookEx(nullptr, nCode, wParam, lParam);

--
Gitblit v1.9.1