diff options
author | Timothy Pearson <[email protected]> | 2014-12-01 02:25:47 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2014-12-01 02:25:47 -0600 |
commit | 80aec91d21bf675286b1a0869eeba19f9847e3ec (patch) | |
tree | d5bb01291f71a8cbcc9e1a553cf88ff291fc31f3 | |
parent | 8095005fe253b65fa87f48008db7560c7bc0eaac (diff) | |
download | twin-style-crystal-80aec91d21bf675286b1a0869eeba19f9847e3ec.tar.gz twin-style-crystal-80aec91d21bf675286b1a0869eeba19f9847e3ec.zip |
Fix broken task switching when transparency enabled
This resolves Bug 2220
-rw-r--r-- | client/myrootpixmap.cc | 34 | ||||
-rw-r--r-- | client/myrootpixmap.h | 20 |
2 files changed, 48 insertions, 6 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 diff --git a/client/myrootpixmap.h b/client/myrootpixmap.h index 26ebc9c..7d8f0e8 100644 --- a/client/myrootpixmap.h +++ b/client/myrootpixmap.h @@ -25,10 +25,26 @@ class TQTimer; class TDESharedPixmap; class KMyRootPixmapData; +class DesktopWallpaperWatcher : public TQWidget +{ + Q_OBJECT + + public: + DesktopWallpaperWatcher(); + ~DesktopWallpaperWatcher(); + + bool x11Event( XEvent * ev ); + + signals: + void currentDesktopChanged( int desktop); + + private: + int m_old_current_desktop; +}; + class KMyRootPixmap: public TQObject { Q_OBJECT - public: KMyRootPixmap( TQWidget *target=NULL, const char *name=0 ); @@ -91,7 +107,7 @@ private: // TQWidget *m_pWidget; // TQTimer *m_pTimer; TDESharedPixmap *m_pPixmap; - KMyRootPixmapData *d; + KMyRootPixmapData *d; void init(); }; |