From 9279500c18cffc5ed9bfbb8d3b80b6c412f9d185 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao Date: Mon, 28 Aug 2023 11:18:45 +0800 Subject: [PATCH] minor tweaks --- README.md | 5 +++-- src/core/framelesshelper_win.cpp | 21 +++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 87ab32c8..0677367c 100644 --- a/README.md +++ b/README.md @@ -416,14 +416,15 @@ Short answer: it's impossible. Full explaination: of course we can use the same ## Special Thanks -*Ordered by first contribution time* +*Ordered by first contribution time (it may not be very accurate, sorry)* - [Yuhang Zhao](https://github.com/wangwenx190): Help me create this project. This project is mainly based on his code. - [Julien](https://github.com/JulienMaille): Help me test this library on many various environments and help me fix the bugs we found. Contributed many code to improve this library. The MainWindow example is mostly based on his code. - [Altair Wei](https://github.com/altairwei): Help me fix quite some small bugs and give me many important suggestions, the 2.x version is also inspired by his idea during our discussions. - [Kenji Mouri](https://github.com/MouriNaruto): Give me a lot of help on Win32 native developing. - [Dylan Liu](https://github.com/mentalfl0w): Help me improve the build process on macOS. -- [SineStriker](https://github.com/SineStriker): He spent almost a whole week helping me improve the Snap Layout implementation, fix potential bugs and give me a lot of useful suggestions. Without his great effort, the new implementation may never come. +- [SineStriker](https://github.com/SineStriker): Spent over a whole week helping me improve the Snap Layout implementation, fixing potential bugs and also give me a lot of professional and useful suggestions. Without his great effort, the new implementation may never come. +- And also thanks to other contributors not listed here! Without their valuable help, this library wouldn't have such good quality and user experience! ## License diff --git a/src/core/framelesshelper_win.cpp b/src/core/framelesshelper_win.cpp index 5876289e..e492fa4e 100644 --- a/src/core/framelesshelper_win.cpp +++ b/src/core/framelesshelper_win.cpp @@ -103,14 +103,11 @@ enum class WindowPart : quint8 struct FramelessWin32HelperData { SystemParameters params = {}; - - // Store the last result of WM_NCHITTEST, it's helpful to handle WM_MOUSEMOVE and WM_NCMOUSELEAVE + // Store the last hit test result, it's helpful to handle WM_MOUSEMOVE and WM_NCMOUSELEAVE. WindowPart lastHitTestResult = WindowPart::Outside; - - // Store true if we blocked a WM_MOUSELEAVE when mouse moves on chrome button, reset when a - // WM_MOUSELEAVE comes or we manually call TrackMouseEvent + // True if we blocked a WM_MOUSELEAVE when mouse moves on chrome button, false when a + // WM_MOUSELEAVE comes or we manually call TrackMouseEvent(). bool mouseLeaveBlocked = false; - Dpi dpi = {}; #if (QT_VERSION < QT_VERSION_CHECK(6, 5, 1)) QRect restoreGeometry = {}; @@ -471,7 +468,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me } muData.mouseLeaveBlocked = false; } - + switch (uMsg) { #if (QT_VERSION < QT_VERSION_CHECK(5, 9, 0)) // Qt has done this for us since 5.9.0 case WM_NCCREATE: { @@ -990,12 +987,12 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me } return true; } - case WM_MOUSEMOVE: { - if (data.lastHitTestResult != WindowPart::ChromeButton && data.mouseLeaveBlocked) { + case WM_MOUSEMOVE: + if ((data.lastHitTestResult != WindowPart::ChromeButton) && data.mouseLeaveBlocked) { muData.mouseLeaveBlocked = false; std::ignore = requestForMouseLeaveMessage(hWnd, false); } - } break; + break; case WM_NCMOUSEMOVE: case WM_NCLBUTTONDOWN: case WM_NCLBUTTONUP: @@ -1140,10 +1137,10 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me #endif // (QT_VERSION < QT_VERSION_CHECK(6, 5, 1)) data.params.forceChildrenRepaint(500); } break; - case WM_DWMCOMPOSITIONCHANGED: { + case WM_DWMCOMPOSITIONCHANGED: // Re-apply the custom window frame if recovered from the basic theme. std::ignore = Utils::updateWindowFrameMargins(windowId, false); - } break; + break; #if (QT_VERSION < QT_VERSION_CHECK(6, 5, 1)) case WM_ENTERSIZEMOVE: // Sent to a window when the user drags the title bar or the resize border. case WM_EXITSIZEMOVE: // Sent to a window when the user releases the mouse button (from dragging the title bar or the resize border).