diff --git a/main.cpp b/main.cpp index 2e227f5173..6730ac886e 100644 --- a/main.cpp +++ b/main.cpp @@ -22,12 +22,6 @@ #include -static KCmdLineOptions cmdOptions[] = -{ - { "+[workspace]", I18N_NOOP("A cryptic command line option"), 0 }, - { 0, 0, 0 } -}; - Options* options; Atoms* atoms; @@ -67,27 +61,24 @@ int x11ErrorHandler(Display *d, XErrorEvent *e){ Application::Application( ) : KApplication( ) { - initting = TRUE; - options = new Options; - atoms = new Atoms; + initting = TRUE; // startup.... // install X11 error handler XSetErrorHandler( x11ErrorHandler ); + // check whether another windowmanager is running + XSelectInput(qt_xdisplay(), qt_xrootwin(), SubstructureRedirectMask ); + syncX(); // trigger error now + + options = new Options; + atoms = new Atoms; + // create a workspace. workspaces += new Workspace(); - initting = FALSE; - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - if ( args->count() ) { - QString s = args->arg(0); - int i = s.toInt(); - workspaces += new Workspace( (WId ) i ); - } - args->clear(); - - syncX(); - initting = FALSE; + + syncX(); // trigger possible errors, there's still a chance to abort + + initting = FALSE; // startup done, we are up and running now. } @@ -172,7 +163,6 @@ int main( int argc, char * argv[] ) aboutData.addAuthor("Daniel M. Duley",0, "mosfet@kde.org"); KCmdLineArgs::init(argc, argv, &aboutData); - KCmdLineArgs::addCmdLineOptions( cmdOptions ); if (signal(SIGTERM, sighandler) == SIG_IGN) signal(SIGTERM, SIG_IGN); diff --git a/workspace.cpp b/workspace.cpp index 30147290fe..16ea3ec542 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -93,7 +93,7 @@ Client* Workspace::clientFactory( Workspace *ws, WId w ) Workspace::Workspace() { - root = qt_xrootwin(); // no MDI for now + root = qt_xrootwin(); (void) QApplication::desktop(); // trigger creation of desktop widget desktop_widget = new QWidget(0, "desktop_widget", Qt::WType_Desktop | Qt::WPaintUnclipped ); @@ -130,27 +130,6 @@ Workspace::Workspace() tab_box = new TabBox( this ); } -Workspace::Workspace( WId rootwin ) -{ - qDebug("create MDI workspace for %d", rootwin ); - root = rootwin; - - // select windowmanager privileges - XSelectInput(qt_xdisplay(), root, - KeyPressMask | - PropertyChangeMask | - ColormapChangeMask | - SubstructureRedirectMask | - SubstructureNotifyMask - ); - - control_grab = FALSE; - tab_grab = FALSE; - tab_box = 0; - keys = 0; - init(); -} - void Workspace::init() { tab_box = 0; diff --git a/workspace.h b/workspace.h index 797311bb80..b070378272 100644 --- a/workspace.h +++ b/workspace.h @@ -48,7 +48,6 @@ class Workspace : public QObject Q_OBJECT public: Workspace(); - Workspace( WId rootwin ); virtual ~Workspace(); virtual bool workspaceEvent( XEvent * ); @@ -144,7 +143,7 @@ protected: bool keyRelease( XKeyEvent key ); bool keyPressMouseEmulation( XKeyEvent key ); bool clientMessage( XClientMessageEvent msg ); - + private: void init(); KGlobalAccel *keys;