Make Workspace a singleton, accesible via Workspace::self()
svn path=/trunk/kdebase/kwin/; revision=93375
This commit is contained in:
parent
57f4808d0f
commit
42291d5b87
4 changed files with 13 additions and 13 deletions
14
main.cpp
14
main.cpp
|
@ -124,8 +124,8 @@ Application::Application( )
|
||||||
options = new Options;
|
options = new Options;
|
||||||
atoms = new Atoms;
|
atoms = new Atoms;
|
||||||
|
|
||||||
// create a workspace.
|
// create workspace.
|
||||||
workspaces += new Workspace( isSessionRestored() );
|
(void) new Workspace( isSessionRestored() );
|
||||||
|
|
||||||
syncX(); // trigger possible errors, there's still a chance to abort
|
syncX(); // trigger possible errors, there's still a chance to abort
|
||||||
|
|
||||||
|
@ -136,9 +136,7 @@ Application::Application( )
|
||||||
|
|
||||||
Application::~Application()
|
Application::~Application()
|
||||||
{
|
{
|
||||||
for ( WorkspaceList::Iterator it = workspaces.begin(); it != workspaces.end(); ++it) {
|
delete Workspace::self();
|
||||||
delete (*it);
|
|
||||||
}
|
|
||||||
delete options;
|
delete options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,10 +165,8 @@ bool Application::x11EventFilter( XEvent *e )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( WorkspaceList::Iterator it = workspaces.begin(); it != workspaces.end(); ++it) {
|
if ( Workspace::self()->workspaceEvent( e ) )
|
||||||
if ( (*it)->workspaceEvent( e ) )
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
return KApplication::x11EventFilter( e );
|
return KApplication::x11EventFilter( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +191,7 @@ void Application::saveState( QSessionManager& sm )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
workspaces.first()->storeSession( kapp->sessionConfig() );
|
Workspace::self()->storeSession( kapp->sessionConfig() );
|
||||||
kapp->sessionConfig()->sync();
|
kapp->sessionConfig()->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
main.h
4
main.h
|
@ -9,7 +9,6 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
||||||
#include <kapp.h>
|
#include <kapp.h>
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
typedef QValueList<KWinInternal::Workspace*> WorkspaceList;
|
|
||||||
class Application : public KApplication
|
class Application : public KApplication
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -21,9 +20,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool x11EventFilter( XEvent * );
|
bool x11EventFilter( XEvent * );
|
||||||
|
|
||||||
private:
|
|
||||||
WorkspaceList workspaces;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,8 @@ Client* Workspace::clientFactory( WId w )
|
||||||
return ( mgr->allocateClient( this, w, false ) );
|
return ( mgr->allocateClient( this, w, false ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Workspace *Workspace::_self = 0;
|
||||||
|
|
||||||
// Rikkus: This class is too complex. It needs splitting further.
|
// Rikkus: This class is too complex. It needs splitting further.
|
||||||
// It's a nightmare to understand, especially with so few comments :(
|
// It's a nightmare to understand, especially with so few comments :(
|
||||||
|
|
||||||
|
@ -240,6 +242,7 @@ Workspace::Workspace( bool restore )
|
||||||
keys (0),
|
keys (0),
|
||||||
root (0)
|
root (0)
|
||||||
{
|
{
|
||||||
|
_self = this;
|
||||||
d = new WorkspacePrivate;
|
d = new WorkspacePrivate;
|
||||||
mgr = new PluginMgr;
|
mgr = new PluginMgr;
|
||||||
connect(options, SIGNAL(resetPlugin()), mgr, SLOT(resetPlugin()));
|
connect(options, SIGNAL(resetPlugin()), mgr, SLOT(resetPlugin()));
|
||||||
|
@ -299,6 +302,7 @@ Workspace::Workspace( bool restore )
|
||||||
restoreLegacySession(kapp->sessionConfig());
|
restoreLegacySession(kapp->sessionConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Workspace::init()
|
void Workspace::init()
|
||||||
{
|
{
|
||||||
supportWindow = new QWidget;
|
supportWindow = new QWidget;
|
||||||
|
@ -419,6 +423,7 @@ Workspace::~Workspace()
|
||||||
delete supportWindow;
|
delete supportWindow;
|
||||||
delete mgr;
|
delete mgr;
|
||||||
delete d;
|
delete d;
|
||||||
|
_self = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,8 @@ public:
|
||||||
Workspace( bool restore = FALSE );
|
Workspace( bool restore = FALSE );
|
||||||
virtual ~Workspace();
|
virtual ~Workspace();
|
||||||
|
|
||||||
|
static Workspace * self() { return _self; }
|
||||||
|
|
||||||
virtual bool workspaceEvent( XEvent * );
|
virtual bool workspaceEvent( XEvent * );
|
||||||
|
|
||||||
bool hasClient(Client *);
|
bool hasClient(Client *);
|
||||||
|
@ -386,6 +388,7 @@ private:
|
||||||
QTimer focusEnsuranceTimer;
|
QTimer focusEnsuranceTimer;
|
||||||
|
|
||||||
WorkspacePrivate* d;
|
WorkspacePrivate* d;
|
||||||
|
static Workspace *_self;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline WId Workspace::rootWin() const
|
inline WId Workspace::rootWin() const
|
||||||
|
|
Loading…
Reference in a new issue