1 //-----------------------------------------------------------------------------
3 // Screen savers for KDE
5 // Copyright (c) Martin R. Jones 1999
16 #include <kstandarddirs.h>
18 #include <kapplication.h>
19 #include <kcmdlineargs.h>
21 #include <QDesktopWidget>
25 static const char appName
[] = "klock";
26 static const char description
[] = I18N_NOOP("KDE Screen Lock/Saver");
27 static const char version
[] = "2.0.0";
29 static void crashHandler( int /*sig*/ )
32 signal ( SIGABRT
, SIG_DFL
);
37 //----------------------------------------------------------------------------
39 int main(int argc
, char *argv
[])
41 KCmdLineArgs::init(argc
, argv
, appName
, 0, ki18n("KLock"), version
, ki18n(description
));
44 KCmdLineOptions options
;
46 options
.add("setup", ki18n("Setup screen saver"));
48 options
.add("window-id wid", ki18n("Run in the specified XWindow"));
50 options
.add("root", ki18n("Run in the root XWindow"));
52 options
.add("demo", ki18n("Start screen saver in demo mode"), "default");
54 KCmdLineArgs::addCmdLineOptions(options
);
58 KCrash::setCrashHandler( crashHandler
);
60 DemoWindow
*demoWidget
= 0;
63 KCmdLineArgs
*args
= KCmdLineArgs::parsedArgs();
65 if (args
->isSet("setup"))
71 if (args
->isSet("window-id"))
73 saveWin
= args
->getOption("window-id").toInt();
76 if (args
->isSet("root"))
78 saveWin
= QApplication::desktop()->handle();
81 if (args
->isSet("demo"))
88 demoWidget
= new DemoWindow();
89 demoWidget
->setAttribute(Qt::WA_NoSystemBackground
, true);
91 saveWin
= demoWidget
->winId();
95 startScreenSaver(saveWin
);