Bind translucent theme to background contrast rather than blur effect
Only the background contrast effect provides real contrast for contents, the blur effect doesn't improve readability that much; so we now use the translucent theme only when we have the background contrast effect. This significantly improves readability. CHANGELOG: An opaque theme is now used when only the blur effect is available REVIEW: 124039 BUG: 342934 BUG: 348154
This commit is contained in:
parent
afd962a15b
commit
d65c0ed1d0
@ -39,7 +39,7 @@ const char ThemePrivate::themeRcFile[] = "plasmarc";
|
||||
// these svgs do not follow the theme's colors, but rather the system colors
|
||||
const char ThemePrivate::systemColorsTheme[] = "internal-system-colors";
|
||||
#if HAVE_X11
|
||||
EffectWatcher *ThemePrivate::s_blurEffectWatcher = 0;
|
||||
EffectWatcher *ThemePrivate::s_backgroundContrastEffectWatcher = Q_NULLPTR;
|
||||
#endif
|
||||
|
||||
ThemePrivate *ThemePrivate::globalTheme = 0;
|
||||
@ -61,7 +61,7 @@ ThemePrivate::ThemePrivate(QObject *parent)
|
||||
cachesToDiscard(NoCache),
|
||||
locolor(false),
|
||||
compositingActive(KWindowSystem::self()->compositingActive()),
|
||||
blurActive(KWindowEffects::isEffectAvailable(KWindowEffects::BlurBehind)),
|
||||
backgroundContrastActive(KWindowEffects::isEffectAvailable(KWindowEffects::BackgroundContrast)),
|
||||
isDefault(true),
|
||||
useGlobal(true),
|
||||
hasWallpapers(false),
|
||||
@ -95,12 +95,17 @@ ThemePrivate::ThemePrivate(QObject *parent)
|
||||
|
||||
if (QPixmap::defaultDepth() > 8) {
|
||||
#if HAVE_X11
|
||||
//watch for blur effect property changes as well
|
||||
if (!s_blurEffectWatcher) {
|
||||
s_blurEffectWatcher = new EffectWatcher("_KDE_NET_WM_BLUR_BEHIND_REGION");
|
||||
//watch for background contrast effect property changes as well
|
||||
if (!s_backgroundContrastEffectWatcher) {
|
||||
s_backgroundContrastEffectWatcher = new EffectWatcher("_KDE_NET_WM_BACKGROUND_CONTRAST_REGION");
|
||||
}
|
||||
|
||||
QObject::connect(s_blurEffectWatcher, SIGNAL(effectChanged(bool)), this, SLOT(blurBehindChanged(bool)));
|
||||
QObject::connect(s_backgroundContrastEffectWatcher, &EffectWatcher::effectChanged, this, [this](bool active) {
|
||||
if (backgroundContrastActive != active) {
|
||||
backgroundContrastActive = active;
|
||||
scheduleThemeChangeNotification(PixmapCache | SvgElementsCache);
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
QCoreApplication::instance()->installEventFilter(this);
|
||||
@ -278,7 +283,7 @@ QString ThemePrivate::findInTheme(const QString &image, const QString &theme, bo
|
||||
type = QStringLiteral("/locolor/");
|
||||
} else if (!compositingActive) {
|
||||
type = QStringLiteral("/opaque/");
|
||||
} else if (blurActive) {
|
||||
} else if (backgroundContrastActive) {
|
||||
type = QStringLiteral("/translucent/");
|
||||
}
|
||||
|
||||
@ -360,14 +365,6 @@ void ThemePrivate::colorsChanged()
|
||||
scheduleThemeChangeNotification(PixmapCache);
|
||||
}
|
||||
|
||||
void ThemePrivate::blurBehindChanged(bool blur)
|
||||
{
|
||||
if (blurActive != blur) {
|
||||
blurActive = blur;
|
||||
scheduleThemeChangeNotification(PixmapCache | SvgElementsCache);
|
||||
}
|
||||
}
|
||||
|
||||
void ThemePrivate::scheduleThemeChangeNotification(CacheTypes caches)
|
||||
{
|
||||
cachesToDiscard |= caches;
|
||||
|
@ -84,7 +84,6 @@ public:
|
||||
public Q_SLOTS:
|
||||
void compositingChanged(bool active);
|
||||
void colorsChanged();
|
||||
void blurBehindChanged(bool blur);
|
||||
void settingsFileChanged(const QString &settings);
|
||||
void scheduledCacheUpdate();
|
||||
void onAppExitCleanup();
|
||||
@ -102,7 +101,7 @@ public:
|
||||
static const char systemColorsTheme[];
|
||||
static const char themeRcFile[];
|
||||
#if HAVE_X11
|
||||
static EffectWatcher *s_blurEffectWatcher;
|
||||
static EffectWatcher *s_backgroundContrastEffectWatcher;
|
||||
#endif
|
||||
//Ref counting of ThemePrivate instances
|
||||
static ThemePrivate *globalTheme;
|
||||
@ -142,7 +141,7 @@ public:
|
||||
|
||||
bool locolor : 1;
|
||||
bool compositingActive : 1;
|
||||
bool blurActive : 1;
|
||||
bool backgroundContrastActive : 1;
|
||||
bool isDefault : 1;
|
||||
bool useGlobal : 1;
|
||||
bool hasWallpapers : 1;
|
||||
|
Loading…
Reference in New Issue
Block a user