Clean-up Scripting Wrapper for Workspace
No need to manually convert everything to script values.icc-effect-5.14.5
parent
4f54cd95ee
commit
49b24e4940
|
@ -2104,7 +2104,7 @@ void Client::setMaximize(bool vertically, bool horizontally)
|
|||
//so many clients and the workspace
|
||||
SWrapper::WorkspaceProxy* ws_wrap = SWrapper::WorkspaceProxy::instance();
|
||||
if (ws_wrap != 0) {
|
||||
ws_wrap->sl_clientMaximizeSet(this, QPair<bool, bool>(vertically, horizontally));
|
||||
ws_wrap->sl_clientMaximizeSet(this, vertically, horizontally);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "meta.h"
|
||||
// KDE
|
||||
#include <kstandarddirs.h>
|
||||
#include <KDE/KDebug>
|
||||
// Qt
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtCore/QSettings>
|
||||
|
|
|
@ -20,7 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
|
||||
#include "workspace.h"
|
||||
#include "workspaceproxy.h"
|
||||
#include "meta.h"
|
||||
#include "../client.h"
|
||||
|
||||
KWin::Workspace* SWrapper::Workspace::centralObject = 0;
|
||||
|
||||
|
@ -37,186 +39,57 @@ SWrapper::Workspace::Workspace(QObject* parent) : QObject(parent)
|
|||
SWrapper::WorkspaceProxy* proxy = SWrapper::WorkspaceProxy::instance();
|
||||
|
||||
QObject::connect(centralObject, SIGNAL(desktopPresenceChanged(KWin::Client*,int)),
|
||||
this, SLOT(sl_desktopPresenceChanged(KWin::Client*,int))
|
||||
this, SIGNAL(desktopPresenceChanged(KWin::Client*,int))
|
||||
);
|
||||
|
||||
QObject::connect(centralObject, SIGNAL(currentDesktopChanged(int)),
|
||||
this, SLOT(sl_currentDesktopChanged(int))
|
||||
this, SIGNAL(currentDesktopChanged(int))
|
||||
);
|
||||
|
||||
QObject::connect(centralObject, SIGNAL(clientAdded(KWin::Client*)),
|
||||
this, SLOT(sl_clientAdded(KWin::Client*))
|
||||
this, SIGNAL(clientAdded(KWin::Client*))
|
||||
);
|
||||
|
||||
QObject::connect(centralObject, SIGNAL(clientRemoved(KWin::Client*)),
|
||||
this, SLOT(sl_clientRemoved(KWin::Client*))
|
||||
this, SIGNAL(clientRemoved(KWin::Client*))
|
||||
);
|
||||
|
||||
QObject::connect(centralObject, SIGNAL(clientActivated(KWin::Client*)),
|
||||
this, SLOT(sl_clientActivated(KWin::Client*))
|
||||
);
|
||||
|
||||
QObject::connect(centralObject, SIGNAL(groupAdded(KWin::Group*)),
|
||||
this, SLOT(sl_groupAdded(KWin::Group*))
|
||||
this, SIGNAL(clientActivated(KWin::Client*))
|
||||
);
|
||||
|
||||
QObject::connect(proxy, SIGNAL(clientMinimized(KWin::Client*)),
|
||||
this, SLOT(sl_clientMinimized(KWin::Client*))
|
||||
this, SIGNAL(clientMinimized(KWin::Client*))
|
||||
);
|
||||
|
||||
QObject::connect(proxy, SIGNAL(clientUnminimized(KWin::Client*)),
|
||||
this, SLOT(sl_clientUnminimized(KWin::Client*))
|
||||
this, SIGNAL(clientUnminimized(KWin::Client*))
|
||||
);
|
||||
|
||||
QObject::connect(proxy, SIGNAL(clientMaximizeSet(KWin::Client*,QPair<bool,bool>)),
|
||||
this, SLOT(sl_clientMaximizeSet(KWin::Client*,QPair<bool,bool>))
|
||||
QObject::connect(proxy, SIGNAL(clientMaximizeSet(KWin::Client*,bool,bool)),
|
||||
this, SIGNAL(clientMaximizeSet(KWin::Client*,bool,bool))
|
||||
);
|
||||
|
||||
QObject::connect(proxy, SIGNAL(clientManaging(KWin::Client*)),
|
||||
this, SLOT(sl_clientManaging(KWin::Client*))
|
||||
this, SIGNAL(clientManaging(KWin::Client*))
|
||||
);
|
||||
|
||||
QObject::connect(proxy, SIGNAL(killWindowCalled(KWin::Client*)),
|
||||
this, SLOT(sl_killWindowCalled(KWin::Client*))
|
||||
this, SIGNAL(killWindowCalled(KWin::Client*))
|
||||
);
|
||||
|
||||
QObject::connect(proxy, SIGNAL(clientFullScreenSet(KWin::Client*,bool,bool)),
|
||||
this, SLOT(sl_clientFullScreenSet(KWin::Client*,bool,bool))
|
||||
this, SIGNAL(clientFullScreenSet(KWin::Client*,bool,bool))
|
||||
);
|
||||
|
||||
QObject::connect(proxy, SIGNAL(clientSetKeepAbove(KWin::Client*,bool)),
|
||||
this, SLOT(sl_clientSetKeepAbove(KWin::Client*,bool))
|
||||
this, SIGNAL(clientSetKeepAbove(KWin::Client*,bool))
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_desktopPresenceChanged(KWin::Client* client, int prev_desk)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit desktopPresenceChanged(valueForClient(client, centralEngine),
|
||||
centralEngine->toScriptValue(prev_desk)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_clientAdded(KWin::Client* client)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit clientAdded(valueForClient(client, centralEngine));
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_clientFullScreenSet(KWin::Client* client, bool set, bool user)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit clientFullScreenSet(valueForClient(client, centralEngine),
|
||||
centralEngine->toScriptValue<bool>(set),
|
||||
centralEngine->toScriptValue<bool>(user)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_clientSetKeepAbove(KWin::Client* client, bool set)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit clientSetKeepAbove(valueForClient(client, centralEngine),
|
||||
centralEngine->toScriptValue<bool>(set)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_currentDesktopChanged(int prev_desk)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit currentDesktopChanged(centralEngine->toScriptValue(prev_desk));
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_clientRemoved(KWin::Client* client)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit clientRemoved(valueForClient(client, centralEngine));
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_clientManaging(KWin::Client* client)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit clientManaging(valueForClient(client, centralEngine));
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_clientMinimized(KWin::Client* client)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit clientMinimized(valueForClient(client, centralEngine));
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_clientUnminimized(KWin::Client* client)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit clientUnminimized(valueForClient(client, centralEngine));
|
||||
emit clientRestored(valueForClient(client, centralEngine));
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_clientMaximizeSet(KWin::Client* client, QPair<bool, bool> param)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
QScriptValue temp = centralEngine->newObject();
|
||||
temp.setProperty("v", centralEngine->toScriptValue(param.first));
|
||||
temp.setProperty("h", centralEngine->toScriptValue(param.second));
|
||||
emit clientMaximizeSet(valueForClient(client, centralEngine), temp);
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_killWindowCalled(KWin::Client* client)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit killWindowCalled(valueForClient(client, centralEngine));
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_clientActivated(KWin::Client* client)
|
||||
{
|
||||
if (centralEngine == 0) {
|
||||
return;
|
||||
} else {
|
||||
emit clientActivated(valueForClient(client, centralEngine));
|
||||
}
|
||||
}
|
||||
|
||||
void SWrapper::Workspace::sl_groupAdded(KWin::Group* group)
|
||||
{
|
||||
Q_UNUSED(group);
|
||||
//TODO
|
||||
}
|
||||
|
||||
bool SWrapper::Workspace::initialize(KWin::Workspace* wspace)
|
||||
{
|
||||
if (wspace == 0) {
|
||||
|
|
|
@ -21,13 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifndef KWIN_SCRIPTING_WORKSPACE_H
|
||||
#define KWIN_SCRIPTING_WORKSPACE_H
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "./../workspace.h"
|
||||
#include "./../client.h"
|
||||
#include "./../group.h"
|
||||
|
||||
#include "workspaceproxy.h"
|
||||
#include "../workspace.h"
|
||||
#include <QScriptEngine>
|
||||
|
||||
namespace SWrapper
|
||||
|
@ -45,35 +39,20 @@ private:
|
|||
|
||||
Q_DISABLE_COPY(Workspace)
|
||||
|
||||
public slots:
|
||||
void sl_desktopPresenceChanged(KWin::Client*, int);
|
||||
void sl_currentDesktopChanged(int);
|
||||
void sl_clientAdded(KWin::Client*);
|
||||
void sl_clientRemoved(KWin::Client*);
|
||||
void sl_clientManaging(KWin::Client*);
|
||||
void sl_clientMinimized(KWin::Client*);
|
||||
void sl_clientUnminimized(KWin::Client*);
|
||||
void sl_clientMaximizeSet(KWin::Client*, QPair<bool, bool>);
|
||||
void sl_killWindowCalled(KWin::Client*);
|
||||
void sl_clientActivated(KWin::Client*);
|
||||
void sl_groupAdded(KWin::Group*);
|
||||
void sl_clientFullScreenSet(KWin::Client*, bool, bool);
|
||||
void sl_clientSetKeepAbove(KWin::Client*, bool);
|
||||
|
||||
signals:
|
||||
void desktopPresenceChanged(QScriptValue, QScriptValue);
|
||||
void currentDesktopChanged(QScriptValue);
|
||||
void clientAdded(QScriptValue);
|
||||
void clientRemoved(QScriptValue);
|
||||
void clientManaging(QScriptValue);
|
||||
void clientMinimized(QScriptValue);
|
||||
void clientUnminimized(QScriptValue);
|
||||
void clientRestored(QScriptValue);
|
||||
void clientMaximizeSet(QScriptValue, QScriptValue);
|
||||
void killWindowCalled(QScriptValue);
|
||||
void clientActivated(QScriptValue);
|
||||
void clientFullScreenSet(QScriptValue, QScriptValue, QScriptValue);
|
||||
void clientSetKeepAbove(QScriptValue, QScriptValue);
|
||||
void desktopPresenceChanged(KWin::Client*, int);
|
||||
void currentDesktopChanged(int);
|
||||
void clientAdded(KWin::Client*);
|
||||
void clientRemoved(KWin::Client*);
|
||||
void clientManaging(KWin::Client*);
|
||||
void clientMinimized(KWin::Client*);
|
||||
void clientUnminimized(KWin::Client*);
|
||||
void clientRestored(KWin::Client*);
|
||||
void clientMaximizeSet(KWin::Client*, bool, bool);
|
||||
void killWindowCalled(KWin::Client*);
|
||||
void clientActivated(KWin::Client*);
|
||||
void clientFullScreenSet(KWin::Client*, bool, bool);
|
||||
void clientSetKeepAbove(KWin::Client*, bool);
|
||||
|
||||
public:
|
||||
Workspace(QObject* parent = 0);
|
||||
|
|
|
@ -38,7 +38,7 @@ PROXYPASS1(clientManaging, KWin::Client*)
|
|||
PROXYPASS1(clientMinimized, KWin::Client*)
|
||||
PROXYPASS1(clientUnminimized, KWin::Client*)
|
||||
PROXYPASS1(killWindowCalled, KWin::Client*)
|
||||
PROXYPASS2(clientMaximizeSet, KWin::Client*, DualBool)
|
||||
PROXYPASS2(clientSetKeepAbove, KWin::Client*, bool)
|
||||
|
||||
PROXYPASS3(clientFullScreenSet, KWin::Client*, bool, bool)
|
||||
PROXYPASS3(clientMaximizeSet, KWin::Client*, bool, bool)
|
||||
|
|
|
@ -22,12 +22,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define KWIN_SCRIPTING_WORKSPACEPROXY_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QScriptValue>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "../workspace.h"
|
||||
#include "../client.h"
|
||||
namespace KWin {
|
||||
class Client;
|
||||
class Workspace;
|
||||
}
|
||||
|
||||
#define PROXYPASS1(name, param) \
|
||||
void SWrapper::WorkspaceProxy::sl_ ## name(param _param) { \
|
||||
|
@ -44,8 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
name(_param1, _param2, _param3); \
|
||||
}
|
||||
|
||||
typedef QPair<bool, bool> DualBool;
|
||||
|
||||
namespace SWrapper
|
||||
{
|
||||
/**
|
||||
|
@ -63,7 +60,7 @@ public slots:
|
|||
void sl_clientManaging(KWin::Client*);
|
||||
void sl_clientMinimized(KWin::Client*);
|
||||
void sl_clientUnminimized(KWin::Client*);
|
||||
void sl_clientMaximizeSet(KWin::Client*, QPair<bool, bool>);
|
||||
void sl_clientMaximizeSet(KWin::Client*, bool, bool);
|
||||
void sl_killWindowCalled(KWin::Client*);
|
||||
void sl_clientFullScreenSet(KWin::Client*, bool, bool);
|
||||
void sl_clientSetKeepAbove(KWin::Client*, bool);
|
||||
|
@ -72,7 +69,7 @@ signals:
|
|||
void clientManaging(KWin::Client*);
|
||||
void clientMinimized(KWin::Client*);
|
||||
void clientUnminimized(KWin::Client*);
|
||||
void clientMaximizeSet(KWin::Client*, QPair<bool, bool>);
|
||||
void clientMaximizeSet(KWin::Client*, bool, bool);
|
||||
void killWindowCalled(KWin::Client*);
|
||||
void clientFullScreenSet(KWin::Client*, bool, bool);
|
||||
void clientSetKeepAbove(KWin::Client*, bool);
|
||||
|
|
Loading…
Reference in New Issue