plasma: Use the new KWindowSystem::compositingChanged() signal

(cherry picked from commit b7b4358542e205c027ccd2718f43052851ff7152)
This commit is contained in:
Fredrik Höglund 2011-07-28 23:37:17 +02:00
parent dcce68643c
commit d43d4315aa
2 changed files with 7 additions and 18 deletions

View File

@ -97,23 +97,13 @@ public:
ThemeConfig config;
cacheTheme = config.cacheTheme();
#ifdef Q_WS_X11
Display *dpy = QX11Info::display();
int screen = DefaultScreen(dpy);
locolor = DefaultDepth(dpy, screen) < 16;
if (!locolor) {
char net_wm_cm_name[100];
sprintf(net_wm_cm_name, "_NET_WM_CM_S%d", screen);
compositeWatch = new KSelectionWatcher(net_wm_cm_name, -1, q);
QObject::connect(compositeWatch, SIGNAL(newOwner(Window)), q, SLOT(compositingChanged()));
QObject::connect(compositeWatch, SIGNAL(lostOwner()), q, SLOT(compositingChanged()));
if (QPixmap::defaultDepth() > 8) {
QObject::connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)), q, SLOT(compositingChanged(bool)));
//watch for blur effect property changes as well
effectWatcher = 0;
effectWatcher = new EffectWatcher("_KDE_NET_WM_BLUR_BEHIND_REGION");
QObject::connect(effectWatcher, SIGNAL(blurBehindChanged(bool)), q, SLOT(blurBehindChanged(bool)));
}
#endif
saveTimer = new QTimer(q);
saveTimer->setSingleShot(true);
@ -149,7 +139,7 @@ public:
}
QString findInTheme(const QString &image, const QString &theme, bool cache = true);
void compositingChanged();
void compositingChanged(bool active);
void discardCache(CacheTypes caches);
void scheduledCacheUpdate();
void colorsChanged();
@ -274,12 +264,11 @@ QString ThemePrivate::findInTheme(const QString &image, const QString &theme, bo
return search;
}
void ThemePrivate::compositingChanged()
void ThemePrivate::compositingChanged(bool active)
{
#ifdef Q_WS_X11
bool nowCompositingActive = compositeWatch->owner() != None;
if (compositingActive != nowCompositingActive) {
compositingActive = nowCompositingActive;
if (compositingActive != active) {
compositingActive = active;
discardCache(PixmapCache | SvgElementsCache);
emit q->themeChanged();
}

View File

@ -397,7 +397,7 @@ class PLASMA_EXPORT Theme : public QObject
friend class ThemePrivate;
ThemePrivate *const d;
Q_PRIVATE_SLOT(d, void compositingChanged())
Q_PRIVATE_SLOT(d, void compositingChanged(bool))
Q_PRIVATE_SLOT(d, void colorsChanged())
Q_PRIVATE_SLOT(d, void blurBehindChanged(bool blur))
Q_PRIVATE_SLOT(d, void settingsFileChanged(const QString &))