From ff5683ec7dbf92b3c4448365d280ed6cfe359edb Mon Sep 17 00:00:00 2001 From: Sine Striker Date: Fri, 25 Aug 2023 18:58:00 +0800 Subject: [PATCH] Fix emulate message bug and git modules --- .gitmodules | 2 +- src/core/framelesshelper_win.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitmodules b/.gitmodules index fc6d054..aa86323 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "cmake"] path = cmake - url = ../cmake-utils.git + url = ../wangwenx190/cmake-utils.git diff --git a/src/core/framelesshelper_win.cpp b/src/core/framelesshelper_win.cpp index 85b3b9c..dabc282 100644 --- a/src/core/framelesshelper_win.cpp +++ b/src/core/framelesshelper_win.cpp @@ -345,19 +345,20 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me #endif // (QT_VERSION < QT_VERSION_CHECK(6, 5, 1)) const auto emulateClientAreaMessage = [hWnd, uMsg, wParam, lParam](const std::optional overrideMessage = std::nullopt) -> void { - const auto wparam = [uMsg, wParam]() -> WPARAM { - if (uMsg == WM_NCMOUSELEAVE) { + auto myMsg = overrideMessage.value_or(uMsg); + const auto wparam = [myMsg, wParam]() -> WPARAM { + if (myMsg == WM_NCMOUSELEAVE) { return kMessageTag; } const quint64 keyState = Utils::getKeyState(); - if ((uMsg >= WM_NCXBUTTONDOWN) && (uMsg <= WM_NCXBUTTONDBLCLK)) { + if ((myMsg >= WM_NCXBUTTONDOWN) && (myMsg <= WM_NCXBUTTONDBLCLK)) { const auto xButtonMask = GET_XBUTTON_WPARAM(wParam); return MAKEWPARAM(keyState, xButtonMask); } return keyState; }(); - const auto lparam = [uMsg, lParam, hWnd]() -> LPARAM { - if (uMsg == WM_NCMOUSELEAVE) { + const auto lparam = [myMsg, lParam, hWnd]() -> LPARAM { + if (myMsg == WM_NCMOUSELEAVE) { return 0; } const auto screenPos = POINT{ GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; @@ -373,7 +374,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me #else # define SEND_MESSAGE ::PostMessageW #endif - switch (overrideMessage.value_or(uMsg)) { + switch (myMsg) { case WM_NCHITTEST: // Treat hit test messages as mouse move events. case WM_NCMOUSEMOVE: SEND_MESSAGE(hWnd, WM_MOUSEMOVE, wparam, lparam);