Source Code (Use browser search to find items of interest.)

Class Index

kwin'Application (./kdebase/kwin/main.h:13)

class Application : public  KApplication
{
public:
    Application();
    ~Application();

    void commitData( QSessionManager& sm );
    void saveState( QSessionManager& sm );
    
protected:
    bool x11EventFilter( XEvent * );

private:
    WorkspaceList workspaces;
};


kwin'Application::Application() (./kdebase/kwin/main.cpp:68)

Application::Application( )
: KApplication( )
{
    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( isSessionRestored() );

    syncX(); // trigger possible errors, there's still a chance to abort

    initting = FALSE; // startup done, we are up and running now.
}



kwin'Application::~Application() (./kdebase/kwin/main.cpp:92)

Application::~Application()
{
     for ( WorkspaceList::Iterator it = workspaces.begin(); it != workspaces.end(); ++it) {
	 delete (*it);
     }
     delete options;
}



kwin'Application::x11EventFilter() (./kdebase/kwin/main.cpp:101)

bool Application::x11EventFilter( XEvent *e )
{
    switch ( e->type ) {
    case ButtonPress:
    case ButtonRelease:
    case MotionNotify:
	kwin_time = (e->type == MotionNotify) ?
		    e->xmotion.time : e->xbutton.time;
	break;
    case KeyPress:
    case KeyRelease:
	kwin_time = e->xkey.time;
	break;
    case PropertyNotify:
	kwin_time = e->xproperty.time;
	break;
    case ConfigureNotify:
	{
 	    if ( e->xconfigure.window != e->xconfigure.event  )
 		return TRUE;
	}
	break;
    default:
	break;
    }

     for ( WorkspaceList::Iterator it = workspaces.begin(); it != workspaces.end(); ++it) {
	 if ( (*it)->workspaceEvent( e ) )
	     return TRUE;
     }
     return KApplication::x11EventFilter( e );
}


kwin'Application::commitData() (./kdebase/kwin/main.cpp:134)

void Application::commitData( QSessionManager& /*sm*/ )
{
    // nothing to do, really
}


kwin'Application::saveState() (./kdebase/kwin/main.cpp:139)

void Application::saveState( QSessionManager& sm )
{
    KApplication::saveState( sm );
    static bool firstTime = false;
    if ( firstTime ) {
	firstTime = false;
	return; // no need to save this state.
    }

    sm.release();
    
    // we really should do phase 2 here, unfortunately qt-2.1beta3 contains a bug. 
    // #######TODO FIXME with final Qt-2.1
    /*
    if ( !sm.isPhase2() ) {
 	sm.requestPhase2();
 	return;
    }
    */

    workspaces.first()->storeSession( kapp->sessionConfig() );
    kapp->sessionConfig()->sync();
}