diff --git a/tabbox/declarative.cpp b/tabbox/declarative.cpp index 31e23a0657..b6ae22fea9 100644 --- a/tabbox/declarative.cpp +++ b/tabbox/declarative.cpp @@ -112,17 +112,20 @@ QPixmap ImageProvider::requestPixmap(const QString &id, QSize *size, const QSize return icon; } -static bool compositing() +// WARNING: this code exists to cover a bug in Qt which prevents plasma from detecting the state change +// of the compositor through KWindowSystem. +// once plasma uses (again) a KSelectionWatcher or Qt is fixed in this regard, the code can go. +static QString plasmaThemeVariant() { #ifndef TABBOX_KCM if (!Workspace::self()->compositing() || !effects) { - return false; + return Plasma::Theme::defaultTheme()->currentThemeHasImage("opaque/dialogs/background") ? QLatin1String("opaque/") : QLatin1String(""); } - if (!static_cast(effects)->provides(Effect::Blur)) { - return false; + if (static_cast(effects)->provides(Effect::Blur)) { + return Plasma::Theme::defaultTheme()->currentThemeHasImage("translucent/dialogs/background") ? QLatin1String("translucent/") : QLatin1String(""); } #endif - return Plasma::Theme::defaultTheme()->currentThemeHasImage("translucent/dialogs/background"); + return QLatin1String(""); } DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBoxMode mode, QWidget *parent) @@ -155,7 +158,7 @@ DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBox kdeclarative.setupBindings(); qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem"); rootContext()->setContextProperty("viewId", static_cast(winId())); - rootContext()->setContextProperty("compositing", compositing()); + rootContext()->setContextProperty("plasmaThemeVariant", plasmaThemeVariant()); if (m_mode == TabBoxConfig::ClientTabBox) { rootContext()->setContextProperty("clientModel", model); } else if (m_mode == TabBoxConfig::DesktopTabBox) { @@ -198,8 +201,10 @@ void DeclarativeView::showEvent(QShowEvent *event) item->setProperty("currentIndex", tabBox->first().row()); connect(item, SIGNAL(currentIndexChanged(int)), SLOT(currentIndexChanged(int))); } - rootContext()->setContextProperty("compositing", compositing()); + rootContext()->setContextProperty("plasmaThemeVariant", plasmaThemeVariant()); slotUpdateGeometry(); + QResizeEvent re(size(), size()); // to set mask and blurring. + resizeEvent(&re); QGraphicsView::showEvent(event); } @@ -220,11 +225,15 @@ void DeclarativeView::resizeEvent(QResizeEvent *event) m_frame->setImagePath(maskImagePath); m_frame->resizeFrame(QSizeF(maskWidth, maskHeight)); QRegion mask = m_frame->mask().translated(maskLeftMargin, maskTopMargin); - if (compositing()) { - // blur background - Plasma::WindowEffects::enableBlurBehind(winId(), true, mask); +#ifndef TABBOX_KCM + // notice: this covers an issue with plasma detecting the compositing state. see plasmaThemeVariant() + if (Workspace::self()->compositing() && effects) { + // blur background?! + Plasma::WindowEffects::enableBlurBehind(winId(), static_cast(effects)->provides(Effect::Blur), mask); clearMask(); - } else { + } else +#endif + { // do not trim to mask with compositing enabled, otherwise shadows are cropped setMask(mask); } diff --git a/tabbox/qml/ShadowedSvgItem.qml b/tabbox/qml/ShadowedSvgItem.qml index 8bf76c8a2f..ad92cabf17 100644 --- a/tabbox/qml/ShadowedSvgItem.qml +++ b/tabbox/qml/ShadowedSvgItem.qml @@ -32,16 +32,25 @@ Item { property int centerLeftMargin: shadow.margins.left property alias maskImagePath: shadow.imagePath + PlasmaCore.FrameSvg { + id: themeInfo + imagePath: plasmaThemeVariant + "dialogs/background" + // NOTICE: the following plasmaThemeVariant access causes necessary re-evaluation! + property bool hasNewShadows: plasmaThemeVariant != "reEvaluateMe" && hasElementPrefix("shadow") + } + PlasmaCore.FrameSvgItem { id: shadow - imagePath: (compositing ? "translucent" : "opaque") + "/dialogs/background" - prefix: "shadow" + prefix: themeInfo.hasNewShadows ? "shadow" : "" + + imagePath: plasmaThemeVariant + "dialogs/background" anchors.fill: parent + visible: true PlasmaCore.FrameSvgItem { id: background imagePath: shadow.imagePath - visible: false + visible: themeInfo.hasNewShadows anchors { fill: parent leftMargin: shadow.margins.left