check if the efect is active in the effectwatcher ctor, this avoids an useless themechanged signal, that among other things clears framesvg cache, forgetting the size of the other prefixes, that's why the pager was looking corrupted

This problem asn't in branch since effectwatcher is only in trunk

svn path=/trunk/KDE/kdelibs/; revision=1215920
This commit is contained in:
Marco Martin 2011-01-20 09:41:10 +00:00
parent 9d98ff105b
commit 7a1835cf01
2 changed files with 22 additions and 9 deletions

View File

@ -32,9 +32,9 @@ namespace Plasma
EffectWatcher::EffectWatcher(QString property, QWidget *parent)
: QWidget(parent),
m_property(property),
m_effectActive(false)
m_property(property)
{
m_effectActive = isEffectActive();
#ifdef Q_WS_X11
kapp->installX11EventFilter( this );
Display *dpy = QX11Info::display();
@ -55,13 +55,7 @@ bool EffectWatcher::x11Event(XEvent *event)
Display *dpy = QX11Info::display();
Atom testAtom = XInternAtom(dpy, m_property.toLatin1(), False);
if (event->xproperty.atom == testAtom) {
bool nowEffectActive = false;
int cnt;
Atom *list = XListProperties(dpy, DefaultRootWindow(dpy), &cnt);
if (list != NULL) {
nowEffectActive = (qFind(list, list + cnt, testAtom) != list + cnt);
XFree(list);
}
bool nowEffectActive = isEffectActive();
if (m_effectActive != nowEffectActive) {
m_effectActive = nowEffectActive;
emit blurBehindChanged(m_effectActive);
@ -72,6 +66,24 @@ bool EffectWatcher::x11Event(XEvent *event)
}
#endif
bool EffectWatcher::isEffectActive() const
{
#ifdef Q_WS_X11
Display *dpy = QX11Info::display();
Atom testAtom = XInternAtom(dpy, m_property.toLatin1(), False);
bool nowEffectActive = false;
int cnt;
Atom *list = XListProperties(dpy, DefaultRootWindow(dpy), &cnt);
if (list != NULL) {
nowEffectActive = (qFind(list, list + cnt, testAtom) != list + cnt);
XFree(list);
}
return nowEffectActive;
#else
return false;
#endif
}
}

View File

@ -35,6 +35,7 @@ public:
EffectWatcher(QString property, QWidget *parent = 0);
protected:
bool isEffectActive() const;
#ifdef Q_WS_X11
bool x11Event(XEvent *event);
#endif