Rename SWrapper::Workspace to KWin::WorkspaceWrapper

Resolves the problem of having two workspace.(h|cpp). The scripting
workspace is in fact just a wrapper, so having that clear is a plus.
This commit is contained in:
Martin Gräßlin 2012-01-22 12:38:03 +01:00
parent 03e892fcc9
commit 20d8d727ca
5 changed files with 33 additions and 26 deletions

View file

@ -121,7 +121,7 @@ if(KWIN_BUILD_SCRIPTING)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
scripting/scripting.cpp
scripting/workspace.cpp
scripting/workspace_wrapper.cpp
scripting/meta.cpp
scripting/timer.cpp
)

View file

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "scripting.h"
// own
#include "meta.h"
#include "workspace_wrapper.h"
// KDE
#include <kstandarddirs.h>
#include <KDE/KDebug>
@ -53,7 +54,7 @@ KWin::Script::Script(int scriptId, QString scriptName, QDir dir, QObject *parent
, m_engine(new QScriptEngine(this))
, m_scriptDir(dir)
, m_configFile(QFileInfo(m_scriptFile).completeBaseName() + QString(".kwscfg"))
, m_workspace(new SWrapper::Workspace(m_engine))
, m_workspace(new WorkspaceWrapper(m_engine))
, m_running(false)
{
m_scriptFile.setFileName(dir.filePath(scriptName));

View file

@ -24,13 +24,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QDir>
#include "workspace.h"
class QScriptEngine;
class QScriptValue;
namespace KWin
{
class WorkspaceWrapper;
class Script : public QObject
{
@ -67,7 +66,7 @@ private:
QDir m_scriptDir;
QFile m_scriptFile;
QString m_configFile;
SWrapper::Workspace *m_workspace;
WorkspaceWrapper *m_workspace;
bool m_running;
};

View file

@ -19,10 +19,12 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "workspace.h"
#include "workspace_wrapper.h"
#include "../client.h"
SWrapper::Workspace::Workspace(QObject* parent) : QObject(parent)
namespace KWin {
WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent)
{
KWin::Workspace *ws = KWin::Workspace::self();
connect(ws, SIGNAL(desktopPresenceChanged(KWin::Client*,int)), SIGNAL(desktopPresenceChanged(KWin::Client*,int)));
@ -36,62 +38,62 @@ SWrapper::Workspace::Workspace(QObject* parent) : QObject(parent)
}
}
QList< KWin::Client* > SWrapper::Workspace::clientList() const
QList< KWin::Client* > WorkspaceWrapper::clientList() const
{
return KWin::Workspace::self()->clientList();
}
KWin::Client* SWrapper::Workspace::activeClient()
KWin::Client* WorkspaceWrapper::activeClient()
{
return KWin::Workspace::self()->activeClient();
}
void SWrapper::Workspace::setActiveClient(KWin::Client* client)
void WorkspaceWrapper::setActiveClient(KWin::Client* client)
{
KWin::Workspace::self()->activateClient(client);
}
void SWrapper::Workspace::setCurrentDesktop(int desktop)
void WorkspaceWrapper::setCurrentDesktop(int desktop)
{
KWin::Workspace::self()->setCurrentDesktop(desktop);
}
int SWrapper::Workspace::workspaceWidth() const
int WorkspaceWrapper::workspaceWidth() const
{
return KWin::Workspace::self()->workspaceWidth();
}
int SWrapper::Workspace::workspaceHeight() const
int WorkspaceWrapper::workspaceHeight() const
{
return KWin::Workspace::self()->workspaceHeight();
}
QSize SWrapper::Workspace::workspaceSize() const
QSize WorkspaceWrapper::workspaceSize() const
{
return QSize(workspaceWidth(), workspaceHeight());
}
QSize SWrapper::Workspace::desktopGridSize() const
QSize WorkspaceWrapper::desktopGridSize() const
{
return KWin::Workspace::self()->desktopGridSize();
}
int SWrapper::Workspace::desktopGridWidth() const
int WorkspaceWrapper::desktopGridWidth() const
{
return KWin::Workspace::self()->desktopGridWidth();
}
int SWrapper::Workspace::desktopGridHeight() const
int WorkspaceWrapper::desktopGridHeight() const
{
return KWin::Workspace::self()->desktopGridHeight();
}
int SWrapper::Workspace::currentDesktop() const
int WorkspaceWrapper::currentDesktop() const
{
return KWin::Workspace::self()->currentDesktop();
}
void SWrapper::Workspace::setupClientConnections(KWin::Client *client)
void WorkspaceWrapper::setupClientConnections(KWin::Client *client)
{
connect(client, SIGNAL(clientMinimized(KWin::Client*,bool)), SIGNAL(clientMinimized(KWin::Client*)));
connect(client, SIGNAL(clientUnminimized(KWin::Client*,bool)), SIGNAL(clientUnminimized(KWin::Client*)));
@ -99,3 +101,5 @@ void SWrapper::Workspace::setupClientConnections(KWin::Client *client)
connect(client, SIGNAL(clientFullScreenSet(KWin::Client*,bool,bool)), SIGNAL(clientFullScreenSet(KWin::Client*,bool,bool)));
connect(client, SIGNAL(clientMaximizedStateChanged(KWin::Client*,bool,bool)), SIGNAL(clientMaximizeSet(KWin::Client*,bool,bool)));
}
} // KWin

View file

@ -19,15 +19,18 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_SCRIPTING_WORKSPACE_H
#define KWIN_SCRIPTING_WORKSPACE_H
#ifndef KWIN_SCRIPTING_WORKSPACE_WRAPPER_H
#define KWIN_SCRIPTING_WORKSPACE_WRAPPER_H
#include "../workspace.h"
#include <QtCore/QObject>
#include <QtCore/QSize>
namespace SWrapper
namespace KWin
{
// forward declarations
class Client;
class Workspace : public QObject
class WorkspaceWrapper : public QObject
{
Q_OBJECT
Q_PROPERTY(int currentDesktop READ currentDesktop WRITE setCurrentDesktop NOTIFY currentDesktopChanged)
@ -41,7 +44,7 @@ class Workspace : public QObject
Q_PROPERTY(QSize workspaceSize READ workspaceSize)
private:
Q_DISABLE_COPY(Workspace)
Q_DISABLE_COPY(WorkspaceWrapper)
signals:
void desktopPresenceChanged(KWin::Client*, int);
@ -59,7 +62,7 @@ signals:
void clientSetKeepAbove(KWin::Client*, bool);
public:
Workspace(QObject* parent = 0);
WorkspaceWrapper(QObject* parent = 0);
int currentDesktop() const;
void setCurrentDesktop(int desktop);
KWin::Client *activeClient();