summaryrefslogtreecommitdiffstats
path: root/client/myrootpixmap.cc
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2014-11-18 10:39:24 -0600
committerTimothy Pearson <[email protected]>2014-11-18 10:39:24 -0600
commit8095005fe253b65fa87f48008db7560c7bc0eaac (patch)
treec48d7cf3b546c35d6c727c8f354474e90abca81f /client/myrootpixmap.cc
parente74f50107771f5e005f3061a29b4cb560f76d9c1 (diff)
downloadtwin-style-crystal-8095005fe253b65fa87f48008db7560c7bc0eaac.tar.gz
twin-style-crystal-8095005fe253b65fa87f48008db7560c7bc0eaac.zip
Update background wallpaper image on desktop switch
Diffstat (limited to 'client/myrootpixmap.cc')
-rw-r--r--client/myrootpixmap.cc36
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