Start to port it to new dbus interface

svn path=/trunk/KDE/kdebase/workspace/; revision=549046
This commit is contained in:
Laurent Montel 2006-06-07 09:05:46 +00:00
parent e8bcbc84d3
commit f7de3f2974
6 changed files with 472 additions and 78 deletions

View file

@ -20,6 +20,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}
########### next target ###############
set(kwin_KDEINIT_SRCS
kwinadaptor.cpp
workspace.cpp
client.cpp
placement.cpp
@ -60,7 +61,6 @@ install(TARGETS kwin DESTINATION bin)
install_files( ${KCFG_INSTALL_DIR} FILES kwin.kcfg )
install_files( ${DATA_INSTALL_DIR}/kwin FILES eventsrc )
install_files( /include FILES KWinInterface.h )
kde4_install_icons( ${ICON_INSTALL_DIR} crystalsvg )

213
kwinadaptor.cpp Normal file
View file

@ -0,0 +1,213 @@
/*
* This file was generated by dbusidl2cpp version 0.5
* when processing input file org.kde.kwin.Kwin.xml
*
* dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
*
* This is an auto-generated file.
*/
#include "kwinadaptor.h"
#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
/*
* Implementation of adaptor class KWinAdaptor
*/
KWinAdaptor::KWinAdaptor(QObject *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}
KWinAdaptor::~KWinAdaptor()
{
// destructor
}
void KWinAdaptor::cascadeDesktop()
{
// handle method call org.kde.kwin.KWin.cascadeDesktop
QMetaObject::invokeMethod(parent(), "cascadeDesktop");
// Alternative:
//static_cast<YourObjectType *>(parent())->cascadeDesktop();
}
void KWinAdaptor::circulateDesktopApplications()
{
// handle method call org.kde.kwin.KWin.circulateDesktopApplications
QMetaObject::invokeMethod(parent(), "circulateDesktopApplications");
// Alternative:
//static_cast<YourObjectType *>(parent())->circulateDesktopApplications();
}
int KWinAdaptor::currentDesktop()
{
// handle method call org.kde.kwin.KWin.currentDesktop
int out0;
QMetaObject::invokeMethod(parent(), "currentDesktop", Q_RETURN_ARG(int, out0));
// Alternative:
//out0 = static_cast<YourObjectType *>(parent())->currentDesktop();
return out0;
}
void KWinAdaptor::doNotManage(const QString &name)
{
// handle method call org.kde.kwin.KWin.doNotManage
QMetaObject::invokeMethod(parent(), "doNotManage", Q_ARG(QString, name));
// Alternative:
//static_cast<YourObjectType *>(parent())->doNotManage(name);
}
void KWinAdaptor::killWindow()
{
// handle method call org.kde.kwin.KWin.killWindow
QMetaObject::invokeMethod(parent(), "killWindow");
// Alternative:
//static_cast<YourObjectType *>(parent())->killWindow();
}
bool KWinAdaptor::kompmgrIsRunning()
{
// handle method call org.kde.kwin.KWin.kompmgrIsRunning
bool out0;
QMetaObject::invokeMethod(parent(), "kompmgrIsRunning", Q_RETURN_ARG(bool, out0));
// Alternative:
//out0 = static_cast<YourObjectType *>(parent())->kompmgrIsRunning();
return out0;
}
void KWinAdaptor::nextDesktop()
{
// handle method call org.kde.kwin.KWin.nextDesktop
QMetaObject::invokeMethod(parent(), "nextDesktop");
// Alternative:
//static_cast<YourObjectType *>(parent())->nextDesktop();
}
void KWinAdaptor::previousDesktop()
{
// handle method call org.kde.kwin.KWin.previousDesktop
QMetaObject::invokeMethod(parent(), "previousDesktop");
// Alternative:
//static_cast<YourObjectType *>(parent())->previousDesktop();
}
void KWinAdaptor::reconfigure()
{
// handle method call org.kde.kwin.KWin.reconfigure
QMetaObject::invokeMethod(parent(), "reconfigure");
// Alternative:
//static_cast<YourObjectType *>(parent())->reconfigure();
}
void KWinAdaptor::refresh()
{
// handle method call org.kde.kwin.KWin.refresh
QMetaObject::invokeMethod(parent(), "refresh");
// Alternative:
//static_cast<YourObjectType *>(parent())->refresh();
}
bool KWinAdaptor::setCurrentDesktop(int desktop)
{
// handle method call org.kde.kwin.KWin.setCurrentDesktop
bool out0;
QMetaObject::invokeMethod(parent(), "setCurrentDesktop", Q_RETURN_ARG(bool, out0), Q_ARG(int, desktop));
// Alternative:
//out0 = static_cast<YourObjectType *>(parent())->setCurrentDesktop(desktop);
return out0;
}
void KWinAdaptor::setDesktopLayout(int orientation, int x, int y)
{
// handle method call org.kde.kwin.KWin.setDesktopLayout
QMetaObject::invokeMethod(parent(), "setDesktopLayout", Q_ARG(int, orientation), Q_ARG(int, x), Q_ARG(int, y));
// Alternative:
//static_cast<YourObjectType *>(parent())->setDesktopLayout(orientation, x, y);
}
void KWinAdaptor::setOpacity(int winId, int opacityPercent)
{
// handle method call org.kde.kwin.KWin.setOpacity
QMetaObject::invokeMethod(parent(), "setOpacity", Q_ARG(int, winId), Q_ARG(int, opacityPercent));
// Alternative:
//static_cast<YourObjectType *>(parent())->setOpacity(winId, opacityPercent);
}
void KWinAdaptor::setShadowSize(int winId, int shadowSizePercent)
{
// handle method call org.kde.kwin.KWin.setShadowSize
QMetaObject::invokeMethod(parent(), "setShadowSize", Q_ARG(int, winId), Q_ARG(int, shadowSizePercent));
// Alternative:
//static_cast<YourObjectType *>(parent())->setShadowSize(winId, shadowSizePercent);
}
void KWinAdaptor::setUnshadowed(int winId)
{
// handle method call org.kde.kwin.KWin.setUnshadowed
QMetaObject::invokeMethod(parent(), "setUnshadowed", Q_ARG(int, winId));
// Alternative:
//static_cast<YourObjectType *>(parent())->setUnshadowed(winId);
}
void KWinAdaptor::showWindowMenuAt(int winId, int x, int y)
{
// handle method call org.kde.kwin.KWin.showWindowMenuAt
QMetaObject::invokeMethod(parent(), "showWindowMenuAt", Q_ARG(int, winId), Q_ARG(int, x), Q_ARG(int, y));
// Alternative:
//static_cast<YourObjectType *>(parent())->showWindowMenuAt(winId, x, y);
}
void KWinAdaptor::startKompmgr()
{
// handle method call org.kde.kwin.KWin.startKompmgr
QMetaObject::invokeMethod(parent(), "startKompmgr");
// Alternative:
//static_cast<YourObjectType *>(parent())->startKompmgr();
}
void KWinAdaptor::stopKompmgr()
{
// handle method call org.kde.kwin.KWin.stopKompmgr
QMetaObject::invokeMethod(parent(), "stopKompmgr");
// Alternative:
//static_cast<YourObjectType *>(parent())->stopKompmgr();
}
void KWinAdaptor::unclutterDesktop()
{
// handle method call org.kde.kwin.KWin.unclutterDesktop
QMetaObject::invokeMethod(parent(), "unclutterDesktop");
// Alternative:
//static_cast<YourObjectType *>(parent())->unclutterDesktop();
}
#include "kwinadaptor.moc"

119
kwinadaptor.h Normal file
View file

@ -0,0 +1,119 @@
/*
* This file was generated by dbusidl2cpp version 0.5
* when processing input file org.kde.kwin.Kwin.xml
*
* dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
*
* This is an auto-generated file.
*/
#ifndef KWINADAPTOR_H_93481149670720
#define KWINADAPTOR_H_93481149670720
#include <QtCore/QObject>
#include <dbus/qdbus.h>
class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;
class QString;
class QStringList;
class QVariant;
/*
* Adaptor class for interface org.kde.kwin.KWin
*/
class KWinAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.KWin")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"org.kde.kwin.KWin\" >\n"
" <method name=\"cascadeDesktop\" >\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\" />\n"
" </method>\n"
" <method name=\"unclutterDesktop\" >\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\" />\n"
" </method>\n"
" <method name=\"reconfigure\" >\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\" />\n"
" </method>\n"
" <method name=\"killWindow\" >\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\" />\n"
" </method>\n"
" <method name=\"refresh\" />\n"
" <method name=\"doNotManage\" >\n"
" <arg direction=\"in\" type=\"s\" name=\"name\" />\n"
" </method>\n"
" <method name=\"showWindowMenuAt\" >\n"
" <arg direction=\"in\" type=\"i\" name=\"winId\" />\n"
" <arg direction=\"in\" type=\"i\" name=\"x\" />\n"
" <arg direction=\"in\" type=\"i\" name=\"y\" />\n"
" </method>\n"
" <method name=\"setDesktopLayout\" >\n"
" <arg direction=\"in\" type=\"i\" name=\"orientation\" />\n"
" <arg direction=\"in\" type=\"i\" name=\"x\" />\n"
" <arg direction=\"in\" type=\"i\" name=\"y\" />\n"
" </method>\n"
" <method name=\"setCurrentDesktop\" >\n"
" <arg direction=\"in\" type=\"i\" name=\"desktop\" />\n"
" <arg direction=\"out\" type=\"b\" />\n"
" </method>\n"
" <method name=\"currentDesktop\" >\n"
" <arg direction=\"out\" type=\"i\" />\n"
" </method>\n"
" <method name=\"nextDesktop\" />\n"
" <method name=\"previousDesktop\" />\n"
" <method name=\"circulateDesktopApplications\" />\n"
" <method name=\"startKompmgr\" />\n"
" <method name=\"stopKompmgr\" />\n"
" <method name=\"kompmgrIsRunning\" >\n"
" <arg direction=\"out\" type=\"b\" />\n"
" </method>\n"
" <method name=\"setOpacity\" >\n"
" <arg direction=\"in\" type=\"i\" name=\"winId\" />\n"
" <arg direction=\"in\" type=\"i\" name=\"opacityPercent\" />\n"
" </method>\n"
" <method name=\"setShadowSize\" >\n"
" <arg direction=\"in\" type=\"i\" name=\"winId\" />\n"
" <arg direction=\"in\" type=\"i\" name=\"shadowSizePercent\" />\n"
" </method>\n"
" <method name=\"setUnshadowed\" >\n"
" <arg direction=\"in\" type=\"i\" name=\"winId\" />\n"
" </method>\n"
" <signal name=\"kompmgrStarted\" />\n"
" <signal name=\"kompmgrStopped\" />\n"
" <signal name=\"dcopResetAllClients\" />\n"
" </interface>\n"
"")
public:
KWinAdaptor(QObject *parent);
virtual ~KWinAdaptor();
public: // PROPERTIES
public Q_SLOTS: // METHODS
Q_ASYNC void cascadeDesktop();
void circulateDesktopApplications();
int currentDesktop();
void doNotManage(const QString &name);
Q_ASYNC void killWindow();
bool kompmgrIsRunning();
void nextDesktop();
void previousDesktop();
Q_ASYNC void reconfigure();
void refresh();
bool setCurrentDesktop(int desktop);
void setDesktopLayout(int orientation, int x, int y);
void setOpacity(int winId, int opacityPercent);
void setShadowSize(int winId, int shadowSizePercent);
void setUnshadowed(int winId);
void showWindowMenuAt(int winId, int x, int y);
void startKompmgr();
void stopKompmgr();
Q_ASYNC void unclutterDesktop();
Q_SIGNALS: // SIGNALS
void dcopResetAllClients();
void kompmgrStarted();
void kompmgrStopped();
};
#endif

61
org.kde.kwin.Kwin.xml Normal file
View file

@ -0,0 +1,61 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.kwin.KWin">
<method name="cascadeDesktop">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="unclutterDesktop">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="reconfigure">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="killWindow">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="refresh"/>
<method name="doNotManage">
<arg name="name" type="s" direction="in"/>
</method>
<method name="showWindowMenuAt">
<arg name="winId" type="i" direction="in"/>
<arg name="x" type="i" direction="in"/>
<arg name="y" type="i" direction="in"/>
</method>
<method name="setDesktopLayout">
<arg name="orientation" type="i" direction="in"/>
<arg name="x" type="i" direction="in"/>
<arg name="y" type="i" direction="in"/>
</method>
<method name="setCurrentDesktop">
<arg name="desktop" type="i" direction="in"/>
<arg type="b" direction="out"/>
</method>
<method name="currentDesktop">
<arg type="i" direction="out"/>
</method>
<method name="nextDesktop"/>
<method name="previousDesktop"/>
<method name="circulateDesktopApplications"/>
<method name="startKompmgr"/>
<method name="stopKompmgr"/>
<method name="kompmgrIsRunning">
<arg type="b" direction="out"/>
</method>
<method name="setOpacity">
<arg name="winId" type="i" direction="in"/>
<arg name="opacityPercent" type="i" direction="in"/>
</method>
<method name="setShadowSize">
<arg name="winId" type="i" direction="in"/>
<arg name="shadowSizePercent" type="i" direction="in"/>
</method>
<method name="setUnshadowed">
<arg name="winId" type="i" direction="in"/>
</method>
<signal name="kompmgrStarted"/>
<signal name="kompmgrStopped"/>
<signal name="dcopResetAllClients"/>
</interface>
</node>

View file

@ -26,12 +26,12 @@ License. See the file "COPYING" for the exact licensing terms.
#include <kmenubar.h>
#include <kprocess.h>
#include <kglobalaccel.h>
#include <dcopclient.h>
#include <QDesktopWidget>
#include <QToolButton>
#include <kipc.h>
#include <kactioncollection.h>
#include <kaction.h>
#include <dbus/qdbus.h>
#include "plugins.h"
#include "client.h"
@ -71,8 +71,7 @@ bool allowKompmgrRestart = true;
// lines are not too much. It's the task that is complex, not the
// code.
Workspace::Workspace( bool restore )
: DCOPObject ("KWinInterface"),
QObject (0),
: QObject (0),
current_desktop (0),
number_of_desktops(0),
active_popup( NULL ),
@ -128,7 +127,10 @@ Workspace::Workspace( bool restore )
block_stacking_updates( 0 ),
forced_global_mouse_grab( false )
{
new KWinAdaptor(this);
QDBus::sessionBus().registerObject("/KWinInterface", this);
setObjectName( "workspace" );
_self = this;
mgr = new PluginMgr;
root = QX11Info::appRootWindow();

View file

@ -19,7 +19,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include <netwm.h>
#include <kxmessages.h>
#include "KWinInterface.h"
#include "utils.h"
#include "kdecoration.h"
#include "sm.h"
@ -70,7 +69,7 @@ class SystemTrayWindow
typedef QList<SystemTrayWindow> SystemTrayWindowList;
class Workspace : public QObject, public KWinInterface, public KDecorationDefines
class Workspace : public QObject, public KDecorationDefines
{
Q_OBJECT
public: