diff options
author | Timothy Pearson <[email protected]> | 2014-11-18 10:39:24 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2014-11-18 10:39:24 -0600 |
commit | 8095005fe253b65fa87f48008db7560c7bc0eaac (patch) | |
tree | c48d7cf3b546c35d6c727c8f354474e90abca81f /client | |
parent | e74f50107771f5e005f3061a29b4cb560f76d9c1 (diff) | |
download | twin-style-crystal-8095005fe253b65fa87f48008db7560c7bc0eaac.tar.gz twin-style-crystal-8095005fe253b65fa87f48008db7560c7bc0eaac.zip |
Update background wallpaper image on desktop switch
Diffstat (limited to 'client')
-rw-r--r-- | client/myrootpixmap.cc | 36 | ||||
-rw-r--r-- | client/myrootpixmap.h | 5 |
2 files changed, 37 insertions, 4 deletions
diff --git a/client/myrootpixmap.cc b/client/myrootpixmap.cc index abc1703..11d5eb9 100644 --- a/client/myrootpixmap.cc +++ b/client/myrootpixmap.cc @@ -11,6 +11,7 @@ */ /* Modified by Sascha Hlusiak */ +/* Further modified 11/18/2014 by Timothy Pearson <[email protected]> */ #include <tqwidget.h> #include <tqtimer.h> @@ -22,15 +23,28 @@ #include <kimageeffect.h> #include <kpixmapio.h> #include <twinmodule.h> +#include <twin.h> #include <kdebug.h> #include <netwm.h> #include <dcopclient.h> +#include <dcopref.h> #include <tqpainter.h> #include <ksharedpixmap.h> #include "myrootpixmap.h" +static TQString wallpaperForDesktop(int desktop) +{ + return DCOPRef("kdesktop", "KBackgroundIface").call("currentWallpaper", desktop); +} +class KMyRootPixmapData +{ +public: +#ifdef Q_WS_X11 + KWinModule *twin; +#endif +}; KMyRootPixmap::KMyRootPixmap( TQWidget * widget, const char *name ) : TQObject(widget, name ? name : "KMyRootPixmap" ) @@ -46,7 +60,7 @@ KMyRootPixmap::KMyRootPixmap( TQWidget *, TQObject *parent, const char *name ) void KMyRootPixmap::init() { -// d = new KMyRootPixmapData; + d = new KMyRootPixmapData; // m_Fade = 0; m_pPixmap = new TDESharedPixmap; // m_pTimer = new TQTimer( this ); @@ -59,6 +73,11 @@ void KMyRootPixmap::init() connect(m_pPixmap, TQT_SIGNAL(done(bool)), TQT_SLOT(slotDone(bool))); // connect(m_pTimer, TQT_SIGNAL(timeout()), TQT_SLOT(repaint())); +#ifdef Q_WS_X11 + d->twin = new KWinModule( this ); + connect(d->twin, TQT_SIGNAL(currentDesktopChanged(int)), TQT_SLOT(desktopChanged(int))); +#endif + // d->toplevel = m_pWidget->topLevelWidget(); // d->toplevel->installEventFilter(this); } @@ -66,7 +85,20 @@ void KMyRootPixmap::init() KMyRootPixmap::~KMyRootPixmap() { delete m_pPixmap; -// delete d; + delete d; +} + +void KMyRootPixmap::desktopChanged(int desktop) +{ + if (wallpaperForDesktop(m_Desk) == wallpaperForDesktop(desktop) && + !wallpaperForDesktop(m_Desk).isNull()) + return; + +// #ifdef Q_WS_X11 +// if (KWin::windowInfo(m_pWidget->topLevelWidget()->winId()).desktop() == NET::OnAllDesktops && +// pixmapName(m_Desk) != pixmapName(desktop)) +// #endif + repaint(true); } int KMyRootPixmap::currentDesktop() const diff --git a/client/myrootpixmap.h b/client/myrootpixmap.h index 02c450a..26ebc9c 100644 --- a/client/myrootpixmap.h +++ b/client/myrootpixmap.h @@ -9,7 +9,7 @@ */ /* Modified by Sascha Hlusiak */ - +/* Further modified 11/18/2014 by Timothy Pearson <[email protected]> */ #ifndef __KRootPixmap_h_Included__ #define __KRootPixmap_h_Included__ @@ -78,6 +78,7 @@ protected: private slots: // void slotBackgroundChanged(int); void slotDone(bool); + void desktopChanged(int desktop); private: bool m_bActive, m_bInit/*, m_bCustomPaint*/; @@ -90,7 +91,7 @@ private: // TQWidget *m_pWidget; // TQTimer *m_pTimer; TDESharedPixmap *m_pPixmap; -// KMyRootPixmapData *d; + KMyRootPixmapData *d; void init(); }; |