lower C++ std to c++11 and remove attributes

This commit is contained in:
Altair Wei 2021-10-07 15:23:59 +08:00
parent d8c137d11f
commit 50dafa0c5e
7 changed files with 51 additions and 51 deletions

View File

@ -7,7 +7,7 @@ option(TEST_UNIX "Test UNIX version (from Win32)." OFF)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

View File

@ -32,7 +32,7 @@
FRAMELESSHELPER_BEGIN_NAMESPACE
[[nodiscard]] static inline bool shouldHaveWindowFrame()
static inline bool shouldHaveWindowFrame()
{
if (Utilities::shouldUseNativeTitleBar()) {
// We have to use the original window frame unconditionally if we
@ -56,7 +56,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
struct FramelessHelperWinData
{
[[nodiscard]] bool create() {
bool create() {
if (!m_instance.isNull()) {
return false;
}
@ -64,18 +64,18 @@ struct FramelessHelperWinData
return !m_instance.isNull();
}
[[nodiscard]] bool release() {
bool release() {
if (!m_instance.isNull()) {
m_instance.reset();
}
return m_instance.isNull();
}
[[nodiscard]] bool isNull() const {
bool isNull() const {
return m_instance.isNull();
}
[[nodiscard]] bool install() {
bool install() {
if (isInstalled()) {
return true;
}
@ -89,7 +89,7 @@ struct FramelessHelperWinData
return true;
}
[[nodiscard]] bool uninstall() {
bool uninstall() {
if (!isInstalled()) {
return true;
}
@ -101,7 +101,7 @@ struct FramelessHelperWinData
return true;
}
[[nodiscard]] bool isInstalled() const {
bool isInstalled() const {
return m_installed;
}

View File

@ -105,13 +105,13 @@
#define IsMaximized(window) (IsZoomed(window) != FALSE)
#endif
[[maybe_unused]] constexpr int kAutoHideTaskbarThickness = 2; // The thickness of an auto-hide taskbar in pixels
constexpr int kAutoHideTaskbarThickness = 2; // The thickness of an auto-hide taskbar in pixels
[[maybe_unused]] constexpr char kDwmRegistryKey[] = R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM)";
[[maybe_unused]] constexpr char kPersonalizeRegistryKey[] = R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize)";
constexpr char kDwmRegistryKey[] = R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM)";
constexpr char kPersonalizeRegistryKey[] = R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize)";
[[maybe_unused]] constexpr int kDefaultResizeBorderThicknessClassic = 4;
[[maybe_unused]] constexpr int kDefaultResizeBorderThicknessAero = 8;
[[maybe_unused]] constexpr int kDefaultCaptionHeight = 23;
constexpr int kDefaultResizeBorderThicknessClassic = 4;
constexpr int kDefaultResizeBorderThicknessAero = 8;
constexpr int kDefaultCaptionHeight = 23;
[[maybe_unused]] constexpr WORD _DWMWA_VISIBLE_FRAME_BORDER_THICKNESS = 37;
constexpr WORD _DWMWA_VISIBLE_FRAME_BORDER_THICKNESS = 37;

View File

@ -38,13 +38,13 @@ namespace FramelessWindowsManager
FRAMELESSHELPER_API void addWindow(QWindow *window);
FRAMELESSHELPER_API void removeWindow(QWindow *window);
[[nodiscard]] FRAMELESSHELPER_API bool isWindowFrameless(const QWindow *window);
FRAMELESSHELPER_API bool isWindowFrameless(const QWindow *window);
FRAMELESSHELPER_API void setHitTestVisibleInChrome(QWindow *window, QObject *object, const bool value = true);
[[nodiscard]] FRAMELESSHELPER_API int getResizeBorderThickness(const QWindow *window);
FRAMELESSHELPER_API int getResizeBorderThickness(const QWindow *window);
FRAMELESSHELPER_API void setResizeBorderThickness(QWindow *window, const int value);
[[nodiscard]] FRAMELESSHELPER_API int getTitleBarHeight(const QWindow *window);
FRAMELESSHELPER_API int getTitleBarHeight(const QWindow *window);
FRAMELESSHELPER_API void setTitleBarHeight(QWindow *window, const int value);
[[nodiscard]] FRAMELESSHELPER_API bool getResizable(const QWindow *window);
FRAMELESSHELPER_API bool getResizable(const QWindow *window);
FRAMELESSHELPER_API void setResizable(QWindow *window, const bool value = true);
}

View File

@ -32,30 +32,30 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
namespace Utilities
{
[[nodiscard]] FRAMELESSHELPER_API int getSystemMetric(const QWindow *window, const SystemMetric metric, const bool dpiScale, const bool forceSystemValue = false);
[[nodiscard]] FRAMELESSHELPER_API QWindow *findWindow(const WId winId);
[[nodiscard]] FRAMELESSHELPER_API bool shouldUseNativeTitleBar();
[[nodiscard]] FRAMELESSHELPER_API bool isWindowFixedSize(const QWindow *window);
[[nodiscard]] FRAMELESSHELPER_API bool isHitTestVisibleInChrome(const QWindow *window);
[[nodiscard]] FRAMELESSHELPER_API QPointF mapOriginPointToWindow(const QObject *object);
[[nodiscard]] FRAMELESSHELPER_API QColor getColorizationColor();
[[nodiscard]] FRAMELESSHELPER_API int getWindowVisibleFrameBorderThickness(const WId winId);
[[nodiscard]] FRAMELESSHELPER_API bool shouldAppsUseDarkMode();
[[nodiscard]] FRAMELESSHELPER_API ColorizationArea getColorizationArea();
[[nodiscard]] FRAMELESSHELPER_API bool isThemeChanged(const void *data);
[[nodiscard]] FRAMELESSHELPER_API bool isSystemMenuRequested(const void *data, QPointF *pos);
[[nodiscard]] FRAMELESSHELPER_API bool showSystemMenu(const WId winId, const QPointF &pos);
FRAMELESSHELPER_API int getSystemMetric(const QWindow *window, const SystemMetric metric, const bool dpiScale, const bool forceSystemValue = false);
FRAMELESSHELPER_API QWindow *findWindow(const WId winId);
FRAMELESSHELPER_API bool shouldUseNativeTitleBar();
FRAMELESSHELPER_API bool isWindowFixedSize(const QWindow *window);
FRAMELESSHELPER_API bool isHitTestVisibleInChrome(const QWindow *window);
FRAMELESSHELPER_API QPointF mapOriginPointToWindow(const QObject *object);
FRAMELESSHELPER_API QColor getColorizationColor();
FRAMELESSHELPER_API int getWindowVisibleFrameBorderThickness(const WId winId);
FRAMELESSHELPER_API bool shouldAppsUseDarkMode();
FRAMELESSHELPER_API ColorizationArea getColorizationArea();
FRAMELESSHELPER_API bool isThemeChanged(const void *data);
FRAMELESSHELPER_API bool isSystemMenuRequested(const void *data, QPointF *pos);
FRAMELESSHELPER_API bool showSystemMenu(const WId winId, const QPointF &pos);
#ifdef Q_OS_WINDOWS
[[nodiscard]] FRAMELESSHELPER_API bool isWin8OrGreater();
[[nodiscard]] FRAMELESSHELPER_API bool isWin8Point1OrGreater();
[[nodiscard]] FRAMELESSHELPER_API bool isWin10OrGreater();
[[nodiscard]] FRAMELESSHELPER_API bool isDwmCompositionAvailable();
FRAMELESSHELPER_API bool isWin8OrGreater();
FRAMELESSHELPER_API bool isWin8Point1OrGreater();
FRAMELESSHELPER_API bool isWin10OrGreater();
FRAMELESSHELPER_API bool isDwmCompositionAvailable();
FRAMELESSHELPER_API void triggerFrameChange(const WId winId);
FRAMELESSHELPER_API void updateFrameMargins(const WId winId, const bool reset);
FRAMELESSHELPER_API void updateQtFrameMargins(QWindow *window, const bool enable);
[[nodiscard]] FRAMELESSHELPER_API QString getSystemErrorMessage(const QString &function, const HRESULT hr);
[[nodiscard]] FRAMELESSHELPER_API QString getSystemErrorMessage(const QString &function);
FRAMELESSHELPER_API QString getSystemErrorMessage(const QString &function, const HRESULT hr);
FRAMELESSHELPER_API QString getSystemErrorMessage(const QString &function);
#endif // Q_OS_WINDOWS
#ifdef Q_OS_LINUX

View File

@ -43,13 +43,13 @@ Q_DECLARE_METATYPE(QMargins)
FRAMELESSHELPER_BEGIN_NAMESPACE
[[nodiscard]] static inline QPointF extractMousePositionFromLParam(const LPARAM lParam)
static inline QPointF extractMousePositionFromLParam(const LPARAM lParam)
{
const POINT nativePos = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
return QPointF(static_cast<qreal>(nativePos.x), static_cast<qreal>(nativePos.y));
}
[[nodiscard]] static inline bool isWin10RS1OrGreater()
static inline bool isWin10RS1OrGreater()
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
static const bool result = (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 14393));
@ -59,7 +59,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
return result;
}
[[nodiscard]] static inline bool isWin1019H1OrGreater()
static inline bool isWin1019H1OrGreater()
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
static const bool result = (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 18362));

View File

@ -91,15 +91,15 @@ Q_NAMESPACE_EXPORT(FRAMELESSHELPER_API)
namespace Constants
{
[[maybe_unused]] constexpr char kFramelessModeFlag[] = "_FRAMELESSHELPER_FRAMELESS_MODE";
[[maybe_unused]] constexpr char kResizeBorderThicknessFlag[] = "_FRAMELESSHELPER_RESIZE_BORDER_THICKNESS";
[[maybe_unused]] constexpr char kCaptionHeightFlag[] = "_FRAMELESSHELPER_CAPTION_HEIGHT";
[[maybe_unused]] constexpr char kTitleBarHeightFlag[] = "_FRAMELESSHELPER_TITLE_BAR_HEIGHT";
[[maybe_unused]] constexpr char kHitTestVisibleInChromeFlag[] = "_FRAMELESSHELPER_HIT_TEST_VISIBLE_IN_CHROME";
[[maybe_unused]] constexpr char kUseNativeTitleBarFlag[] = "_FRAMELESSHELPER_USE_NATIVE_TITLE_BAR";
[[maybe_unused]] constexpr char kPreserveNativeFrameFlag[] = "_FRAMELESSHELPER_PRESERVE_NATIVE_WINDOW_FRAME";
[[maybe_unused]] constexpr char kForcePreserveNativeFrameFlag[] = "_FRAMELESSHELPER_FORCE_PRESERVE_NATIVE_WINDOW_FRAME";
[[maybe_unused]] constexpr char kWindowFixedSizeFlag[] = "_FRAMELESSHELPER_WINDOW_FIXED_SIZE";
constexpr char kFramelessModeFlag[] = "_FRAMELESSHELPER_FRAMELESS_MODE";
constexpr char kResizeBorderThicknessFlag[] = "_FRAMELESSHELPER_RESIZE_BORDER_THICKNESS";
constexpr char kCaptionHeightFlag[] = "_FRAMELESSHELPER_CAPTION_HEIGHT";
constexpr char kTitleBarHeightFlag[] = "_FRAMELESSHELPER_TITLE_BAR_HEIGHT";
constexpr char kHitTestVisibleInChromeFlag[] = "_FRAMELESSHELPER_HIT_TEST_VISIBLE_IN_CHROME";
constexpr char kUseNativeTitleBarFlag[] = "_FRAMELESSHELPER_USE_NATIVE_TITLE_BAR";
constexpr char kPreserveNativeFrameFlag[] = "_FRAMELESSHELPER_PRESERVE_NATIVE_WINDOW_FRAME";
constexpr char kForcePreserveNativeFrameFlag[] = "_FRAMELESSHELPER_FORCE_PRESERVE_NATIVE_WINDOW_FRAME";
constexpr char kWindowFixedSizeFlag[] = "_FRAMELESSHELPER_WINDOW_FIXED_SIZE";
}
@ -113,7 +113,7 @@ Q_ENUM_NS(SystemMetric)
enum class ColorizationArea : int
{
NoArea = 0, // None has been defined as a macro in X11 headers.
NoArea = 0, // 'None' has been defined as a macro in X11 headers.
StartMenu_TaskBar_ActionCenter,
TitleBar_WindowBorder,
AllArea