diff --git a/theme.cpp b/theme.cpp index aa24e72d0..7b5e39803 100644 --- a/theme.cpp +++ b/theme.cpp @@ -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(); } diff --git a/theme.h b/theme.h index e4618e2ba..b5118276b 100644 --- a/theme.h +++ b/theme.h @@ -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 &))