From d9ba80d04fe9ac6eb1d77e87427af207052d5c32 Mon Sep 17 00:00:00 2001 From: ck Date: Thu, 7 Nov 2024 11:16:49 +0800 Subject: [PATCH] chore: use testAttribute instead of environment test DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsWaylandPlatform) --- src/widgets/dmainwindow.cpp | 2 +- src/widgets/dtitlebar.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/widgets/dmainwindow.cpp b/src/widgets/dmainwindow.cpp index a1daa8ccb..8682ba2a0 100644 --- a/src/widgets/dmainwindow.cpp +++ b/src/widgets/dmainwindow.cpp @@ -43,7 +43,7 @@ DMainWindowPrivate::DMainWindowPrivate(DMainWindow *qq) titlebar = new DTitlebar(qq); titlebar->setAccessibleName("DMainWindowTitlebar"); auto noTitlebarEnabled = []{ - if (qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == "TreeLand") { + if (DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsWaylandPlatform)) { return true; } QFunctionPointer enableNoTitlebar = qApp->platformFunction("_d_isEnableNoTitlebar"); diff --git a/src/widgets/dtitlebar.cpp b/src/widgets/dtitlebar.cpp index 8e5d63480..c3a23a700 100644 --- a/src/widgets/dtitlebar.cpp +++ b/src/widgets/dtitlebar.cpp @@ -354,7 +354,7 @@ void DTitlebarPrivate::init() q->setFocusPolicy(Qt::StrongFocus); auto noTitlebarEnabled = []{ - if (qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == "TreeLand") { + if (DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsWaylandPlatform)) { return true; } @@ -431,7 +431,8 @@ void DTitlebarPrivate::updateFullscreen() void DTitlebarPrivate::updateButtonsState(Qt::WindowFlags type) { D_Q(DTitlebar); - bool useDXcb = DPlatformWindowHandle::isEnabledDXcb(targetWindow()) || qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == "TreeLand"; + bool useDXcb = DPlatformWindowHandle::isEnabledDXcb(targetWindow()) || + DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsWaylandPlatform); bool isFullscreen = targetWindow()->windowState().testFlag(Qt::WindowFullScreen); // bool forceShow = !useDXcb;