* don't reset the watched properties: it breks kwin
* check for the blur property only on PropertyNotify and if is on the property we actually want svn path=/trunk/KDE/kdelibs/; revision=1214853
This commit is contained in:
parent
543168555b
commit
091d781dc5
@ -30,15 +30,20 @@ namespace Plasma
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
EffectWatcher::EffectWatcher(Plasma::WindowEffects::Effect effect, QWidget *parent)
|
EffectWatcher::EffectWatcher(QString property, QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
m_effect(effect),
|
m_property(property),
|
||||||
m_effectActive(false)
|
m_effectActive(false)
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
kapp->installX11EventFilter( this );
|
kapp->installX11EventFilter( this );
|
||||||
Display *dpy = QX11Info::display();
|
Display *dpy = QX11Info::display();
|
||||||
XSelectInput(dpy, RootWindow(dpy, 0), PropertyChangeMask);
|
Window root = DefaultRootWindow(dpy);
|
||||||
|
XWindowAttributes attrs;
|
||||||
|
//Don't reset eventual other masks already there
|
||||||
|
XGetWindowAttributes(dpy, root, &attrs);
|
||||||
|
attrs.your_event_mask |= PropertyChangeMask;
|
||||||
|
XSelectInput(dpy, root, attrs.your_event_mask);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,10 +51,22 @@ EffectWatcher::EffectWatcher(Plasma::WindowEffects::Effect effect, QWidget *pare
|
|||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
bool EffectWatcher::x11Event(XEvent *event)
|
bool EffectWatcher::x11Event(XEvent *event)
|
||||||
{
|
{
|
||||||
bool nowEffectActive = WindowEffects::isEffectAvailable(m_effect);
|
if (event->type == PropertyNotify) {
|
||||||
if (m_effectActive != nowEffectActive) {
|
Display *dpy = QX11Info::display();
|
||||||
m_effectActive = nowEffectActive;
|
Atom testAtom = XInternAtom(dpy, m_property.toLatin1(), False);
|
||||||
emit blurBehindChanged(m_effectActive);
|
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);
|
||||||
|
}
|
||||||
|
if (m_effectActive != nowEffectActive) {
|
||||||
|
m_effectActive = nowEffectActive;
|
||||||
|
emit blurBehindChanged(m_effectActive);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return QWidget::x11Event(event);
|
return QWidget::x11Event(event);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class EffectWatcher: public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EffectWatcher(Plasma::WindowEffects::Effect effect, QWidget *parent = 0);
|
EffectWatcher(QString property, QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
@ -43,7 +43,7 @@ Q_SIGNALS:
|
|||||||
void blurBehindChanged(bool blur);
|
void blurBehindChanged(bool blur);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Plasma::WindowEffects::Effect m_effect;
|
QString m_property;
|
||||||
bool m_effectActive;
|
bool m_effectActive;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -109,8 +109,8 @@ public:
|
|||||||
QObject::connect(compositeWatch, SIGNAL(lostOwner()), q, SLOT(compositingChanged()));
|
QObject::connect(compositeWatch, SIGNAL(lostOwner()), q, SLOT(compositingChanged()));
|
||||||
//watch for blur effect property changes as well
|
//watch for blur effect property changes as well
|
||||||
effectWatcher = 0;
|
effectWatcher = 0;
|
||||||
/* effectWatcher = new EffectWatcher(WindowEffects::BlurBehind);
|
effectWatcher = new EffectWatcher("_KDE_NET_WM_BLUR_BEHIND_REGION");
|
||||||
QObject::connect(effectWatcher, SIGNAL(blurBehindChanged(bool)), q, SLOT(blurBehindChanged(bool)));*/
|
QObject::connect(effectWatcher, SIGNAL(blurBehindChanged(bool)), q, SLOT(blurBehindChanged(bool)));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user