forked from github_mirror/framelesshelper
misc modifications
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
e9a2abf663
commit
fc92783af9
|
@ -70,18 +70,26 @@ QT_END_NAMESPACE
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||||
# define qExchange(a, b) std::exchange(a, b)
|
# define qExchange(a, b) std::exchange(a, b)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef Q_NAMESPACE_EXPORT // Since 5.14
|
||||||
# define Q_NAMESPACE_EXPORT(...) Q_NAMESPACE
|
# define Q_NAMESPACE_EXPORT(...) Q_NAMESPACE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// QColor can't be constexpr before 5.14
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
# define Q_COLOR_CONSTEXPR constexpr
|
||||||
|
#else
|
||||||
|
# define Q_COLOR_CONSTEXPR
|
||||||
|
#endif
|
||||||
|
|
||||||
// MOC can't handle C++ attributes before 5.15.
|
// MOC can't handle C++ attributes before 5.15.
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||||
# define Q_NODISCARD [[nodiscard]]
|
# define Q_NODISCARD [[nodiscard]]
|
||||||
# define Q_MAYBE_UNUSED [[maybe_unused]]
|
# define Q_MAYBE_UNUSED [[maybe_unused]]
|
||||||
# define Q_CONSTEXPR2 constexpr // There's a Q_CONSTEXPR from Qt, which behaves differently.
|
|
||||||
#else
|
#else
|
||||||
# define Q_NODISCARD
|
# define Q_NODISCARD
|
||||||
# define Q_MAYBE_UNUSED
|
# define Q_MAYBE_UNUSED
|
||||||
# define Q_CONSTEXPR2
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
@ -96,6 +104,10 @@ QT_END_NAMESPACE
|
||||||
# define QUtf8String(str) QString::fromUtf8(str)
|
# define QUtf8String(str) QString::fromUtf8(str)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef Q_GADGET_EXPORT // Since 6.3
|
||||||
|
# define Q_GADGET_EXPORT(...) Q_GADGET
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
|
||||||
using namespace Qt::Literals::StringLiterals;
|
using namespace Qt::Literals::StringLiterals;
|
||||||
#endif
|
#endif
|
||||||
|
@ -214,19 +226,19 @@ Q_NAMESPACE_EXPORT(FRAMELESSHELPER_CORE_API)
|
||||||
# define kDefaultTransparentColor QColorConstants::Transparent
|
# define kDefaultTransparentColor QColorConstants::Transparent
|
||||||
# define kDefaultDarkGrayColor QColorConstants::DarkGray
|
# define kDefaultDarkGrayColor QColorConstants::DarkGray
|
||||||
#else // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
#else // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultBlackColor = {0, 0, 0}; // #000000
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultBlackColor = {0, 0, 0}; // #000000
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultWhiteColor = {255, 255, 255}; // #FFFFFF
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultWhiteColor = {255, 255, 255}; // #FFFFFF
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultTransparentColor = {0, 0, 0, 0};
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultTransparentColor = {0, 0, 0, 0};
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultDarkGrayColor = {169, 169, 169}; // #A9A9A9
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultDarkGrayColor = {169, 169, 169}; // #A9A9A9
|
||||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
#endif // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
|
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultSystemLightColor = {240, 240, 240}; // #F0F0F0
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultSystemLightColor = {240, 240, 240}; // #F0F0F0
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultSystemDarkColor = {32, 32, 32}; // #202020
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultSystemDarkColor = {32, 32, 32}; // #202020
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultFrameBorderActiveColor = {77, 77, 77}; // #4D4D4D
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultFrameBorderActiveColor = {77, 77, 77}; // #4D4D4D
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultFrameBorderInactiveColorDark = {87, 89, 89}; // #575959
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultFrameBorderInactiveColorDark = {87, 89, 89}; // #575959
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultFrameBorderInactiveColorLight = {166, 166, 166}; // #A6A6A6
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultFrameBorderInactiveColorLight = {166, 166, 166}; // #A6A6A6
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultSystemButtonBackgroundColor = {204, 204, 204}; // #CCCCCC
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultSystemButtonBackgroundColor = {204, 204, 204}; // #CCCCCC
|
||||||
[[maybe_unused]] inline Q_CONSTEXPR2 const QColor kDefaultSystemCloseButtonBackgroundColor = {232, 17, 35}; // #E81123
|
[[maybe_unused]] inline Q_COLOR_CONSTEXPR const QColor kDefaultSystemCloseButtonBackgroundColor = {232, 17, 35}; // #E81123
|
||||||
|
|
||||||
[[maybe_unused]] inline const QByteArray kDontOverrideCursorVar
|
[[maybe_unused]] inline const QByteArray kDontOverrideCursorVar
|
||||||
= FRAMELESSHELPER_BYTEARRAY_LITERAL("FRAMELESSHELPER_DONT_OVERRIDE_CURSOR");
|
= FRAMELESSHELPER_BYTEARRAY_LITERAL("FRAMELESSHELPER_DONT_OVERRIDE_CURSOR");
|
||||||
|
|
|
@ -24,10 +24,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <FramelessHelper/Core/private/framelesshelpercore_global_p.h>
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
struct SystemParameters;
|
||||||
class FramelessManager;
|
class FramelessManager;
|
||||||
|
|
||||||
class FRAMELESSHELPER_CORE_API FramelessManagerPrivate : public QObject
|
class FRAMELESSHELPER_CORE_API FramelessManagerPrivate : public QObject
|
||||||
|
@ -51,7 +52,7 @@ public:
|
||||||
Q_NODISCARD QString wallpaper() const;
|
Q_NODISCARD QString wallpaper() const;
|
||||||
Q_NODISCARD Global::WallpaperAspectStyle wallpaperAspectStyle() const;
|
Q_NODISCARD Global::WallpaperAspectStyle wallpaperAspectStyle() const;
|
||||||
|
|
||||||
static void addWindow(FramelessParamsConst params);
|
static void addWindow(const SystemParameters *params);
|
||||||
static void removeWindow(const WId windowId);
|
static void removeWindow(const WId windowId);
|
||||||
|
|
||||||
Q_INVOKABLE void notifySystemThemeHasChangedOrNot();
|
Q_INVOKABLE void notifySystemThemeHasChangedOrNot();
|
||||||
|
|
|
@ -72,7 +72,7 @@ using namespace Global;
|
||||||
[[maybe_unused]] static constexpr const qreal kDefaultNoiseOpacity = 0.04;
|
[[maybe_unused]] static constexpr const qreal kDefaultNoiseOpacity = 0.04;
|
||||||
[[maybe_unused]] static constexpr const qreal kDefaultBlurRadius = 128.0;
|
[[maybe_unused]] static constexpr const qreal kDefaultBlurRadius = 128.0;
|
||||||
|
|
||||||
[[maybe_unused]] static Q_CONSTEXPR2 const QColor kDefaultSystemLightColor2 = {243, 243, 243}; // #F3F3F3
|
[[maybe_unused]] static Q_COLOR_CONSTEXPR const QColor kDefaultSystemLightColor2 = {243, 243, 243}; // #F3F3F3
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||||
FRAMELESSHELPER_STRING_CONSTANT2(NoiseImageFilePath, ":/org.wangwenx190.FramelessHelper/resources/images/noise.png")
|
FRAMELESSHELPER_STRING_CONSTANT2(NoiseImageFilePath, ":/org.wangwenx190.FramelessHelper/resources/images/noise.png")
|
||||||
|
|
|
@ -591,7 +591,7 @@ Q_GLOBAL_STATIC(MacUtilsData, g_macUtilsData);
|
||||||
const auto proxy = new NSWindowProxy(qwindow, nswindow);
|
const auto proxy = new NSWindowProxy(qwindow, nswindow);
|
||||||
g_macUtilsData()->hash.insert(windowId, proxy);
|
g_macUtilsData()->hash.insert(windowId, proxy);
|
||||||
}
|
}
|
||||||
static const auto hook = []() -> int {
|
volatile static const auto hook = []() -> int {
|
||||||
registerUninitializeHook([](){
|
registerUninitializeHook([](){
|
||||||
const QMutexLocker locker(&g_macUtilsData()->mutex);
|
const QMutexLocker locker(&g_macUtilsData()->mutex);
|
||||||
if (g_macUtilsData()->hash.isEmpty()) {
|
if (g_macUtilsData()->hash.isEmpty()) {
|
||||||
|
@ -767,7 +767,7 @@ bool Utils::isBlurBehindWindowSupported()
|
||||||
|
|
||||||
void Utils::registerThemeChangeNotification()
|
void Utils::registerThemeChangeNotification()
|
||||||
{
|
{
|
||||||
static MacOSThemeObserver observer;
|
volatile static MacOSThemeObserver observer;
|
||||||
Q_UNUSED(observer);
|
Q_UNUSED(observer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue