diff --git a/effects/blur/blur.h b/effects/blur/blur.h index a3820856a8..3c18f204d2 100644 --- a/effects/blur/blur.h +++ b/effects/blur/blur.h @@ -55,6 +55,7 @@ public: bool isCacheTexture() const { return m_shouldCache; } + virtual bool provides(Feature feature); public Q_SLOTS: void slotWindowAdded(KWin::EffectWindow *w); @@ -94,6 +95,16 @@ private: typedef QHash::iterator CacheEntry; }; +inline +bool BlurEffect::provides(Effect::Feature feature) +{ + if (feature == Blur) { + return true; + } + return KWin::Effect::provides(feature); +} + + } // namespace KWin #endif diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 53532ccff7..61c814e536 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -41,6 +41,7 @@ along with this program. If not, see . #include #include #include +#include #include namespace KWin @@ -1418,7 +1419,11 @@ DesktopButtonsView::DesktopButtonsView(QWidget* parent) scene->addItem(form); m_frame = new Plasma::FrameSvg(this); - m_frame->setImagePath("dialogs/background"); + if (Plasma::Theme::defaultTheme()->currentThemeHasImage("translucent/dialogs/background")) { + m_frame->setImagePath("translucent/dialogs/background"); + } else { + m_frame->setImagePath("dialogs/background"); + } m_frame->setCacheAllRenderedFrames(true); m_frame->setEnabledBorders(Plasma::FrameSvg::AllBorders); qreal left, top, right, bottom; @@ -1427,7 +1432,6 @@ DesktopButtonsView::DesktopButtonsView(QWidget* parent) qreal height = form->size().height() + top + bottom; m_frame->resizeFrame(QSizeF(width, height)); Plasma::WindowEffects::enableBlurBehind(winId(), true, m_frame->mask()); - Plasma::WindowEffects::overrideShadow(winId(), true); form->setPos(left, top); scene->setSceneRect(QRectF(QPointF(0, 0), QSizeF(width, height))); setScene(scene); diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index ff53aefea1..2f937f418c 100755 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -35,6 +35,7 @@ along with this program. If not, see . #include #include #include +#include #include #include @@ -1961,7 +1962,11 @@ CloseWindowView::CloseWindowView(QWidget* parent) scene->addItem(form); m_frame = new Plasma::FrameSvg(this); - m_frame->setImagePath("dialogs/background"); + if (Plasma::Theme::defaultTheme()->currentThemeHasImage("translucent/dialogs/background")) { + m_frame->setImagePath("translucent/dialogs/background"); + } else { + m_frame->setImagePath("dialogs/background"); + } m_frame->setCacheAllRenderedFrames(true); m_frame->setEnabledBorders(Plasma::FrameSvg::AllBorders); qreal left, top, right, bottom; @@ -1970,7 +1975,6 @@ CloseWindowView::CloseWindowView(QWidget* parent) qreal height = form->size().height() + top + bottom; m_frame->resizeFrame(QSizeF(width, height)); Plasma::WindowEffects::enableBlurBehind(winId(), true, m_frame->mask()); - Plasma::WindowEffects::overrideShadow(winId(), true); form->setPos(left, top); scene->setSceneRect(QRectF(QPointF(0, 0), QSizeF(width, height))); setScene(scene); diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 6aea85d207..f6bb636c35 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -324,7 +324,7 @@ public: }; enum Feature { - Nothing = 0, Resize, GeometryTip, Outline, ScreenInversion + Nothing = 0, Resize, GeometryTip, Outline, ScreenInversion, Blur }; /** diff --git a/tabbox/declarative.cpp b/tabbox/declarative.cpp index b4d615178a..5beaf1bcf9 100644 --- a/tabbox/declarative.cpp +++ b/tabbox/declarative.cpp @@ -43,6 +43,7 @@ along with this program. If not, see . // KWin #include "thumbnailitem.h" #include +#include "../effects.h" #include "../client.h" #include "../workspace.h" @@ -101,6 +102,19 @@ QPixmap ImageProvider::requestPixmap(const QString &id, QSize *size, const QSize return icon; } +static bool compositing() +{ +#ifndef TABBOX_KCM + if (!Workspace::self()->compositing() || !effects) { + return false; + } + if (!static_cast(effects)->provides(Effect::Blur)) { + return false; + } +#endif + return Plasma::Theme::defaultTheme()->currentThemeHasImage("translucent/dialogs/background"); +} + DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBoxMode mode, QWidget *parent) : QDeclarativeView(parent) , m_model(model) @@ -131,6 +145,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()); if (m_mode == TabBoxConfig::ClientTabBox) { rootContext()->setContextProperty("clientModel", model); } else if (m_mode == TabBoxConfig::DesktopTabBox) { @@ -173,6 +188,7 @@ void DeclarativeView::showEvent(QShowEvent *event) item->setProperty("currentIndex", tabBox->first().row()); connect(item, SIGNAL(currentIndexChanged(int)), SLOT(currentIndexChanged(int))); } + rootContext()->setContextProperty("compositing", compositing()); slotUpdateGeometry(); QGraphicsView::showEvent(event); } @@ -194,10 +210,9 @@ void DeclarativeView::resizeEvent(QResizeEvent *event) m_frame->setImagePath(maskImagePath); m_frame->resizeFrame(QSizeF(maskWidth, maskHeight)); QRegion mask = m_frame->mask().translated(maskLeftMargin, maskTopMargin); - if (Plasma::Theme::defaultTheme()->windowTranslucencyEnabled()) { + if (compositing()) { // blur background Plasma::WindowEffects::enableBlurBehind(winId(), true, mask); - Plasma::WindowEffects::overrideShadow(winId(), true); clearMask(); } else { // do not trim to mask with compositing enabled, otherwise shadows are cropped diff --git a/tabbox/qml/CMakeLists.txt b/tabbox/qml/CMakeLists.txt index bda7d8b95e..7a5a5e0807 100644 --- a/tabbox/qml/CMakeLists.txt +++ b/tabbox/qml/CMakeLists.txt @@ -23,6 +23,7 @@ install( FILES clients/window_strip/metadata.desktop DESTINATION ${SERVICES_INST install (FILES IconTabBox.qml ShadowedSvgItem.qml DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/tabbox/big_icons/contents/ui) install (FILES IconTabBox.qml ShadowedSvgItem.qml DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/tabbox/small_icons/contents/ui) +install (FILES ShadowedSvgItem.qml DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/tabbox/) install (FILES ShadowedSvgItem.qml DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/tabbox/compact/contents/ui) install (FILES ShadowedSvgItem.qml DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/tabbox/informative/contents/ui) install (FILES ShadowedSvgItem.qml DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/tabbox/present_windows/contents/ui) diff --git a/tabbox/qml/ShadowedSvgItem.qml b/tabbox/qml/ShadowedSvgItem.qml index 87de733bf0..8bf76c8a2f 100644 --- a/tabbox/qml/ShadowedSvgItem.qml +++ b/tabbox/qml/ShadowedSvgItem.qml @@ -22,24 +22,26 @@ import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore Item { - property double leftMargin: background.margins.left + shadow.margins.left - property double topMargin: background.margins.top + shadow.margins.top - property double rightMargin: background.margins.right + shadow.margins.right - property double bottomMargin: background.margins.bottom + shadow.margins.bottom - property double centerWidth: background.width - property double centerHeight: background.height + property double leftMargin: shadow.margins.left + background.margins.left + property double topMargin: shadow.margins.top + background.margins.top + property double rightMargin: shadow.margins.right + background.margins.right + property double bottomMargin: shadow.margins.bottom + background.margins.bottom + property double centerWidth: shadow.width - shadow.margins.left - shadow.margins.right + property double centerHeight: shadow.height - shadow.margins.bottom - shadow.margins.top property int centerTopMargin: shadow.margins.top property int centerLeftMargin: shadow.margins.left + property alias maskImagePath: shadow.imagePath PlasmaCore.FrameSvgItem { id: shadow - imagePath: "dialogs/background" + imagePath: (compositing ? "translucent" : "opaque") + "/dialogs/background" prefix: "shadow" anchors.fill: parent PlasmaCore.FrameSvgItem { id: background - imagePath: "dialogs/background" + imagePath: shadow.imagePath + visible: false anchors { fill: parent leftMargin: shadow.margins.left diff --git a/tabbox/qml/clients/big_icons/contents/ui/main.qml b/tabbox/qml/clients/big_icons/contents/ui/main.qml index 4a3666d2be..30e3b20bf8 100644 --- a/tabbox/qml/clients/big_icons/contents/ui/main.qml +++ b/tabbox/qml/clients/big_icons/contents/ui/main.qml @@ -30,7 +30,7 @@ Item { property int optimalHeight: icons.iconSize + icons.margins.top + icons.margins.bottom + background.topMargin + background.bottomMargin + 40 property bool canStretchX: false property bool canStretchY: false - property string maskImagePath: "dialogs/background" + property string maskImagePath: background.maskImagePath property double maskWidth: background.centerWidth property double maskHeight: background.centerHeight property int maskTopMargin: background.centerTopMargin diff --git a/tabbox/qml/clients/compact/contents/ui/main.qml b/tabbox/qml/clients/compact/contents/ui/main.qml index 2bf04a50cf..390b8717f9 100644 --- a/tabbox/qml/clients/compact/contents/ui/main.qml +++ b/tabbox/qml/clients/compact/contents/ui/main.qml @@ -31,7 +31,7 @@ Item { property int optimalHeight: compactListView.rowHeight * compactListView.count + background.topMargin + background.bottomMargin property bool canStretchX: true property bool canStretchY: false - property string maskImagePath: "dialogs/background" + property string maskImagePath: background.maskImagePath property double maskWidth: background.centerWidth property double maskHeight: background.centerHeight property int maskTopMargin: background.centerTopMargin diff --git a/tabbox/qml/clients/informative/contents/ui/main.qml b/tabbox/qml/clients/informative/contents/ui/main.qml index 5e3f9a6f2a..360c6f0e8f 100644 --- a/tabbox/qml/clients/informative/contents/ui/main.qml +++ b/tabbox/qml/clients/informative/contents/ui/main.qml @@ -32,7 +32,7 @@ Item { property int optimalHeight: listView.rowHeight * listView.count + background.topMargin + background.bottomMargin property bool canStretchX: true property bool canStretchY: false - property string maskImagePath: "dialogs/background" + property string maskImagePath: background.maskImagePath property double maskWidth: background.centerWidth property double maskHeight: background.centerHeight property int maskTopMargin: background.centerTopMargin diff --git a/tabbox/qml/clients/present_windows/contents/ui/main.qml b/tabbox/qml/clients/present_windows/contents/ui/main.qml index e539c8970a..889fc900de 100644 --- a/tabbox/qml/clients/present_windows/contents/ui/main.qml +++ b/tabbox/qml/clients/present_windows/contents/ui/main.qml @@ -30,7 +30,7 @@ Item { property int optimalHeight: 0.9*screenHeight property int imagePathPrefix: (new Date()).getTime() property int standardMargin: 2 - property string maskImagePath: "dialogs/background" + property string maskImagePath: background.maskImagePath property double maskWidth: background.centerWidth property double maskHeight: background.centerHeight property int maskTopMargin: background.centerTopMargin diff --git a/tabbox/qml/clients/small_icons/contents/ui/main.qml b/tabbox/qml/clients/small_icons/contents/ui/main.qml index 0c9b4f7f7d..a3e862fbe5 100644 --- a/tabbox/qml/clients/small_icons/contents/ui/main.qml +++ b/tabbox/qml/clients/small_icons/contents/ui/main.qml @@ -30,7 +30,7 @@ Item { property int optimalHeight: icons.iconSize + icons.margins.top + icons.margins.bottom + background.topMargin + background.bottomMargin + 40 property bool canStretchX: false property bool canStretchY: false - property string maskImagePath: "dialogs/background" + property string maskImagePath: background.maskImagePath property double maskWidth: background.centerWidth property double maskHeight: background.centerHeight property int maskTopMargin: background.centerTopMargin diff --git a/tabbox/qml/clients/text/contents/ui/main.qml b/tabbox/qml/clients/text/contents/ui/main.qml index ccae17d96b..c598766cae 100644 --- a/tabbox/qml/clients/text/contents/ui/main.qml +++ b/tabbox/qml/clients/text/contents/ui/main.qml @@ -30,7 +30,7 @@ Item { property int optimalHeight: textListView.rowHeight * textListView.count + background.topMargin + background.bottomMargin property bool canStretchX: true property bool canStretchY: false - property string maskImagePath: "dialogs/background" + property string maskImagePath: background.maskImagePath property double maskWidth: background.centerWidth property double maskHeight: background.centerHeight property int maskTopMargin: background.centerTopMargin diff --git a/tabbox/qml/clients/thumbnails/contents/ui/main.qml b/tabbox/qml/clients/thumbnails/contents/ui/main.qml index 4c33703d54..9cef0b44be 100644 --- a/tabbox/qml/clients/thumbnails/contents/ui/main.qml +++ b/tabbox/qml/clients/thumbnails/contents/ui/main.qml @@ -32,7 +32,7 @@ Item { property int optimalHeight: thumbnailListView.thumbnailWidth*(1.0/screenFactor) + hoverItem.margins.top + hoverItem.margins.bottom + background.topMargin + background.bottomMargin + 40 property bool canStretchX: false property bool canStretchY: false - property string maskImagePath: "dialogs/background" + property string maskImagePath: background.maskImagePath property double maskWidth: background.centerWidth property double maskHeight: background.centerHeight property int maskTopMargin: background.centerTopMargin diff --git a/tabbox/qml/desktop.qml b/tabbox/qml/desktop.qml index e8203b6004..0e0643e31d 100644 --- a/tabbox/qml/desktop.qml +++ b/tabbox/qml/desktop.qml @@ -28,9 +28,14 @@ Item { property bool allDesktops: true property string longestCaption: "" property int optimalWidth: listView.maxRowWidth - property int optimalHeight: listView.rowHeight * listView.count + background.margins.top + background.margins.bottom + property int optimalHeight: listView.rowHeight * listView.count + background.topMargin + background.bottomMargin property bool canStretchX: true property bool canStretchY: false + property string maskImagePath: background.maskImagePath + property double maskWidth: background.centerWidth + property double maskHeight: background.centerHeight + property int maskTopMargin: background.centerTopMargin + property int maskLeftMargin: background.centerLeftMargin width: Math.min(Math.max(screenWidth * 0.2, optimalWidth), screenWidth * 0.8) height: Math.min(optimalHeight, screenHeight * 0.8) @@ -57,10 +62,9 @@ Item { visible: false } - PlasmaCore.FrameSvgItem { + ShadowedSvgItem { id: background anchors.fill: parent - imagePath: "dialogs/background" } // delegate @@ -120,7 +124,7 @@ Item { listView, "calculateMaxRowWidth"); width = Math.max(textElement.width, width); textElement.destroy(); - return width + 32 + hoverItem.margins.right + hoverItem.margins.left + background.margins.left + background.margins.right; + return width + 32 + hoverItem.margins.right + hoverItem.margins.left + background.leftMargin + background.rightMargin; } /** * Calculates the height of one row based on the text height and icon size. @@ -150,10 +154,10 @@ Item { property int imageId: 0 anchors { fill: parent - topMargin: background.margins.top - leftMargin: background.margins.left - rightMargin: background.margins.right - bottomMargin: background.margins.bottom + topMargin: background.topMargin + leftMargin: background.leftMargin + rightMargin: background.rightMargin + bottomMargin: background.bottomMargin } clip: true delegate: listDelegate