Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkwidget
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#599
  • Loading branch information
deepin-ci-robot authored and FeiWang1119 committed Sep 25, 2024
1 parent 940d150 commit 40a4a63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/widgets/dmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ DMainWindowPrivate::DMainWindowPrivate(DMainWindow *qq)
titlebar = new DTitlebar(qq);
titlebar->setAccessibleName("DMainWindowTitlebar");
auto noTitlebarEnabled = []{
if (qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == "TreeLand") {
return true;
}
QFunctionPointer enableNoTitlebar = qApp->platformFunction("_d_isEnableNoTitlebar");
bool enabled = qApp->platformName() == "dwayland" || qApp->property("_d_isDwayland").toBool();
return enabled && enableNoTitlebar != nullptr;
Expand Down
6 changes: 5 additions & 1 deletion src/widgets/dtitlebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ void DTitlebarPrivate::init()
q->setFocusPolicy(Qt::StrongFocus);

auto noTitlebarEnabled = []{
if (qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == "TreeLand") {
return true;
}

QFunctionPointer enableNoTitlebar = qApp->platformFunction("_d_isEnableNoTitlebar");
bool enabled = qApp->platformName() == "dwayland" || qApp->property("_d_isDwayland").toBool();
return enabled && enableNoTitlebar != nullptr;
Expand Down Expand Up @@ -427,7 +431,7 @@ void DTitlebarPrivate::updateFullscreen()
void DTitlebarPrivate::updateButtonsState(Qt::WindowFlags type)
{
D_Q(DTitlebar);
bool useDXcb = DPlatformWindowHandle::isEnabledDXcb(targetWindow());
bool useDXcb = DPlatformWindowHandle::isEnabledDXcb(targetWindow()) || qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == "TreeLand";
bool isFullscreen = targetWindow()->windowState().testFlag(Qt::WindowFullScreen);

// bool forceShow = !useDXcb;
Expand Down

0 comments on commit 40a4a63

Please sign in to comment.