summaryrefslogtreecommitdiffstats
path: root/libtdescreensaver
diff options
context:
space:
mode:
Diffstat (limited to 'libtdescreensaver')
-rw-r--r--libtdescreensaver/CMakeLists.txt47
-rw-r--r--libtdescreensaver/Makefile.am18
-rw-r--r--libtdescreensaver/configure.in.in5
-rw-r--r--libtdescreensaver/main.cpp163
-rw-r--r--libtdescreensaver/tdescreensaver.cpp231
-rw-r--r--libtdescreensaver/tdescreensaver.h138
-rw-r--r--libtdescreensaver/tdescreensaver_vroot.h132
7 files changed, 734 insertions, 0 deletions
diff --git a/libtdescreensaver/CMakeLists.txt b/libtdescreensaver/CMakeLists.txt
new file mode 100644
index 000000000..8cfc6ba7d
--- /dev/null
+++ b/libtdescreensaver/CMakeLists.txt
@@ -0,0 +1,47 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdecore
+)
+
+list( REMOVE_ITEM CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### headers ###################################
+
+install( FILES
+ tdescreensaver.h tdescreensaver_vroot.h
+ DESTINATION ${INCLUDE_INSTALL_DIR} )
+
+
+##### tdescreensaver ##############################
+
+set( target tdescreensaver )
+
+set( ${target}_SRCS
+ main.cpp tdescreensaver.cpp
+)
+
+tde_add_library( ${target} SHARED AUTOMOC
+ SOURCES ${${target}_SRCS}
+ VERSION 4.2.0
+ LINK tdecore-shared
+ DESTINATION ${LIB_INSTALL_DIR}
+)
diff --git a/libtdescreensaver/Makefile.am b/libtdescreensaver/Makefile.am
new file mode 100644
index 000000000..8f7a6104a
--- /dev/null
+++ b/libtdescreensaver/Makefile.am
@@ -0,0 +1,18 @@
+lib_LTLIBRARIES = libtdescreensaver.la
+libtdescreensaver_la_SOURCES = main.cpp tdescreensaver.cpp
+libtdescreensaver_la_LIBADD = $(LIB_QT) $(LIB_TDECORE) $(LIB_X11)
+if undefined_symbols_allowed
+libtdescreensaver_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -version-info 6:0:2
+else
+libtdescreensaver_la_LDFLAGS = $(all_libraries) -static
+endif
+
+include_HEADERS = tdescreensaver.h tdescreensaver_vroot.h
+
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+messages:
+ $(XGETTEXT) *.cpp *.h -o $(podir)/libtdescreensaver.pot
+
+include $(top_srcdir)/admin/Doxyfile.am
diff --git a/libtdescreensaver/configure.in.in b/libtdescreensaver/configure.in.in
new file mode 100644
index 000000000..1777b1e98
--- /dev/null
+++ b/libtdescreensaver/configure.in.in
@@ -0,0 +1,5 @@
+case $host in
+ *cygwin*) undefined_symbols_in_shared_libs_allowed=no;;
+ *) undefined_symbols_in_shared_libs_allowed=yes;;
+esac
+AM_CONDITIONAL(undefined_symbols_allowed, test "$undefined_symbols_in_shared_libs_allowed" = yes)
diff --git a/libtdescreensaver/main.cpp b/libtdescreensaver/main.cpp
new file mode 100644
index 000000000..9f908b81a
--- /dev/null
+++ b/libtdescreensaver/main.cpp
@@ -0,0 +1,163 @@
+/* This file is part of the KDE libraries
+
+ Copyright (c) 2001 Martin R. Jones <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <signal.h>
+
+#include <tqdialog.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <kdebug.h>
+#include <kcmdlineargs.h>
+#include <kapplication.h>
+#include <kcrash.h>
+
+#include "tdescreensaver.h"
+#include "tdescreensaver_vroot.h"
+
+extern "C"
+{
+ extern const char *kss_applicationName;
+ extern const char *kss_description;
+ extern const char *kss_version;
+ KScreenSaver *kss_create( WId d );
+ TQDialog *kss_setup();
+}
+
+static const KCmdLineOptions options[] =
+{
+ { "setup", I18N_NOOP("Setup screen saver"), 0 },
+ { "window-id wid", I18N_NOOP("Run in the specified XWindow"), 0 },
+ { "root", I18N_NOOP("Run in the root XWindow"), 0 },
+ { "demo", I18N_NOOP("Start screen saver in demo mode"), "default"},
+ KCmdLineLastOption
+};
+
+static void crashHandler( int )
+{
+#ifdef SIGABRT
+ signal (SIGABRT, SIG_DFL);
+#endif
+ abort();
+}
+
+//----------------------------------------------------------------------------
+
+class DemoWindow : public TQWidget
+{
+public:
+ DemoWindow() : TQWidget()
+ {
+ setFixedSize(600, 420);
+ }
+
+protected:
+ virtual void keyPressEvent(TQKeyEvent *e)
+ {
+ if (e->ascii() == 'q')
+ {
+ kapp->quit();
+ }
+ }
+
+ virtual void closeEvent( TQCloseEvent * )
+ {
+ kapp->quit();
+ }
+};
+
+
+//----------------------------------------------------------------------------
+#if defined(Q_WS_QWS) || defined(Q_WS_MACX)
+typedef WId Window;
+#endif
+
+KDE_EXPORT int main(int argc, char *argv[])
+{
+ KLocale::setMainCatalogue("libtdescreensaver");
+ TDECmdLineArgs::init(argc, argv, kss_applicationName, kss_description, kss_version);
+
+ TDECmdLineArgs::addCmdLineOptions(options);
+
+ TDEApplication app;
+
+ KCrash::setCrashHandler( crashHandler );
+ TDEGlobal::locale()->insertCatalogue("klock");
+ TDEGlobal::locale()->insertCatalogue("tdescreensaver");
+
+ DemoWindow *demoWidget = 0;
+ Window saveWin = 0;
+ KScreenSaver *target;
+
+ TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
+
+ if (args->isSet("setup"))
+ {
+ TQDialog *dlg = kss_setup();
+ args->clear();
+ dlg->exec();
+ delete dlg;
+ exit(0);
+ }
+
+ if (args->isSet("window-id"))
+ {
+ saveWin = atol(args->getOption("window-id"));
+ }
+
+#ifdef Q_WS_X11 //FIXME
+ if (args->isSet("root"))
+ {
+ saveWin = RootWindow(tqt_xdisplay(), tqt_xscreen());
+ }
+#endif
+
+ if (args->isSet("demo"))
+ {
+ saveWin = 0;
+ }
+
+ if (saveWin == 0)
+ {
+ demoWidget = new DemoWindow();
+ demoWidget->setBackgroundMode(TQWidget::NoBackground);
+ saveWin = demoWidget->winId();
+ app.setMainWidget(demoWidget);
+ app.processEvents();
+ }
+
+ target = kss_create( saveWin );
+
+ if ( demoWidget )
+ {
+ demoWidget->setFixedSize( 600, 420 );
+ demoWidget->show();
+ }
+ args->clear();
+ app.exec();
+
+ delete target;
+ delete demoWidget;
+
+ return 0;
+}
+
diff --git a/libtdescreensaver/tdescreensaver.cpp b/libtdescreensaver/tdescreensaver.cpp
new file mode 100644
index 000000000..4474e5874
--- /dev/null
+++ b/libtdescreensaver/tdescreensaver.cpp
@@ -0,0 +1,231 @@
+/* This file is part of the KDE libraries
+
+ Copyright (c) 2001 Martin R. Jones <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <tqpainter.h>
+#include <tqtimer.h>
+#include <kapplication.h>
+#include "tdescreensaver.h"
+#ifdef Q_WS_X11
+#include <X11/Xlib.h>
+#else
+typedef WId Window;
+#endif
+
+#undef KeyPress
+#undef KeyRelease
+
+//-----------------------------------------------------------------------------
+
+class KScreenSaverPrivate
+{
+public:
+ TQWidget *owner;
+};
+
+KScreenSaver::KScreenSaver( WId id ) : TQWidget()
+{
+ Window root;
+ int ai;
+ unsigned int au;
+ unsigned int w = 0;
+ unsigned int h = 0;
+
+ XSync(tqt_xdisplay(), false);
+
+ d = new KScreenSaverPrivate;
+ d->owner = TQT_TQWIDGET(find( id ));
+ if ( d->owner )
+ installEventFilter( this );
+
+ if ( id )
+ {
+#ifdef Q_WS_X11 //FIXME
+ XGetGeometry(tqt_xdisplay(), (Drawable)id, &root, &ai, &ai,
+ &w, &h, &au, &au);
+#endif
+
+ create( id, false, true );
+ }
+
+ if ( w == 0 ) w = 600;
+ if ( h == 0 ) h = 420;
+ resize( w, h );
+ TDEApplication::sendPostedEvents();
+ show();
+}
+
+KScreenSaver::~KScreenSaver()
+{
+ destroy( false, false );
+ delete d;
+}
+
+void KScreenSaver::embed( TQWidget *w )
+{
+ TDEApplication::sendPostedEvents();
+#ifdef Q_WS_X11 //FIXME
+ XReparentWindow(tqt_xdisplay(), w->winId(), winId(), 0, 0);
+#endif
+ w->setGeometry( 0, 0, width(), height() );
+ TDEApplication::sendPostedEvents();
+}
+
+bool KScreenSaver::eventFilter( TQObject *o, TQEvent *e )
+{
+ // make sure events get to the original window owner
+ if ( d->owner && TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(this) ) {
+ TQApplication::sendEvent( d->owner, e );
+ return false;
+ }
+
+ return TQWidget::eventFilter( o, e );
+}
+
+//============================================================================
+
+class KBlankEffectPrivate
+{
+public:
+ KBlankEffect::BlankEffect currentEffect;
+ int effectProgress;
+ TQTimer *timer;
+ TQWidget *widget;
+};
+
+KBlankEffect::BlankEffect KBlankEffect::effects[] = {
+ &KBlankEffect::blankNormal,
+ &KBlankEffect::blankSweepRight,
+ &KBlankEffect::blankSweepDown,
+ &KBlankEffect::blankBlocks
+};
+
+KBlankEffect::KBlankEffect( TQObject *parent ) : TQObject( parent )
+{
+ d = new KBlankEffectPrivate;
+ d->currentEffect = &KBlankEffect::blankNormal;
+ d->effectProgress = 0;
+ d->timer = new TQTimer( this );
+ connect( d->timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout()) );
+}
+
+
+KBlankEffect::~KBlankEffect()
+{
+ delete d;
+}
+
+void KBlankEffect::finished()
+{
+ d->timer->stop();
+ d->effectProgress = 0;
+ emit doneBlank();
+}
+
+
+void KBlankEffect::blank( TQWidget *w, Effect effect )
+{
+ if ( !w ) {
+ emit doneBlank();
+ return;
+ }
+
+ if ( effect == Random )
+ effect = (Effect)(kapp->random() % MaximumEffects);
+
+ d->effectProgress = 0;
+ d->widget = w;
+ d->currentEffect = effects[ (int)effect ];
+ d->timer->start( 10 );
+}
+
+void KBlankEffect::timeout()
+{
+ (this->*d->currentEffect)();
+}
+
+void KBlankEffect::blankNormal()
+{
+ TQPainter p( d->widget );
+ p.fillRect( 0, 0, d->widget->width(), d->widget->height(), black );
+ finished();
+}
+
+
+void KBlankEffect::blankSweepRight()
+{
+ TQPainter p( d->widget );
+ p.fillRect( d->effectProgress, 0, 50, d->widget->height(), black );
+ kapp->flushX();
+ d->effectProgress += 50;
+ if ( d->effectProgress >= d->widget->width() )
+ finished();
+}
+
+
+void KBlankEffect::blankSweepDown()
+{
+ TQPainter p( d->widget );
+ p.fillRect( 0, d->effectProgress, d->widget->width(), 50, black );
+ kapp->flushX();
+ d->effectProgress += 50;
+ if ( d->effectProgress >= d->widget->height() )
+ finished();
+}
+
+
+void KBlankEffect::blankBlocks()
+{
+ static int *block = 0;
+
+ int bx = (d->widget->width()+63)/64;
+ int by = (d->widget->height()+63)/64;
+
+ if ( !d->effectProgress ) {
+ block = new int [ bx*by ];
+
+ for ( int i = 0; i < bx*by; i++ )
+ block[i] = i;
+ for ( int i = 0; i < bx*by; i++ ) {
+ int swap = kapp->random()%(bx*by);
+ int tmp = block[i];
+ block[i] = block[swap];
+ block[swap] = tmp;
+ }
+ }
+
+ TQPainter p( d->widget );
+
+ // erase a couple of blocks at a time, otherwise it looks too slow
+ for ( int i = 0; i < 2 && d->effectProgress < bx*by; i++ ) {
+ int x = block[d->effectProgress]%bx;
+ int y = block[d->effectProgress]/bx;
+ p.fillRect( x*64, y*64, 64, 64, black );
+ d->effectProgress++;
+ }
+
+ kapp->flushX();
+
+ if ( d->effectProgress >= bx*by ) {
+ delete[] block;
+ finished();
+ }
+}
+
+#include "tdescreensaver.moc"
diff --git a/libtdescreensaver/tdescreensaver.h b/libtdescreensaver/tdescreensaver.h
new file mode 100644
index 000000000..de23f8431
--- /dev/null
+++ b/libtdescreensaver/tdescreensaver.h
@@ -0,0 +1,138 @@
+/* This file is part of the KDE libraries
+
+ Copyright (c) 2001 Martin R. Jones <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KSCREENSAVER_H
+#define KSCREENSAVER_H
+
+#include <tqwidget.h>
+
+#include <tdelibs_export.h>
+
+class TQTimer;
+class KScreenSaverPrivate;
+class KBlankEffectPrivate;
+
+/**
+* Provides a TQWidget for a screensaver to draw into.
+*
+* You should derive from this widget and implement your screensaver's
+* functionality. To use libkss, provide the following constants and
+* functions:
+*
+* extern "C"
+* {
+* const char *kss_applicationName = "yourappname";
+* const char *kss_description = I18N_NOOP( "Your screensaver" );
+* const char *kss_version = "1.0";
+*
+* KScreenSaver *kss_create( WId d )
+* {
+* // return your KScreenSaver derived screensaver
+* }
+*
+* TQDialog *kss_setup()
+* {
+* // return your modal setup dialog
+* }
+* }
+*
+* @short Provides a TQWidget for a screensaver to draw into.
+* @author Martin R. Jones <[email protected]>
+*/
+class KDE_EXPORT KScreenSaver : public TQWidget
+{
+ Q_OBJECT
+public:
+ /**
+ * @param id The winId() of the widget to draw the screensaver into.
+ */
+ KScreenSaver( WId id=0 );
+ ~KScreenSaver();
+
+protected:
+ /**
+ * You cannot create a new widget with this widget as parent, since this
+ * widget may not be owned by your application. In order to create
+ * widgets with a KScreenSaver as parent, create the widget with no parent,
+ * call embed(), and then show() the widget.
+ *
+ * @param widget The widget to embed in the screensaver widget.
+ */
+ void embed( TQWidget *widget );
+
+ bool eventFilter( TQObject *o, TQEvent * );
+
+private:
+ KScreenSaverPrivate *d;
+};
+
+
+/**
+*
+* Blanks a widget using various effects.
+*
+* @short Blanks a widget using various effects.
+* @author Martin R. Jones <[email protected]>
+*/
+class KBlankEffect : public TQObject
+{
+ Q_OBJECT
+public:
+ KBlankEffect( TQObject *parent=0 );
+ ~KBlankEffect();
+
+ enum Effect { Random=-1, Blank=0, SweepRight, SweepDown, Blocks,
+ MaximumEffects };
+
+ /**
+ * Blank a widget using the specified effect.
+ * Some blanking effects take some time, so you should connect to
+ * doneBlank() to know when the blanking is complete.
+ *
+ * @param w The widget to blank.
+ * @param effect The type of effect to use.
+ */
+ void blank( TQWidget *w, Effect effect=Random );
+
+ typedef void (KBlankEffect::*BlankEffect)();
+
+signals:
+ /**
+ * emitted when a blanking effect has completed.
+ */
+ void doneBlank();
+
+protected slots:
+ void timeout();
+
+protected:
+ void finished();
+
+ void blankNormal();
+ void blankSweepRight();
+ void blankSweepDown();
+ void blankBlocks();
+
+protected:
+ static BlankEffect effects[];
+ KBlankEffectPrivate *d;
+};
+#endif
+
diff --git a/libtdescreensaver/tdescreensaver_vroot.h b/libtdescreensaver/tdescreensaver_vroot.h
new file mode 100644
index 000000000..aae76f9d9
--- /dev/null
+++ b/libtdescreensaver/tdescreensaver_vroot.h
@@ -0,0 +1,132 @@
+/*****************************************************************************/
+/** Copyright 1991 by Andreas Stolcke **/
+/** Copyright 1990 by Solbourne Computer Inc. **/
+/** Longmont, Colorado **/
+/** **/
+/** All Rights Reserved **/
+/** **/
+/** Permission to use, copy, modify, and distribute this software and **/
+/** its documentation for any purpose and without fee is hereby **/
+/** granted, provided that the above copyright notice appear in all **/
+/** copies and that both that copyright notice and this permis- **/
+/** sion notice appear in supporting documentation, and that the **/
+/** name of Solbourne not be used in advertising **/
+/** in publicity pertaining to distribution of the software without **/
+/** specific, written prior permission. **/
+/** **/
+/** ANDREAS STOLCKE AND SOLBOURNE COMPUTER INC. DISCLAIMS ALL WARRANTIES **/
+/** WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF **/
+/** MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ANDREAS STOLCKE **/
+/** OR SOLBOURNE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL **/
+/** DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/
+/** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/
+/** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/
+/** OR PERFORMANCE OF THIS SOFTWARE. **/
+/*****************************************************************************/
+/*
+ * vroot.h -- Virtual Root Window handling header file
+ *
+ * This header file redefines the X11 macros RootWindow and DefaultRootWindow,
+ * making them look for a virtual root window as provided by certain `virtual'
+ * window managers like swm and tvtwm. If none is found, the ordinary root
+ * window is returned, thus retaining backward compatibility with standard
+ * window managers.
+ * The function implementing the virtual root lookup remembers the result of
+ * its last invocation to avoid overhead in the case of repeated calls
+ * on the same display and screen arguments.
+ * The lookup code itself is taken from Tom LaStrange's ssetroot program.
+ *
+ * Most simple root window changing X programs can be converted to using
+ * virtual roots by just including
+ *
+ * #include <X11/vroot.h>
+ *
+ * after all the X11 header files. It has been tested on such popular
+ * X clients as xphoon, xfroot, xloadimage, and xaqua.
+ * It also works with the core clients xprop, xwininfo, xwd, and editres
+ * (and is necessary to get those clients working under tvtwm).
+ * It does NOT work with xsetroot; get the xsetroot replacement included in
+ * the tvtwm distribution instead.
+ *
+ * Andreas Stolcke <[email protected]>, 9/7/90
+ * - replaced all NULL's with properly cast 0's, 5/6/91
+ * - free children list (suggested by Mark Martin <[email protected]>), 5/16/91
+ * - include X11/Xlib.h and support RootWindowOfScreen, too 9/17/91
+ */
+
+#ifndef _VROOT_H_
+#define _VROOT_H_
+
+#if !defined(lint) && !defined(SABER)
+static const char vroot_rcsid[] = "#Id: vroot.h,v 1.4 1991/09/30 19:23:16 stolcke Exp stolcke #";
+#endif
+
+#include <tqwidget.h>
+#ifdef Q_WS_X11
+#include <X11/X.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+
+static Window
+#if defined(__STDC__) || defined(__cplusplus) /* ANSIfication added by jwz, to avoid superfluous warnings. */
+VirtualRootWindowOfScreen(Screen *screen)
+#else /* !__STDC__ */
+VirtualRootWindowOfScreen(screen) Screen *screen;
+#endif /* !__STDC__ */
+{
+ static Screen *save_screen = (Screen *)0;
+ static Window root = (Window)0;
+
+ if (screen != save_screen) {
+ Display *dpy = DisplayOfScreen(screen);
+ Atom __SWM_VROOT = None;
+ uint i;
+ Window rootReturn, parentReturn, *children;
+ unsigned int numChildren;
+
+ root = RootWindowOfScreen(screen);
+
+ /* go look for a virtual root */
+ __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
+ if (XQueryTree(dpy, root, &rootReturn, &parentReturn,
+ &children, &numChildren)) {
+ for (i = 0; i < numChildren; i++) {
+ Atom actual_type;
+ int actual_format;
+ unsigned long nitems, bytesafter;
+ unsigned char *newRoot = 0;
+
+ if (XGetWindowProperty(dpy, children[i],
+ __SWM_VROOT, 0, 1, False, XA_WINDOW,
+ &actual_type, &actual_format,
+ &nitems, &bytesafter,
+ &newRoot) == Success
+ && newRoot)
+ {
+ void *tmpRoot = (void *) newRoot;
+ root = *(Window*) tmpRoot;
+ XFree( (char*) newRoot );
+ break;
+ }
+ }
+ if (children)
+ XFree((char *)children);
+ }
+
+ save_screen = screen;
+ }
+
+ return root;
+}
+
+#undef RootWindowOfScreen
+#define RootWindowOfScreen(s) VirtualRootWindowOfScreen(s)
+
+#undef RootWindow
+#define RootWindow(dpy,screen) VirtualRootWindowOfScreen(ScreenOfDisplay(dpy,screen))
+
+#undef DefaultRootWindow
+#define DefaultRootWindow(dpy) VirtualRootWindowOfScreen(DefaultScreenOfDisplay(dpy))
+#endif
+
+#endif /* _VROOT_H_ */