[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/plasma
From:       Marco Martin <notmart () gmail ! com>
Date:       2011-01-16 17:25:29
Message-ID: 20110116172529.1D39A3E1F1 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1214853 by mart:

* 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


 M  +21 -4     private/effectwatcher.cpp  
 M  +2 -2      private/effectwatcher_p.h  
 M  +2 -2      theme.cpp  


--- trunk/KDE/kdelibs/plasma/private/effectwatcher.cpp #1214852:1214853
@@ -30,15 +30,20 @@
 {
 
 
-EffectWatcher::EffectWatcher(Plasma::WindowEffects::Effect effect, QWidget *parent)
+EffectWatcher::EffectWatcher(QString property, QWidget *parent)
     : QWidget(parent),
-      m_effect(effect),
+      m_property(property),
       m_effectActive(false)
 {
 #ifdef Q_WS_X11
     kapp->installX11EventFilter( this );
     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
 }
 
@@ -46,11 +51,23 @@
 #ifdef Q_WS_X11
 bool EffectWatcher::x11Event(XEvent *event)
 {
-    bool nowEffectActive = WindowEffects::isEffectAvailable(m_effect);
+    if (event->type == PropertyNotify) {
+        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);
+            }
     if (m_effectActive != nowEffectActive) {
         m_effectActive = nowEffectActive;
         emit blurBehindChanged(m_effectActive);
     }
+        }
+    }
     return QWidget::x11Event(event);
 }
 #endif
--- trunk/KDE/kdelibs/plasma/private/effectwatcher_p.h #1214852:1214853
@@ -32,7 +32,7 @@
     Q_OBJECT
 
 public:
-    EffectWatcher(Plasma::WindowEffects::Effect effect, QWidget *parent = 0);
+    EffectWatcher(QString property, QWidget *parent = 0);
 
 protected:
 #ifdef Q_WS_X11
@@ -43,7 +43,7 @@
     void blurBehindChanged(bool blur);
 
 private:
-    Plasma::WindowEffects::Effect m_effect;
+    QString m_property;
     bool m_effectActive;
 };
 
--- trunk/KDE/kdelibs/plasma/theme.cpp #1214852:1214853
@@ -109,8 +109,8 @@
             QObject::connect(compositeWatch, SIGNAL(lostOwner()), q, \
SLOT(compositingChanged()));  //watch for blur effect property changes as well
             effectWatcher = 0;
-           /* effectWatcher = new EffectWatcher(WindowEffects::BlurBehind);
-            QObject::connect(effectWatcher, SIGNAL(blurBehindChanged(bool)), q, \
SLOT(blurBehindChanged(bool)));*/ +            effectWatcher = new \
EffectWatcher("_KDE_NET_WM_BLUR_BEHIND_REGION"); +            \
QObject::connect(effectWatcher, SIGNAL(blurBehindChanged(bool)), q, \
SLOT(blurBehindChanged(bool)));  }
 #endif
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic