summaryrefslogtreecommitdiffstats
path: root/tdescreensaver/xsavers/main.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-01-26 13:16:15 -0600
committerTimothy Pearson <[email protected]>2013-01-26 13:16:15 -0600
commit7e09b5c2efae58399621a938de26b9675b8ba621 (patch)
treede2c9535e1f4c48ae91910492d298eba1d593fd5 /tdescreensaver/xsavers/main.cpp
parent159f7e147ac33c924b3ce9050c8f03cbc54916ee (diff)
downloadtdeartwork-7e09b5c2efae58399621a938de26b9675b8ba621.tar.gz
tdeartwork-7e09b5c2efae58399621a938de26b9675b8ba621.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdescreensaver/xsavers/main.cpp')
-rw-r--r--tdescreensaver/xsavers/main.cpp108
1 files changed, 108 insertions, 0 deletions
diff --git a/tdescreensaver/xsavers/main.cpp b/tdescreensaver/xsavers/main.cpp
new file mode 100644
index 00000000..d7f76dcd
--- /dev/null
+++ b/tdescreensaver/xsavers/main.cpp
@@ -0,0 +1,108 @@
+//-----------------------------------------------------------------------------
+//
+// Screen savers for KDE
+//
+// Copyright (c) Martin R. Jones 1999
+//
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+
+#include <tqcolor.h>
+
+#include <klocale.h>
+#include <kconfig.h>
+#include <kstandarddirs.h>
+#include <kdebug.h>
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kcrash.h>
+
+#include "demowin.h"
+#include "saver.h"
+
+static const char appName[] = "klock";
+static const char description[] = I18N_NOOP("TDE Screen Lock/Saver");
+static const char version[] = "2.0.0";
+
+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 /*sig*/ )
+{
+#ifdef SIGABRT
+ signal ( SIGABRT, SIG_DFL );
+#endif
+ abort();
+}
+
+//----------------------------------------------------------------------------
+
+int main(int argc, char *argv[])
+{
+ TDECmdLineArgs::init(argc, argv, appName, I18N_NOOP("KLock"), description, version);
+
+ TDECmdLineArgs::addCmdLineOptions(options);
+
+ TDEApplication app;
+
+ KCrash::setCrashHandler( crashHandler );
+
+ DemoWindow *demoWidget = 0;
+ Window saveWin = 0;
+
+ TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
+
+ if (args->isSet("setup"))
+ {
+ setupScreenSaver();
+ exit(0);
+ }
+
+ if (args->isSet("window-id"))
+ {
+ saveWin = atol(args->getOption("window-id"));
+ }
+
+ if (args->isSet("root"))
+ {
+ saveWin = TQApplication::desktop()->handle();
+ }
+
+ if (args->isSet("demo"))
+ {
+ saveWin = 0;
+ }
+
+ if (saveWin == 0)
+ {
+ demoWidget = new DemoWindow();
+ demoWidget->setBackgroundMode(TQWidget::NoBackground);
+// demoWidget->setBackgroundColor(TQt::black);
+ demoWidget->show();
+ saveWin = demoWidget->winId();
+ app.setMainWidget(demoWidget);
+ app.processEvents();
+ }
+
+ startScreenSaver(saveWin);
+ app.exec();
+ stopScreenSaver();
+
+ if (demoWidget)
+ {
+ delete demoWidget;
+ }
+
+ return 0;
+}
+