win: tweak some enum values

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2023-02-03 11:18:08 +08:00
parent 2040e7c747
commit 3d37d87c81
48 changed files with 80 additions and 67 deletions

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include <framelesshelpercore_global.h>
#include <FramelessHelper/Core/framelesshelpercore_global.h>
/*
* Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett.

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
#include <QtCore/qabstractnativeeventfilter.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -84,7 +84,7 @@
#include <shellapi.h>
#include <dwmapi.h>
#include <framelesshelpercore_global.h>
#include <FramelessHelper/Core/framelesshelpercore_global.h>
#ifndef WM_NCUAHDRAWCAPTION
# define WM_NCUAHDRAWCAPTION (0x00AE)
@ -267,7 +267,7 @@ using _PROCESS_DPI_AWARENESS = enum _PROCESS_DPI_AWARENESS
_PROCESS_DPI_UNAWARE = 0,
_PROCESS_SYSTEM_DPI_AWARE = 1,
_PROCESS_PER_MONITOR_DPI_AWARE = 2,
_PROCESS_PER_MONITOR_DPI_AWARE_V2 = 3,
_PROCESS_PER_MONITOR_V2_DPI_AWARE = 3,
_PROCESS_DPI_UNAWARE_GDISCALED = 4
};
@ -306,7 +306,7 @@ using _DPI_AWARENESS = enum _DPI_AWARENESS
_DPI_AWARENESS_UNAWARE = 0,
_DPI_AWARENESS_SYSTEM_AWARE = 1,
_DPI_AWARENESS_PER_MONITOR_AWARE = 2,
_DPI_AWARENESS_PER_MONITOR_AWARE_V2 = 3,
_DPI_AWARENESS_PER_MONITOR_V2_AWARE = 3,
_DPI_AWARENESS_UNAWARE_GDISCALED = 4
};
@ -380,16 +380,28 @@ using ACCENT_STATE = enum ACCENT_STATE
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
ACCENT_ENABLE_BLURBEHIND = 3, // Traditional DWM blur
ACCENT_ENABLE_ACRYLICBLURBEHIND = 4, // RS4 1803
ACCENT_USE_HOST_BACKDROP = 5, // RS5 1809
ACCENT_ENABLE_HOST_BACKDROP = 5, // RS5 1809
ACCENT_INVALID_STATE = 6 // Using this value will remove the window background
};
using ACCENT_FLAG = enum ACCENT_FLAG
{
ACCENT_NONE = 0,
ACCENT_ENABLE_LUMINOSITY = 1 << 1,
ACCENT_ENABLE_BORDER_LEFT = 1 << 5,
ACCENT_ENABLE_BORDER_TOP = 1 << 6,
ACCENT_ENABLE_BORDER_RIGHT = 1 << 7,
ACCENT_ENABLE_BORDER_BOTTOM = 1 << 8,
ACCENT_ENABLE_BORDER = ACCENT_ENABLE_BORDER_LEFT | ACCENT_ENABLE_BORDER_TOP | ACCENT_ENABLE_BORDER_RIGHT | ACCENT_ENABLE_BORDER_BOTTOM,
ACCENT_ENABLE_ALL = ACCENT_ENABLE_BORDER
};
using ACCENT_POLICY = struct ACCENT_POLICY
{
ACCENT_STATE State;
DWORD Flags;
DWORD GradientColor; // #AABBGGRR
DWORD AnimationId;
ACCENT_STATE AccentState;
ACCENT_FLAG AccentFlags;
DWORD dwGradientColor; // #AABBGGRR
DWORD dwAnimationId;
};
using PACCENT_POLICY = ACCENT_POLICY *;

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
#include <QtGui/qbrush.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
#include <QtCore/qvariant.h>
#ifndef REGISTRYKEY_FORCE_QSETTINGS

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,9 +24,9 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
#ifdef Q_OS_LINUX
# include "framelesshelper_linux.h"
# include <FramelessHelper/Core/framelesshelper_linux.h>
#endif // Q_OS_LINUX
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelpercore_global.h"
#include <FramelessHelper/Core/framelesshelpercore_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickwindow.h>

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
QT_BEGIN_NAMESPACE
class QQmlEngine;

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <QtQml/qqmlparserstatus.h>
QT_BEGIN_NAMESPACE

View File

@ -26,7 +26,7 @@
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <QtQuickTemplates2/private/qquickapplicationwindow_p.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -26,7 +26,7 @@
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <QtQuick/qquickwindow.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
QT_BEGIN_NAMESPACE
class QQuickItem;

View File

@ -26,7 +26,7 @@
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <QtQuick/private/qquickwindowmodule_p.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -26,7 +26,7 @@
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <QtQuick/qquickwindow.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <QtCore/qvariant.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -26,7 +26,7 @@
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#include <QtQuickTemplates2/private/qquickbutton_p.h>

View File

@ -26,10 +26,10 @@
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#include "quickchromepalette.h"
#include "quickstandardsystembutton_p.h"
#include <FramelessHelper/Quick/quickchromepalette.h>
#include <FramelessHelper/Quick/private/quickstandardsystembutton_p.h>
#include <QtQuick/private/qquickrectangle_p.h>
#include <QtQuickTemplates2/private/qquicklabel_p.h>

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <FramelessHelper/Core/chromepalette.h>
#include <QtQml/qqmlparserstatus.h>

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <QtQuick/qquickpainteditem.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <QtQuick/qquickitem.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperquick_global.h"
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
#include <QtQuick/qquickpainteditem.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
#include <QtWidgets/qdialog.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
#include <QtWidgets/qmainwindow.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
#include <QtWidgets/qwidget.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
#include <QtWidgets/qwidget.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
#include <QtCore/qvariant.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
QT_BEGIN_NAMESPACE
class QEnterEvent;

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
#include <QtGui/qfont.h>
QT_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
#include <QtGui/qscreen.h>
QT_BEGIN_NAMESPACE

View File

@ -24,7 +24,7 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
#include <QtWidgets/qabstractbutton.h>
FRAMELESSHELPER_BEGIN_NAMESPACE

View File

@ -24,8 +24,8 @@
#pragma once
#include "framelesshelperwidgets_global.h"
#include "standardsystembutton.h"
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
#include <FramelessHelper/Widgets/standardsystembutton.h>
#include <FramelessHelper/Core/chromepalette.h>
#include <QtWidgets/qwidget.h>

View File

@ -1545,7 +1545,7 @@ void Utils::tryToEnableHighestDpiAwarenessLevel()
if (currentAwareness == DpiAwareness::PerMonitorVersion2) {
return;
}
if (SetProcessDpiAwareness2(_PROCESS_PER_MONITOR_DPI_AWARE_V2)) {
if (SetProcessDpiAwareness2(_PROCESS_PER_MONITOR_V2_DPI_AWARE)) {
return;
}
if (currentAwareness == DpiAwareness::PerMonitor) {
@ -1762,7 +1762,8 @@ bool Utils::setBlurBehindWindowEnabled(const WId windowId, const BlurMode mode,
} else {
ACCENT_POLICY policy;
SecureZeroMemory(&policy, sizeof(policy));
policy.State = ACCENT_DISABLED;
policy.AccentState = ACCENT_DISABLED;
policy.AccentFlags = ACCENT_NONE;
WINDOWCOMPOSITIONATTRIBDATA wcad;
SecureZeroMemory(&wcad, sizeof(wcad));
wcad.Attrib = WCA_ACCENT_POLICY;
@ -1831,9 +1832,8 @@ bool Utils::setBlurBehindWindowEnabled(const WId windowId, const BlurMode mode,
ACCENT_POLICY policy;
SecureZeroMemory(&policy, sizeof(policy));
if (blurMode == BlurMode::Windows_Acrylic) {
policy.State = ACCENT_ENABLE_ACRYLICBLURBEHIND;
// Magic number, this member must be set to 2, otherwise will have no effect, don't know why.
policy.Flags = 2;
policy.AccentState = ACCENT_ENABLE_ACRYLICBLURBEHIND;
policy.AccentFlags = ACCENT_ENABLE_LUMINOSITY;
const auto gradientColor = [&color]() -> QColor {
if (color.isValid()) {
return color;
@ -1843,10 +1843,11 @@ bool Utils::setBlurBehindWindowEnabled(const WId windowId, const BlurMode mode,
return clr;
}();
// This API expects the #AABBGGRR format.
policy.GradientColor = DWORD(qRgba(gradientColor.blue(),
policy.dwGradientColor = DWORD(qRgba(gradientColor.blue(),
gradientColor.green(), gradientColor.red(), gradientColor.alpha()));
} else if (blurMode == BlurMode::Windows_Aero) {
policy.State = ACCENT_ENABLE_BLURBEHIND;
policy.AccentState = ACCENT_ENABLE_BLURBEHIND;
policy.AccentFlags = ACCENT_NONE;
} else {
Q_UNREACHABLE_RETURN(false);
}
@ -2195,7 +2196,7 @@ DpiAwareness Utils::getDpiAwarenessForCurrentProcess(bool *highest)
case _DPI_AWARENESS_PER_MONITOR_AWARE:
result = DpiAwareness::PerMonitor;
break;
case _DPI_AWARENESS_PER_MONITOR_AWARE_V2:
case _DPI_AWARENESS_PER_MONITOR_V2_AWARE:
result = DpiAwareness::PerMonitorVersion2;
break;
case _DPI_AWARENESS_UNAWARE_GDISCALED:
@ -2226,7 +2227,7 @@ DpiAwareness Utils::getDpiAwarenessForCurrentProcess(bool *highest)
case _PROCESS_PER_MONITOR_DPI_AWARE:
result = DpiAwareness::PerMonitor;
break;
case _PROCESS_PER_MONITOR_DPI_AWARE_V2:
case _PROCESS_PER_MONITOR_V2_DPI_AWARE:
result = DpiAwareness::PerMonitorVersion2;
break;
case _PROCESS_DPI_UNAWARE_GDISCALED: