win32: try to fix bug
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
71f8a5aab1
commit
cbf34ea0ec
|
@ -54,6 +54,8 @@
|
||||||
<maxversiontested Id="10.0.19044.0"/>
|
<maxversiontested Id="10.0.19044.0"/>
|
||||||
<!-- Windows 11 Version 21H2 -->
|
<!-- Windows 11 Version 21H2 -->
|
||||||
<maxversiontested Id="10.0.22000.0"/>
|
<maxversiontested Id="10.0.22000.0"/>
|
||||||
|
<!-- Windows 11 Version 22H2 -->
|
||||||
|
<maxversiontested Id="10.0.22621.0"/>
|
||||||
<!-- Windows Vista and Windows Server 2008 -->
|
<!-- Windows Vista and Windows Server 2008 -->
|
||||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||||
<!-- Windows 7 and Windows Server 2008 R2 -->
|
<!-- Windows 7 and Windows Server 2008 R2 -->
|
||||||
|
@ -62,7 +64,7 @@
|
||||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||||
<!-- Windows 8.1 and Windows Server 2012 R2 -->
|
<!-- Windows 8.1 and Windows Server 2012 R2 -->
|
||||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||||
<!-- Windows 10 -->
|
<!-- Windows 10 and Windows 11 -->
|
||||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||||
</application>
|
</application>
|
||||||
</compatibility>
|
</compatibility>
|
||||||
|
|
|
@ -135,6 +135,24 @@
|
||||||
# define TIMERR_NOERROR (0)
|
# define TIMERR_NOERROR (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WS_EX_NOREDIRECTIONBITMAP
|
||||||
|
# define WS_EX_NOREDIRECTIONBITMAP (0x00200000L)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef USER_DEFAULT_SCREEN_DPI
|
||||||
|
# define USER_DEFAULT_SCREEN_DPI (96)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _DPI_AWARENESS_CONTEXTS_
|
||||||
|
# define _DPI_AWARENESS_CONTEXTS_
|
||||||
|
DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
|
||||||
|
# define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
|
||||||
|
# define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
|
||||||
|
# define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
|
||||||
|
# define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
|
||||||
|
# define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
|
||||||
|
#endif
|
||||||
|
|
||||||
using MMRESULT = UINT;
|
using MMRESULT = UINT;
|
||||||
|
|
||||||
using TIMECAPS = struct TIMECAPS
|
using TIMECAPS = struct TIMECAPS
|
||||||
|
@ -162,6 +180,17 @@ using MONITOR_DPI_TYPE = enum MONITOR_DPI_TYPE
|
||||||
MDT_DEFAULT = MDT_EFFECTIVE_DPI
|
MDT_DEFAULT = MDT_EFFECTIVE_DPI
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using _DWMWINDOWATTRIBUTE = enum _DWMWINDOWATTRIBUTE
|
||||||
|
{
|
||||||
|
_DWMWA_USE_HOSTBACKDROPBRUSH = 17,
|
||||||
|
_DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19, // Undocumented
|
||||||
|
_DWMWA_USE_IMMERSIVE_DARK_MODE = 20,
|
||||||
|
_DWMWA_WINDOW_CORNER_PREFERENCE = 33,
|
||||||
|
_DWMWA_VISIBLE_FRAME_BORDER_THICKNESS = 37,
|
||||||
|
_DWMWA_SYSTEMBACKDROP_TYPE = 38,
|
||||||
|
_DWMWA_MICA_EFFECT = 1029 // Undocumented
|
||||||
|
};
|
||||||
|
|
||||||
using _DWM_WINDOW_CORNER_PREFERENCE = enum _DWM_WINDOW_CORNER_PREFERENCE
|
using _DWM_WINDOW_CORNER_PREFERENCE = enum _DWM_WINDOW_CORNER_PREFERENCE
|
||||||
{
|
{
|
||||||
_DWMWCP_DEFAULT = 0, // Let the system decide whether or not to round window corners
|
_DWMWCP_DEFAULT = 0, // Let the system decide whether or not to round window corners
|
||||||
|
@ -278,6 +307,32 @@ GetDpiForMonitor(
|
||||||
_Out_ UINT *dpiY
|
_Out_ UINT *dpiY
|
||||||
);
|
);
|
||||||
|
|
||||||
|
WINUSERAPI int WINAPI
|
||||||
|
GetSystemMetricsForDpi(
|
||||||
|
_In_ int nIndex,
|
||||||
|
_In_ UINT dpi
|
||||||
|
);
|
||||||
|
|
||||||
|
WINUSERAPI UINT WINAPI
|
||||||
|
GetDpiForWindow(
|
||||||
|
_In_ HWND hwnd
|
||||||
|
);
|
||||||
|
|
||||||
|
WINUSERAPI UINT WINAPI
|
||||||
|
GetSystemDpiForProcess(
|
||||||
|
_In_ HANDLE hProcess
|
||||||
|
);
|
||||||
|
|
||||||
|
WINUSERAPI BOOL WINAPI
|
||||||
|
SetProcessDpiAwarenessContext(
|
||||||
|
_In_ DPI_AWARENESS_CONTEXT value
|
||||||
|
);
|
||||||
|
|
||||||
|
WINUSERAPI BOOL WINAPI
|
||||||
|
SetProcessDPIAware(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
[[maybe_unused]] static constexpr const int kAutoHideTaskBarThickness = 2; // The thickness of an auto-hide taskbar in pixels.
|
[[maybe_unused]] static constexpr const int kAutoHideTaskBarThickness = 2; // The thickness of an auto-hide taskbar in pixels.
|
||||||
|
|
||||||
[[maybe_unused]] static constexpr const wchar_t kDwmRegistryKey[] = LR"(Software\Microsoft\Windows\DWM)";
|
[[maybe_unused]] static constexpr const wchar_t kDwmRegistryKey[] = LR"(Software\Microsoft\Windows\DWM)";
|
||||||
|
@ -286,11 +341,3 @@ GetDpiForMonitor(
|
||||||
[[maybe_unused]] static constexpr const wchar_t kDwmColorKeyName[] = L"ColorPrevalence";
|
[[maybe_unused]] static constexpr const wchar_t kDwmColorKeyName[] = L"ColorPrevalence";
|
||||||
[[maybe_unused]] static constexpr const wchar_t kSystemDarkThemeResourceName[] = L"DarkMode_Explorer";
|
[[maybe_unused]] static constexpr const wchar_t kSystemDarkThemeResourceName[] = L"DarkMode_Explorer";
|
||||||
[[maybe_unused]] static constexpr const wchar_t kSystemLightThemeResourceName[] = L"Explorer";
|
[[maybe_unused]] static constexpr const wchar_t kSystemLightThemeResourceName[] = L"Explorer";
|
||||||
|
|
||||||
[[maybe_unused]] static constexpr const DWORD _DWMWA_USE_HOSTBACKDROPBRUSH = 17;
|
|
||||||
[[maybe_unused]] static constexpr const DWORD _DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19;
|
|
||||||
[[maybe_unused]] static constexpr const DWORD _DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
|
|
||||||
[[maybe_unused]] static constexpr const DWORD _DWMWA_WINDOW_CORNER_PREFERENCE = 33;
|
|
||||||
[[maybe_unused]] static constexpr const DWORD _DWMWA_VISIBLE_FRAME_BORDER_THICKNESS = 37;
|
|
||||||
[[maybe_unused]] static constexpr const DWORD _DWMWA_SYSTEMBACKDROP_TYPE = 38;
|
|
||||||
[[maybe_unused]] static constexpr const DWORD _DWMWA_MICA_EFFECT = 1029;
|
|
||||||
|
|
|
@ -1495,10 +1495,15 @@ bool Utils::setBlurBehindWindowEnabled(const WId windowId, const BlurMode mode,
|
||||||
}
|
}
|
||||||
if (isWin11OrGreater) {
|
if (isWin11OrGreater) {
|
||||||
const BOOL enable = FALSE;
|
const BOOL enable = FALSE;
|
||||||
const HRESULT hr = pDwmSetWindowAttribute(hwnd, _DWMWA_MICA_EFFECT, &enable, sizeof(enable));
|
HRESULT hr = pDwmSetWindowAttribute(hwnd, _DWMWA_MICA_EFFECT, &enable, sizeof(enable));
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
qWarning() << __getSystemErrorMessage(kDwmSetWindowAttribute, hr);
|
qWarning() << __getSystemErrorMessage(kDwmSetWindowAttribute, hr);
|
||||||
}
|
}
|
||||||
|
const MARGINS margins = {0, 0, 0, 0};
|
||||||
|
hr = pDwmExtendFrameIntoClientArea(hwnd, &margins);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
qWarning() << __getSystemErrorMessage(kDwmExtendFrameIntoClientArea, hr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ACCENT_POLICY policy;
|
ACCENT_POLICY policy;
|
||||||
SecureZeroMemory(&policy, sizeof(policy));
|
SecureZeroMemory(&policy, sizeof(policy));
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "framelessquickhelper_p.h"
|
#include "framelessquickhelper_p.h"
|
||||||
#include <QtCore/qmutex.h>
|
#include <QtCore/qmutex.h>
|
||||||
#include <QtCore/qtimer.h>
|
#include <QtCore/qtimer.h>
|
||||||
|
#include <QtCore/qdebug.h>
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
# include <QtGui/qpa/qplatformwindow.h> // For QWINDOWSIZE_MAX
|
# include <QtGui/qpa/qplatformwindow.h> // For QWINDOWSIZE_MAX
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <QtCore/qmutex.h>
|
#include <QtCore/qmutex.h>
|
||||||
#include <QtCore/qhash.h>
|
#include <QtCore/qhash.h>
|
||||||
#include <QtCore/qtimer.h>
|
#include <QtCore/qtimer.h>
|
||||||
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtGui/qwindow.h>
|
#include <QtGui/qwindow.h>
|
||||||
#include <QtGui/qpalette.h>
|
#include <QtGui/qpalette.h>
|
||||||
#include <QtWidgets/qwidget.h>
|
#include <QtWidgets/qwidget.h>
|
||||||
|
|
Loading…
Reference in New Issue