Remove repetitive code in WorkspaceWrapper

This commit is contained in:
Martin Gräßlin 2012-01-26 08:33:21 +01:00
parent 26d069981d
commit 55088ba776
2 changed files with 14 additions and 46 deletions

View file

@ -48,64 +48,34 @@ void WorkspaceWrapper::setterName( rettype val ) { \
}
GETTERSETTER(int, numberOfDesktops, setNumberOfDesktops)
GETTERSETTER(int, currentDesktop, setCurrentDesktop)
#undef GETTERSETTER
QList< KWin::Client* > WorkspaceWrapper::clientList() const
{
return KWin::Workspace::self()->clientList();
#define GETTER( rettype, getterName ) \
rettype WorkspaceWrapper::getterName( ) const { \
return Workspace::self()->getterName(); \
}
GETTER(KWin::Client*, activeClient)
GETTER(QList< KWin::Client* >, clientList)
GETTER(int, workspaceWidth)
GETTER(int, workspaceHeight)
GETTER(QSize, desktopGridSize)
GETTER(int, desktopGridWidth)
GETTER(int, desktopGridHeight)
KWin::Client* WorkspaceWrapper::activeClient()
{
return KWin::Workspace::self()->activeClient();
}
#undef GETTER
void WorkspaceWrapper::setActiveClient(KWin::Client* client)
{
KWin::Workspace::self()->activateClient(client);
}
void WorkspaceWrapper::setCurrentDesktop(int desktop)
{
KWin::Workspace::self()->setCurrentDesktop(desktop);
}
int WorkspaceWrapper::workspaceWidth() const
{
return KWin::Workspace::self()->workspaceWidth();
}
int WorkspaceWrapper::workspaceHeight() const
{
return KWin::Workspace::self()->workspaceHeight();
}
QSize WorkspaceWrapper::workspaceSize() const
{
return QSize(workspaceWidth(), workspaceHeight());
}
QSize WorkspaceWrapper::desktopGridSize() const
{
return KWin::Workspace::self()->desktopGridSize();
}
int WorkspaceWrapper::desktopGridWidth() const
{
return KWin::Workspace::self()->desktopGridWidth();
}
int WorkspaceWrapper::desktopGridHeight() const
{
return KWin::Workspace::self()->desktopGridHeight();
}
int WorkspaceWrapper::currentDesktop() const
{
return KWin::Workspace::self()->currentDesktop();
}
void WorkspaceWrapper::setupClientConnections(KWin::Client *client)
{
connect(client, SIGNAL(clientMinimized(KWin::Client*,bool)), SIGNAL(clientMinimized(KWin::Client*)));

View file

@ -77,11 +77,9 @@ public:
rettype getter() const; \
void setter( rettype val );
GETTERSETTERDEF(int, numberOfDesktops, setNumberOfDesktops)
GETTERSETTERDEF(int, currentDesktop, setCurrentDesktop)
GETTERSETTERDEF(KWin::Client*, activeClient, setActiveClient)
#undef GETTERSETTERDEF
int currentDesktop() const;
void setCurrentDesktop(int desktop);
KWin::Client *activeClient();
void setActiveClient(KWin::Client *client);
QSize desktopGridSize() const;
int desktopGridWidth() const;
int desktopGridHeight() const;