summaryrefslogtreecommitdiffstats
path: root/client/myrootpixmap.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/myrootpixmap.cc')
-rw-r--r--client/myrootpixmap.cc34
1 files changed, 30 insertions, 4 deletions
diff --git a/client/myrootpixmap.cc b/client/myrootpixmap.cc
index 11d5eb9..999ecf4 100644
--- a/client/myrootpixmap.cc
+++ b/client/myrootpixmap.cc
@@ -22,7 +22,7 @@
#include <tdeapplication.h>
#include <kimageeffect.h>
#include <kpixmapio.h>
-#include <twinmodule.h>
+#include <netwm.h>
#include <twin.h>
#include <kdebug.h>
#include <netwm.h>
@@ -38,11 +38,37 @@ static TQString wallpaperForDesktop(int desktop)
return DCOPRef("kdesktop", "KBackgroundIface").call("currentWallpaper", desktop);
}
+DesktopWallpaperWatcher::DesktopWallpaperWatcher() : TQWidget(), m_old_current_desktop(-1)
+{
+ kapp->installX11EventFilter( this );
+ (void ) kapp->desktop(); //trigger desktop widget creation to select root window events
+}
+
+DesktopWallpaperWatcher::~DesktopWallpaperWatcher()
+{
+}
+
+bool DesktopWallpaperWatcher::x11Event( XEvent * ev )
+{
+ if ( ev->xany.window == tqt_xrootwin() ) {
+ NETRootInfo rinfo( tqt_xdisplay(), NET::CurrentDesktop );
+ rinfo.activate();
+
+ if ( rinfo.currentDesktop() != m_old_current_desktop ) {
+ emit currentDesktopChanged( rinfo.currentDesktop() );
+ }
+
+ m_old_current_desktop = rinfo.currentDesktop();
+ }
+
+ return false;
+}
+
class KMyRootPixmapData
{
public:
#ifdef Q_WS_X11
- KWinModule *twin;
+ DesktopWallpaperWatcher *twin;
#endif
};
@@ -74,7 +100,7 @@ void KMyRootPixmap::init()
// connect(m_pTimer, TQT_SIGNAL(timeout()), TQT_SLOT(repaint()));
#ifdef Q_WS_X11
- d->twin = new KWinModule( this );
+ d->twin = new DesktopWallpaperWatcher();
connect(d->twin, TQT_SIGNAL(currentDesktopChanged(int)), TQT_SLOT(desktopChanged(int)));
#endif
@@ -228,5 +254,5 @@ void KMyRootPixmap::updateBackground( TDESharedPixmap *spm )
}
}
-// #include "krootpixmap.moc"
+#include "myrootpixmap.moc"
#endif