27 #include <tdelocale.h>
28 #include <tdeglobal.h>
30 #include <tdecmdlineargs.h>
31 #include <tdeapplication.h>
34 #include "tdescreensaver.h"
35 #include "tdescreensaver_vroot.h"
37 bool argb_visual = FALSE;
41 extern const char *kss_applicationName;
42 extern const char *kss_description;
43 extern const char *kss_version;
45 TQDialog *kss_setup();
48 static const TDECmdLineOptions options[] =
50 {
"setup", I18N_NOOP(
"Setup screen saver"), 0 },
51 {
"window-id wid", I18N_NOOP(
"Run in the specified XWindow"), 0 },
52 {
"root", I18N_NOOP(
"Run in the root XWindow"), 0 },
53 {
"demo", I18N_NOOP(
"Start screen saver in demo mode"),
"default"},
57 static void crashHandler(
int )
60 signal (SIGABRT, SIG_DFL);
67 class DemoWindow :
public TQWidget
70 DemoWindow() : TQWidget()
72 setFixedSize(600, 420);
76 virtual void keyPressEvent(TQKeyEvent *e)
78 if (e->ascii() ==
'q')
84 virtual void closeEvent( TQCloseEvent * )
92 #if defined(TQ_WS_QWS) || defined(TQ_WS_MACX)
96 TDE_EXPORT
int main(
int argc,
char *argv[])
98 TDELocale::setMainCatalogue(
"libtdescreensaver");
99 TDECmdLineArgs::init(argc, argv, kss_applicationName, kss_description, kss_version);
101 TDECmdLineArgs::addCmdLineOptions(options);
103 #ifdef HAVE_XCOMPOSITE
104 TDEApplication app(TDEApplication::openX11RGBADisplay());
105 argb_visual = app.isX11CompositionAvailable();
110 TDECrash::setCrashHandler( crashHandler );
111 TDEGlobal::locale()->insertCatalogue(
"klock");
112 TDEGlobal::locale()->insertCatalogue(
"tdescreensaver");
114 DemoWindow *demoWidget = 0;
118 TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
120 if (args->isSet(
"setup"))
122 TQDialog *dlg = kss_setup();
129 if (args->isSet(
"window-id"))
131 saveWin = atol(args->getOption(
"window-id"));
135 if (args->isSet(
"root"))
137 saveWin = RootWindow(tqt_xdisplay(), tqt_xscreen());
141 if (args->isSet(
"demo"))
148 demoWidget =
new DemoWindow();
149 demoWidget->setBackgroundMode(TQWidget::NoBackground);
150 saveWin = demoWidget->winId();
151 app.setMainWidget(demoWidget);
155 target = kss_create( saveWin );
159 demoWidget->setFixedSize( 600, 420 );
Provides a TQWidget for a screensaver to draw into.