minor tweaks

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2022-11-17 10:24:45 +08:00
parent 3791802d3b
commit 04f254556d
2 changed files with 7 additions and 6 deletions

View File

@ -87,6 +87,7 @@ FRAMELESSHELPER_STRING_CONSTANT(DestroyWindow)
"no need to worry. But if you really need the snap layout feature, please add a manifest file to your application and "
"explicitly declare Windows 11 compatibility in it. If you just want to hide this error message, please use the "
"FramelessConfig class to officially disable the snap layout feature for Windows 11.";
[[maybe_unused]] static constexpr const char kD3DWorkaroundEnvVar[] = "FRAMELESSHELPER_USE_D3D_WORKAROUND";
struct Win32HelperData
{
@ -891,7 +892,8 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
// of the upper-left non-client area. It's confirmed that this issue exists
// from Windows 7 to Windows 10. Not tested on Windows 11 yet. Don't know
// whether it exists on Windows XP to Windows Vista or not.
*result = ((static_cast<BOOL>(wParam) == FALSE) ? 0 : WVR_REDRAW);
const bool needD3DWorkaround = (qEnvironmentVariableIntValue(kD3DWorkaroundEnvVar) != 0);
*result = (((static_cast<BOOL>(wParam) == FALSE) || needD3DWorkaround) ? 0 : WVR_REDRAW);
return true;
}
case WM_NCHITTEST: {

View File

@ -26,7 +26,6 @@
#include "framelessconfig_p.h"
#include "framelessmanager.h"
#include "framelessmanager_p.h"
#include <QtCore/qregularexpression.h>
#include <QtGui/qwindow.h>
#include <QtGui/qscreen.h>
#include <QtGui/qguiapplication.h>
@ -79,7 +78,8 @@ using Display = struct _XDisplay;
[[maybe_unused]] static constexpr const char GTK_THEME_NAME_ENV_VAR[] = "GTK_THEME";
[[maybe_unused]] static constexpr const char GTK_THEME_NAME_PROP[] = "gtk-theme-name";
[[maybe_unused]] static constexpr const char GTK_THEME_PREFER_DARK_PROP[] = "gtk-application-prefer-dark-theme";
FRAMELESSHELPER_STRING_CONSTANT2(GTK_THEME_DARK_REGEX, "[:-]dark")
FRAMELESSHELPER_STRING_CONSTANT(dark)
FRAMELESSHELPER_BYTEARRAY_CONSTANT(rootwindow)
FRAMELESSHELPER_BYTEARRAY_CONSTANT(x11screen)
@ -474,10 +474,9 @@ bool Utils::shouldAppsUseDarkMode_linux()
it's mainly used for easy debugging, so it should be possible to use it
to override any other settings.
*/
static const QRegularExpression darkRegex(kGTK_THEME_DARK_REGEX, QRegularExpression::CaseInsensitiveOption);
const QString envThemeName = qEnvironmentVariable(GTK_THEME_NAME_ENV_VAR);
if (!envThemeName.isEmpty()) {
return darkRegex.match(envThemeName).hasMatch();
return envThemeName.contains(kdark, Qt::CaseInsensitive);
}
/*
@ -497,7 +496,7 @@ bool Utils::shouldAppsUseDarkMode_linux()
*/
const QString curThemeName = gtkSetting(GTK_THEME_NAME_PROP);
if (!curThemeName.isEmpty()) {
return darkRegex.match(curThemeName).hasMatch();
return curThemeName.contains(kdark, Qt::CaseInsensitive);
}
return false;