From e0676f7501ae54ff33ccb40683115677773404db Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 23 Jan 2014 15:17:18 +0100 Subject: [PATCH] use the new backgroundcontrast effect --- src/declarativeimports/core/dialog.cpp | 5 +++++ src/declarativeimports/core/dialog.h | 2 ++ src/shell/panelconfigview.cpp | 5 +++++ src/shell/panelconfigview.h | 2 ++ src/shell/panelview.cpp | 5 +++++ src/shell/panelview.h | 2 ++ 6 files changed, 21 insertions(+) diff --git a/src/declarativeimports/core/dialog.cpp b/src/declarativeimports/core/dialog.cpp index a948ef501..bb746da63 100644 --- a/src/declarativeimports/core/dialog.cpp +++ b/src/declarativeimports/core/dialog.cpp @@ -354,6 +354,11 @@ void DialogProxy::syncMainItemToSize() m_frameSvgItem->setWidth(width()); m_frameSvgItem->setHeight(height()); KWindowEffects::enableBlurBehind(winId(), true, m_frameSvgItem->frameSvg()->mask()); + if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) { + KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7, m_frameSvgItem->frameSvg()->mask()); + } else { + KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7, m_frameSvgItem->frameSvg()->mask()); + } if (m_mainItem) { m_mainItem.data()->setX(m_frameSvgItem->margins()->left()); diff --git a/src/declarativeimports/core/dialog.h b/src/declarativeimports/core/dialog.h index b96b43c63..a76e01635 100644 --- a/src/declarativeimports/core/dialog.h +++ b/src/declarativeimports/core/dialog.h @@ -26,6 +26,7 @@ #include #include +#include #include @@ -175,6 +176,7 @@ private: WindowType m_type; bool m_hideOnWindowDeactivate; bool m_outputOnly; + Plasma::Theme m_theme; }; #endif diff --git a/src/shell/panelconfigview.cpp b/src/shell/panelconfigview.cpp index 4f1007b9b..2334adbdb 100644 --- a/src/shell/panelconfigview.cpp +++ b/src/shell/panelconfigview.cpp @@ -46,6 +46,11 @@ PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *pa setFlags(Qt::FramelessWindowHint); KWindowEffects::enableBlurBehind(winId(), true); + if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) { + KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7); + } else { + KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7); + } engine()->rootContext()->setContextProperty("panel", panelView); engine()->rootContext()->setContextProperty("configDialog", this); diff --git a/src/shell/panelconfigview.h b/src/shell/panelconfigview.h index 6ed60c426..646c2473a 100644 --- a/src/shell/panelconfigview.h +++ b/src/shell/panelconfigview.h @@ -27,6 +27,7 @@ #include #include #include +#include class AppletInterface; class ConfigPropertyMap; @@ -55,6 +56,7 @@ protected Q_SLOTS: private: Plasma::Containment *m_containment; PanelView *m_panelView; + Plasma::Theme m_theme; }; #endif // multiple inclusion guard diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index 61040cdc0..9af9fa2eb 100644 --- a/src/shell/panelview.cpp +++ b/src/shell/panelview.cpp @@ -57,6 +57,11 @@ PanelView::PanelView(ShellCorona *corona, QWindow *parent) //TODO: how to take the shape from the framesvg? KWindowEffects::enableBlurBehind(winId(), true); + if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) { + KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7); + } else { + KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7); + } //Screen management connect(this, &QWindow::screenChanged, diff --git a/src/shell/panelview.h b/src/shell/panelview.h index 7bc779d21..cef08203c 100644 --- a/src/shell/panelview.h +++ b/src/shell/panelview.h @@ -23,6 +23,7 @@ #include #include "panelconfigview.h" #include +#include class ShellCorona; @@ -108,6 +109,7 @@ private: ShellCorona *m_corona; QTimer *m_strutsTimer; VisibilityMode m_visibilityMode; + Plasma::Theme m_theme; static const int STRUTSTIMERDELAY = 200; };