use the new backgroundcontrast effect

This commit is contained in:
Marco Martin 2014-01-23 15:17:18 +01:00
parent 188e421956
commit e0676f7501
6 changed files with 21 additions and 0 deletions

View File

@ -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());

View File

@ -26,6 +26,7 @@
#include <QPoint>
#include <Plasma/Plasma>
#include <Plasma/Theme>
#include <netwm_def.h>
@ -175,6 +176,7 @@ private:
WindowType m_type;
bool m_hideOnWindowDeactivate;
bool m_outputOnly;
Plasma::Theme m_theme;
};
#endif

View File

@ -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);

View File

@ -27,6 +27,7 @@
#include <QJSValue>
#include <QQmlListProperty>
#include <QStandardItemModel>
#include <Plasma/Theme>
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

View File

@ -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,

View File

@ -23,6 +23,7 @@
#include <plasmaquickview.h>
#include "panelconfigview.h"
#include <QtCore/qpointer.h>
#include <Plasma/Theme>
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;
};