diff options
Diffstat (limited to 'client/myrootpixmap.cc')
-rw-r--r-- | client/myrootpixmap.cc | 36 |
1 files changed, 34 insertions, 2 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 |