Skip to content

Commit

Permalink
chore: use testAttribute instead of environment test
Browse files Browse the repository at this point in the history
DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsWaylandPlatform)
  • Loading branch information
kegechen committed Nov 7, 2024
1 parent 0fefe17 commit d9ba80d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/widgets/dmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 3 additions & 2 deletions src/widgets/dtitlebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d9ba80d

Please sign in to comment.