Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/plugins/platform/treeland/dtreelandplatformwindowinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ void DTreeLandPlatformWindowHelper::setEnableBlurWindow(bool enableBlurWindow)
updateFeature(m_blur, enableBlurWindow, Blur);
}

void DTreeLandPlatformWindowHelper::setWindowEffect(DPlatformHandle::EffectScenes effectScene)
{
updateFeature(m_effectScene, effectScene, WindowEffect);
}

void DTreeLandPlatformWindowHelper::setPlatformHandle(DPlatformHandle *handle)
{
m_platformHandle = handle;
Expand Down Expand Up @@ -387,6 +392,18 @@ void DTreeLandPlatformWindowHelper::applyPending()
m_shadowColor.red(), m_shadowColor.green(),
m_shadowColor.blue(), m_shadowColor.alpha());
}
if (m_dirty & WindowEffect) {
m_dirty &= ~WindowEffect;
if (m_effectScene.testFlag(DPlatformHandle::EffectNoRadius)) {
context->set_round_corner_radius(0);
}
if (m_effectScene.testFlag(DPlatformHandle::EffectNoShadow)) {
context->set_shadow(0, 0, 0, 0, 0, 0, 0);
}
if (m_effectScene.testFlag(DPlatformHandle::EffectNoBorder)) {
context->set_border(0, 0, 0, 0, 0);
}
}
}
}

Expand Down Expand Up @@ -543,4 +560,20 @@ void DTreeLandPlatformWindowInterface::setEnableBlurWindow(bool enable)
Q_EMIT m_platformHandle->enableBlurWindowChanged();
}
}

DPlatformHandle::EffectScene DTreeLandPlatformWindowInterface::windowEffect()
{
if (auto helper = DTreeLandPlatformWindowHelper::get(m_window))
return static_cast<DPlatformHandle::EffectScene>(helper->windowEffect().toInt());
return {};
}

void DTreeLandPlatformWindowInterface::setWindowEffect(DPlatformHandle::EffectScenes effectScene)
{
if (auto helper = DTreeLandPlatformWindowHelper::get(m_window)) {
helper->setWindowEffect(effectScene);
if (m_platformHandle)
Q_EMIT m_platformHandle->windowEffectChanged();
}
}
DGUI_END_NAMESPACE
17 changes: 12 additions & 5 deletions src/plugins/platform/treeland/dtreelandplatformwindowinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
~DTreeLandPlatformWindowHelper() override;

enum Feature {
NoTitlebar = 1 << 0,
Radius = 1 << 1,
Blur = 1 << 2,
Border = 1 << 3,
Shadow = 1 << 4,
NoTitlebar = 1 << 0,
Radius = 1 << 1,
Blur = 1 << 2,
Border = 1 << 3,
Shadow = 1 << 4,
WindowEffect = 1 << 5,
};
Q_DECLARE_FLAGS(Features, Feature)

Expand All @@ -39,6 +40,7 @@
void setShadowOffset(const QPoint &shadowOffset);
void setShadowColor(const QColor &shadowColor);
void setEnableBlurWindow(bool enableBlurWindow);
void setWindowEffect(DPlatformHandle::EffectScenes effectScene);
void setPlatformHandle(DPlatformHandle *handle);

bool isEnabledNoTitlebar() const { return m_noTitlebar; }
Expand All @@ -49,8 +51,9 @@
QPoint shadowOffset() const { return m_shadowOffset; }
QColor shadowColor() const { return m_shadowColor; }
bool enableBlurWindow() const { return m_blur; }
DPlatformHandle::EffectScenes windowEffect() const { return m_effectScene; }

private slots:

Check warning on line 56 in src/plugins/platform/treeland/dtreelandplatformwindowinterface.h

View workflow job for this annotation

GitHub Actions / cppcheck

There is an unknown macro here somewhere. Configuration is required. If slots is a macro then please configure it.

Check warning on line 56 in src/plugins/platform/treeland/dtreelandplatformwindowinterface.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

There is an unknown macro here somewhere. Configuration is required. If slots is a macro then please configure it.
void onActiveChanged();
void onSurfaceCreated();
void onSurfaceDestroyed();
Expand Down Expand Up @@ -84,6 +87,7 @@
int m_shadowRadius = 0;
QPoint m_shadowOffset;
QColor m_shadowColor;
DPlatformHandle::EffectScenes m_effectScene;
Features m_initialized;
Features m_dirty;
bool m_applyScheduled = false;
Expand Down Expand Up @@ -118,6 +122,9 @@

bool enableBlurWindow() const override;
void setEnableBlurWindow(bool enableBlurWindow) override;

DPlatformHandle::EffectScene windowEffect() override;
void setWindowEffect(DPlatformHandle::EffectScenes effectScene) override;
};

DGUI_END_NAMESPACE
Expand Down
Loading