Fix always full rect blur mask for panels ignoring shape from Plasma themes

Plasma themes might define non-full-rect shapes for panels (e.g. round
borders for panels not filling the whole width/height).
The old code tells the window manager to blur the full rect of a panel
window, resulting in unwanted artifacts around the panel shape for
non-full-rect themed panels.
With the Panel.qml item of the desktop packages exposing some optional
"panelMask" property now, we can query for the shape and only use the
painted area when telling the window manager where to blur behind or
changing the background contrast.
This also follows the logic as already applied for dialogs or other window
elements like tooltips which are rendered using a Plasma theme.

Test Plan:
The Oxygen Plasma theme no longer has blurry corners on panel edges.
Also still works as before when using non-composing window manager.

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent c69acc09
......@@ -951,9 +951,21 @@ QPointF PanelView::positionAdjustedForContainment(const QPointF &point) const
void PanelView::updateMask()
if (KWindowSystem::compositingActive()) {
} else {
QRegion mask;
QQuickItem *rootObject = this->rootObject();
if (rootObject) {
const QVariant maskProperty = rootObject->property("panelMask");
if (static_cast<QMetaType::Type>(maskProperty.type()) == QMetaType::QRegion) {
mask = maskProperty.value<QRegion>();
// old hack for non-compositing:
// assuming the desktoptheme uses "widgets/panel-background" for the panel
// before "panelMask" was added to expected property set of panel objects
// TODO: understand if still needed
if (mask.isEmpty() && !KWindowSystem::compositingActive()) {
if (!m_background) {
m_background = new Plasma::FrameSvg(this);
......@@ -962,8 +974,10 @@ void PanelView::updateMask()
mask = m_background->mask();
bool PanelView::canSetStrut() const
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment