Skip to content

Commit efa0e22

Browse files
sync: from linuxdeepin/dtkwidget
Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: linuxdeepin/dtkwidget#602
1 parent f18b453 commit efa0e22

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/widgets/dmainwindow.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ DMainWindowPrivate::DMainWindowPrivate(DMainWindow *qq)
4343
titlebar = new DTitlebar(qq);
4444
titlebar->setAccessibleName("DMainWindowTitlebar");
4545
auto noTitlebarEnabled = []{
46+
if (qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == "TreeLand") {
47+
return true;
48+
}
4649
QFunctionPointer enableNoTitlebar = qApp->platformFunction("_d_isEnableNoTitlebar");
4750
bool enabled = qApp->platformName() == "dwayland" || qApp->property("_d_isDwayland").toBool();
4851
return enabled && enableNoTitlebar != nullptr;

src/widgets/dslider.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <DPaletteHelper>
1515
#include <DFontSizeManager>
16+
#include <DGuiApplicationHelper>
1617

1718
DWIDGET_BEGIN_NAMESPACE
1819

@@ -784,7 +785,7 @@ void SliderStrip::paintEvent(QPaintEvent *event)
784785
Q_UNUSED(event)
785786
QPainter pa(this);
786787
auto dpa = DPaletteHelper::instance()->palette(this);
787-
QPen penLine = QPen(dpa.color(DPalette::ObviousBackground), 1);
788+
QPen penLine = QPen(DGuiApplicationHelper::adjustColor(dpa.color(DPalette::ObviousBackground), 0, 0, 0, 0, 0, 0, +20), 1);
788789
QPen penNumber = QPen(dpa.textTips(), 1);
789790

790791
int tickSize = fontMetrics().height() / 2;

src/widgets/dtitlebar.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,10 @@ void DTitlebarPrivate::init()
354354
q->setFocusPolicy(Qt::StrongFocus);
355355

356356
auto noTitlebarEnabled = []{
357+
if (qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == "TreeLand") {
358+
return true;
359+
}
360+
357361
QFunctionPointer enableNoTitlebar = qApp->platformFunction("_d_isEnableNoTitlebar");
358362
bool enabled = qApp->platformName() == "dwayland" || qApp->property("_d_isDwayland").toBool();
359363
return enabled && enableNoTitlebar != nullptr;
@@ -427,7 +431,7 @@ void DTitlebarPrivate::updateFullscreen()
427431
void DTitlebarPrivate::updateButtonsState(Qt::WindowFlags type)
428432
{
429433
D_Q(DTitlebar);
430-
bool useDXcb = DPlatformWindowHandle::isEnabledDXcb(targetWindow());
434+
bool useDXcb = DPlatformWindowHandle::isEnabledDXcb(targetWindow()) || qEnvironmentVariable("DDE_CURRENT_COMPOSITOR") == "TreeLand";
431435
bool isFullscreen = targetWindow()->windowState().testFlag(Qt::WindowFullScreen);
432436

433437
// bool forceShow = !useDXcb;
@@ -1104,7 +1108,7 @@ bool DTitlebar::eventFilter(QObject *obj, QEvent *event)
11041108
switch (event->type()) {
11051109
case QEvent::ShowToParent:
11061110
d->handleParentWindowIdChange();
1107-
d->updateButtonsState(d->targetWindow()->windowFlags());
1111+
d->handleParentWindowStateChange();
11081112
break;
11091113
case QEvent::Resize:
11101114
if (d->autoHideOnFullscreen) {

0 commit comments

Comments
 (0)