diff --git a/CMakeLists.txt b/CMakeLists.txt index ad2b24bfe2..dfb6f4a57c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/scripting/scripting.cpp b/scripting/scripting.cpp index 4142f98f58..dbfa6dd321 100644 --- a/scripting/scripting.cpp +++ b/scripting/scripting.cpp @@ -22,6 +22,7 @@ along with this program. If not, see . #include "scripting.h" // own #include "meta.h" +#include "workspace_wrapper.h" // KDE #include #include @@ -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)); diff --git a/scripting/scripting.h b/scripting/scripting.h index 6dbf8f66f1..3811c4d710 100644 --- a/scripting/scripting.h +++ b/scripting/scripting.h @@ -24,13 +24,12 @@ along with this program. If not, see . #include -#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; }; diff --git a/scripting/workspace.cpp b/scripting/workspace_wrapper.cpp similarity index 79% rename from scripting/workspace.cpp rename to scripting/workspace_wrapper.cpp index 0f4bff6667..8a9543aef8 100644 --- a/scripting/workspace.cpp +++ b/scripting/workspace_wrapper.cpp @@ -19,10 +19,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ -#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 diff --git a/scripting/workspace.h b/scripting/workspace_wrapper.h similarity index 89% rename from scripting/workspace.h rename to scripting/workspace_wrapper.h index d6c2eea64b..f2b1f8257e 100644 --- a/scripting/workspace.h +++ b/scripting/workspace_wrapper.h @@ -19,15 +19,18 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ -#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 +#include -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();