From a89f19af96a478d2775964da31791a92cb210dfc Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Sat, 25 Jun 2022 19:38:41 +0800 Subject: [PATCH] 2.1.7 release Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- CMakeLists.txt | 2 +- examples/quick/main.cpp | 9 ++ .../Core/framelesshelpercore_global.h | 2 +- src/core/framelesshelpercore.rc | 4 +- src/core/utils_linux.cpp | 110 ++++++++++++------ src/quick/framelesshelperquick.rc | 4 +- src/widgets/framelesshelperwidgets.rc | 4 +- 7 files changed, 92 insertions(+), 43 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a67e1cf..a93fe548 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ cmake_minimum_required(VERSION 3.20) project(FramelessHelper - VERSION 2.1.1.0 + VERSION 2.1.7.0 DESCRIPTION "Cross-platform window customization framework for Qt Widgets and Qt Quick." HOMEPAGE_URL "https://github.com/wangwenx190/framelesshelper/" LANGUAGES CXX diff --git a/examples/quick/main.cpp b/examples/quick/main.cpp index 8bb13479..2e37705a 100644 --- a/examples/quick/main.cpp +++ b/examples/quick/main.cpp @@ -82,6 +82,14 @@ int main(int argc, char *argv[]) #endif const QUrl mainUrl(FRAMELESSHELPER_STRING_LITERAL("qrc:///Demo/qml/MainWindow.qml")); + +#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)) + QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, &application, + [](const QUrl &url){ + qCritical() << "The QML engine failed to create component:" << url; + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); +#else const QMetaObject::Connection connection = QObject::connect( &engine, &QQmlApplicationEngine::objectCreated, &application, [&mainUrl, &connection](QObject *object, const QUrl &url) { @@ -94,6 +102,7 @@ int main(int argc, char *argv[]) QCoreApplication::exit(-1); } }, Qt::QueuedConnection); +#endif engine.load(mainUrl); diff --git a/include/FramelessHelper/Core/framelesshelpercore_global.h b/include/FramelessHelper/Core/framelesshelpercore_global.h index d26f5a31..d630f2ea 100644 --- a/include/FramelessHelper/Core/framelesshelpercore_global.h +++ b/include/FramelessHelper/Core/framelesshelpercore_global.h @@ -175,7 +175,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE [[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_MAJOR = 2; [[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_MINOR = 1; -[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_PATCH = 1; +[[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_PATCH = 7; [[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION_TWEAK = 0; [[maybe_unused]] static constexpr const int FRAMELESSHELPER_VERSION = FRAMELESSHELPER_MAKE_VERSION(FRAMELESSHELPER_VERSION_MAJOR, FRAMELESSHELPER_VERSION_MINOR, diff --git a/src/core/framelesshelpercore.rc b/src/core/framelesshelpercore.rc index 802a8ae8..fccaa3d0 100644 --- a/src/core/framelesshelpercore.rc +++ b/src/core/framelesshelpercore.rc @@ -26,7 +26,7 @@ VS_VERSION_INFO VERSIONINFO FILEVERSION 0,0,0,0 -PRODUCTVERSION 2,1,1,0 +PRODUCTVERSION 2,1,7,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS VS_FF_DEBUG @@ -51,7 +51,7 @@ BEGIN VALUE "OriginalFilename", "FramelessHelperCore.dll" #endif VALUE "ProductName", "FramelessHelper" - VALUE "ProductVersion", "2.1.1.0" + VALUE "ProductVersion", "2.1.7.0" VALUE "InternalName", "FramelessHelperCore" END END diff --git a/src/core/utils_linux.cpp b/src/core/utils_linux.cpp index 993273ab..9d873c32 100644 --- a/src/core/utils_linux.cpp +++ b/src/core/utils_linux.cpp @@ -160,92 +160,132 @@ template quint32 x11_appRootWindow(const int screen) #endif { - if (!qApp) + if (!qApp) { return 0; + } QPlatformNativeInterface *native = qApp->platformNativeInterface(); - if (!native) + if (!native) { return 0; - QScreen *scr = screen == -1 ? QGuiApplication::primaryScreen() : x11_findScreenForVirtualDesktop(screen); - if (!scr) + } + QScreen *scr = ((screen == -1) ? QGuiApplication::primaryScreen() : x11_findScreenForVirtualDesktop(screen)); + if (!scr) { return 0; + } return static_cast(reinterpret_cast(native->nativeResourceForScreen(QByteArrayLiteral("rootwindow"), scr))); } [[maybe_unused]] [[nodiscard]] static inline int x11_appScreen() { - if (!qApp) + if (!qApp) { return 0; + } QPlatformNativeInterface *native = qApp->platformNativeInterface(); - if (!native) + if (!native) { return 0; + } return reinterpret_cast(native->nativeResourceForIntegration(QByteArrayLiteral("x11screen"))); } [[maybe_unused]] [[nodiscard]] static inline quint32 x11_appTime() { - if (!qApp) + if (!qApp) { return 0; + } QPlatformNativeInterface *native = qApp->platformNativeInterface(); - if (!native) + if (!native) { + return 0; + } + QScreen *screen = QGuiApplication::primaryScreen(); + if (!screen) { return 0; - QScreen* screen = QGuiApplication::primaryScreen(); - return static_cast(reinterpret_cast(native->nativeResourceForScreen("apptime", screen))); + } + return static_cast(reinterpret_cast(native->nativeResourceForScreen(QByteArrayLiteral("apptime"), screen))); } [[maybe_unused]] [[nodiscard]] static inline quint32 x11_appUserTime() { - if (!qApp) + if (!qApp) { return 0; + } QPlatformNativeInterface *native = qApp->platformNativeInterface(); - if (!native) + if (!native) { return 0; - QScreen* screen = QGuiApplication::primaryScreen(); - return static_cast(reinterpret_cast(native->nativeResourceForScreen("appusertime", screen))); + } + QScreen *screen = QGuiApplication::primaryScreen(); + if (!screen) { + return 0; + } + return static_cast(reinterpret_cast(native->nativeResourceForScreen(QByteArrayLiteral("appusertime"), screen))); } [[maybe_unused]] [[nodiscard]] static inline quint32 x11_getTimestamp() { - if (!qApp) + if (!qApp) { return 0; + } QPlatformNativeInterface *native = qApp->platformNativeInterface(); - if (!native) + if (!native) { return 0; - QScreen* screen = QGuiApplication::primaryScreen(); - return static_cast(reinterpret_cast(native->nativeResourceForScreen("gettimestamp", screen))); + } + QScreen *screen = QGuiApplication::primaryScreen(); + if (!screen) { + return 0; + } + return static_cast(reinterpret_cast(native->nativeResourceForScreen(QByteArrayLiteral("gettimestamp"), screen))); } [[maybe_unused]] [[nodiscard]] static inline QByteArray x11_nextStartupId() { - if (!qApp) - return QByteArray(); + if (!qApp) { + return {}; + } QPlatformNativeInterface *native = qApp->platformNativeInterface(); - if (!native) - return QByteArray(); - return static_cast(native->nativeResourceForIntegration("startupid")); + if (!native) { + return {}; + } + return static_cast(native->nativeResourceForIntegration(QByteArrayLiteral("startupid"))); } [[maybe_unused]] [[nodiscard]] static inline Display *x11_display() { - if (!qApp) + if (!qApp) { return nullptr; - QPlatformNativeInterface *native = qApp->platformNativeInterface(); - if (!native) + } +#if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)) + using namespace QNativeInterface; + const auto native = qApp->nativeInterface(); +#else + const auto native = qApp->platformNativeInterface(); +#endif + if (!native) { return nullptr; - - void *display = native->nativeResourceForIntegration(QByteArray("display")); - return reinterpret_cast(display); + } +#if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)) + return native->display(); +#else + return reinterpret_cast(native->nativeResourceForIntegration(QByteArrayLiteral("display"))); +#endif } [[maybe_unused]] [[nodiscard]] static inline xcb_connection_t *x11_connection() { - if (!qApp) + if (!qApp) { return nullptr; - QPlatformNativeInterface *native = qApp->platformNativeInterface(); - if (!native) + } +#if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)) + using namespace QNativeInterface; + const auto native = qApp->nativeInterface(); +#else + const auto native = qApp->platformNativeInterface(); +#endif + if (!native) { return nullptr; - - void *connection = native->nativeResourceForIntegration(QByteArray("connection")); - return reinterpret_cast(connection); + } +#if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)) + return native->connection(); +#else + return reinterpret_cast(native->nativeResourceForIntegration(QByteArrayLiteral("connection"))); +#endif } static inline void diff --git a/src/quick/framelesshelperquick.rc b/src/quick/framelesshelperquick.rc index 4e61b877..94b50f91 100644 --- a/src/quick/framelesshelperquick.rc +++ b/src/quick/framelesshelperquick.rc @@ -26,7 +26,7 @@ VS_VERSION_INFO VERSIONINFO FILEVERSION 0,0,0,0 -PRODUCTVERSION 2,1,1,0 +PRODUCTVERSION 2,1,7,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS VS_FF_DEBUG @@ -51,7 +51,7 @@ BEGIN VALUE "OriginalFilename", "FramelessHelperQuick.dll" #endif VALUE "ProductName", "FramelessHelper" - VALUE "ProductVersion", "2.1.1.0" + VALUE "ProductVersion", "2.1.7.0" VALUE "InternalName", "FramelessHelperQuick" END END diff --git a/src/widgets/framelesshelperwidgets.rc b/src/widgets/framelesshelperwidgets.rc index abc1ae97..9b77dfc6 100644 --- a/src/widgets/framelesshelperwidgets.rc +++ b/src/widgets/framelesshelperwidgets.rc @@ -26,7 +26,7 @@ VS_VERSION_INFO VERSIONINFO FILEVERSION 0,0,0,0 -PRODUCTVERSION 2,1,1,0 +PRODUCTVERSION 2,1,7,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS VS_FF_DEBUG @@ -51,7 +51,7 @@ BEGIN VALUE "OriginalFilename", "FramelessHelperWidgets.dll" #endif VALUE "ProductName", "FramelessHelper" - VALUE "ProductVersion", "2.1.1.0" + VALUE "ProductVersion", "2.1.7.0" VALUE "InternalName", "FramelessHelperWidgets" END END