From 5078f898257a53295167f22c67005ad1b30d4bf8 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周二, 12 12月 2023 02:53:57 +0800 Subject: [PATCH] Tested MinGW 13.2.0 --- src/core/contexts/abstractwindowcontext.cpp | 2 +- qmsetup | 2 +- src/quick/quickitemdelegate_p.h | 2 +- CMakeLists.txt | 3 +++ src/core/qwkglobal_p.h | 10 ++++++++++ README.md | 10 ++++++++++ examples/CMakeLists.txt | 2 +- src/core/contexts/win32windowcontext.cpp | 9 +++++---- 8 files changed, 32 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 484a03b..b9d18d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,9 @@ if(NOT DEFINED CMAKE_DEBUG_POSTFIX) set(CMAKE_DEBUG_POSTFIX "d") endif() +elseif(MINGW) + set(CMAKE_STATIC_LIBRARY_PREFIX "") + set(CMAKE_SHARED_LIBRARY_PREFIX "") endif() if(QWINDOWKIT_INSTALL) diff --git a/README.md b/README.md index b22601e..fa38f17 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,16 @@ | Compiler | \>=C++17 | MSVC 2019, GCC, Clang | | CMake | \>=3.17 | >=3.20 is recommended | +### Tested Compilers + ++ Windows + + MSVC: 2019, 2022 + + MinGW: 13.2.0 ++ MacOSX + + Clang 14.0.3 ++ Ubuntu + + GCC: 9.4.0 + ## Dependencies + [qmsetup](https://github.com/stdware/qmsetup) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index db45e1a..9c7ff52 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -7,7 +7,7 @@ add_executable(${_target}) qm_configure_target(${_target} ${ARGN}) - qm_add_win_rc(${_target} ICON ../shared/resources/example.ico) + qm_add_win_rc(${_target} ICON ${QWK_EXAMPLES_DIR}/shared/resources/example.ico) qm_add_win_manifest(${_target}) endmacro() diff --git a/qmsetup b/qmsetup index 622dd3b..54a068c 160000 --- a/qmsetup +++ b/qmsetup @@ -1 +1 @@ -Subproject commit 622dd3b8688eaa140c1631ac94862f5ef723c73a +Subproject commit 54a068c54436d87329e483dedc63b594be1762e0 diff --git a/src/core/contexts/abstractwindowcontext.cpp b/src/core/contexts/abstractwindowcontext.cpp index 0dc0a19..d3e8c0f 100644 --- a/src/core/contexts/abstractwindowcontext.cpp +++ b/src/core/contexts/abstractwindowcontext.cpp @@ -7,7 +7,7 @@ namespace QWK { - static volatile constexpr const struct { + QWK_USED static constexpr const struct { const quint32 activeLight = MAKE_RGBA_COLOR(210, 233, 189, 226); const quint32 activeDark = MAKE_RGBA_COLOR(177, 205, 190, 240); const quint32 inactiveLight = MAKE_RGBA_COLOR(193, 195, 211, 203); diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp index 22d9f1c..297c39c 100644 --- a/src/core/contexts/win32windowcontext.cpp +++ b/src/core/contexts/win32windowcontext.cpp @@ -65,7 +65,7 @@ // The thickness of an auto-hide taskbar in pixels. static constexpr const quint8 kAutoHideTaskBarThickness = 2; - static constexpr const struct { + QWK_USED static constexpr const struct { const uint32_t activeLight = MAKE_RGBA_COLOR(110, 110, 110, 255); // #6E6E6E const uint32_t activeDark = MAKE_RGBA_COLOR(51, 51, 51, 255); // #333333 const uint32_t inactiveLight = MAKE_RGBA_COLOR(167, 167, 167, 255); // #A7A7A7 @@ -948,6 +948,7 @@ return true; } + // Whether to show system menu if (systemMenuHandler(hWnd, message, wParam, lParam, result)) { return true; } @@ -955,7 +956,7 @@ return false; // Not handled } - static constexpr const struct { + QWK_USED static constexpr const struct { const WPARAM wParam = 0xF1C9ADD4; const LPARAM lParam = 0xAFB6F4C6; } kMessageTag; @@ -1099,7 +1100,7 @@ LPARAM lParam, LRESULT *result) { switch (message) { case WM_MOUSELEAVE: { - if (wParam == kMessageTag.wParam) { + if (wParam != kMessageTag.wParam) { // Qt will call TrackMouseEvent() to get the WM_MOUSELEAVE message when it // receives WM_MOUSEMOVE messages, and since we are converting every // WM_NCMOUSEMOVE message to WM_MOUSEMOVE message and send it back to the window @@ -1362,7 +1363,7 @@ // this is also the normal behavior of a native Win32 window (but only when the // window is not maximized/fullscreen/minimized, of course). if (isWindowNoState(hWnd)) { - static constexpr const auto kBorderSize = quint8{2}; + static constexpr const quint8 kBorderSize = 2; bool isTop = (nativeLocalPos.y <= kBorderSize); bool isLeft = nativeLocalPos.x <= kBorderSize; bool isRight = (nativeLocalPos.x >= (clientWidth - kBorderSize)); diff --git a/src/core/qwkglobal_p.h b/src/core/qwkglobal_p.h index 1c92541..462ca6b 100644 --- a/src/core/qwkglobal_p.h +++ b/src/core/qwkglobal_p.h @@ -20,4 +20,14 @@ #define MAKE_RGBA_COLOR(r, g, b, a) \ ((quint32) (((a) &0xFF) << 24) | (((r) &0xFF) << 16) | (((g) &0xFF) << 8) | ((b) &0xFF)) +#if defined(Q_CC_MSVC) +# define QWK_NOINLINE __declspec(noinline) +# define QWK_INLINE __forceinline +# define QWK_USED +#else +# define QWK_NOINLINE __attribute__((noinline)) +# define QWK_INLINE __attribute__((always_inline)) +# define QWK_USED __attribute__((used)) +#endif + #endif // QWKGLOBAL_P_H diff --git a/src/quick/quickitemdelegate_p.h b/src/quick/quickitemdelegate_p.h index aaeaf13..6a8bd0d 100644 --- a/src/quick/quickitemdelegate_p.h +++ b/src/quick/quickitemdelegate_p.h @@ -20,7 +20,7 @@ bool isVisible(const QObject *obj) const override; QRect mapGeometryToScene(const QObject *obj) const override; - QWindow * hostWindow(const QObject *host) const override; + QWindow *hostWindow(const QObject *host) const override; bool isHostSizeFixed(const QObject *host) const override; bool isWindowActive(const QObject *host) const override; }; -- Gitblit v1.9.1