DBUS changes - make it compile. The DBUS HOWTO is pretty lacking

in some areas and I wonder how many things will be broken by
people not quite knowing what they're doing :-/.


svn path=/trunk/KDE/kdebase/workspace/; revision=549400
This commit is contained in:
Luboš Luňák 2006-06-08 13:43:23 +00:00
parent 53b85f444f
commit 04c9d42dfd
14 changed files with 70 additions and 90 deletions

View file

@ -50,7 +50,7 @@ kde4_automoc(${kwin_KDEINIT_SRCS})
kde4_add_kdeinit_executable( kwin ${kwin_KDEINIT_SRCS})
target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} kdecorations DCOP ${X11_LIBRARIES} ${QT_QT3SUPPORT_LIBRARY} )
target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} kdecorations ${X11_LIBRARIES} ${QT_QT3SUPPORT_LIBRARY} )
install_targets(${LIB_INSTALL_DIR} kdeinit_kwin )

View file

@ -10,11 +10,11 @@ License. See the file "COPYING" for the exact licensing terms.
// read addtional window rules and add them to kwinrulesrc
#include <dcopclient.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kinstance.h>
#include <kstandarddirs.h>
#include <dbus/qdbus.h>
int main( int argc, char* argv[] )
{
@ -50,7 +50,10 @@ int main( int argc, char* argv[] )
dest_cfg.writeEntry( "count", pos );
src_cfg.sync();
dest_cfg.sync();
DCOPClient client;
client.attach();
client.send("kwin*", "", "reconfigure()", QByteArray());
#ifdef __GNUC__
#warning D-BUS TODO
// kwin* , and an attach to dbus is missing as well
#endif
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}

View file

@ -13,11 +13,11 @@ License. See the file "COPYING" for the exact licensing terms.
#include <netwm_def.h>
#include <kconfig.h>
#include <kinstance.h>
#include <dcopclient.h>
#include <QRect>
//Added by qt3to4:
#include <QByteArray>
#include <Q3PtrList>
#include <dbus/qdbus.h>
struct SessionInfo
{
@ -166,7 +166,10 @@ int main()
writeRules( dest_cfg );
src_cfg.sync();
dest_cfg.sync();
DCOPClient client;
client.attach();
client.send("kwin*", "", "reconfigure()", QByteArray());
#ifdef __GNUC__
#warning D-BUS TODO
// kwin* , and an attach to dbus is missing as well
#endif
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}

View file

@ -12,7 +12,7 @@ kde4_add_plugin(kcm_kwindecoration ${kcm_kwindecoration_PART_SRCS})
kde4_install_libtool_file( ${PLUGIN_INSTALL_DIR} kcm_kwindecoration )
target_link_libraries(kcm_kwindecoration ${KDE4_KDEUI_LIBS} kdecorations DCOP ${QT_QT3SUPPORT_LIBRARY} ${X11_LIBRARIES})
target_link_libraries(kcm_kwindecoration ${KDE4_KDEUI_LIBS} kdecorations ${QT_QT3SUPPORT_LIBRARY} ${X11_LIBRARIES})
install_targets(${PLUGIN_INSTALL_DIR} kcm_kwindecoration )

View file

@ -44,6 +44,8 @@
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <dbus/qdbus.h>
#include <kapplication.h>
#include <kcombobox.h>
#include <kdebug.h>
@ -192,9 +194,6 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QStringList &)
connect( cBorder, SIGNAL( activated( int )), SLOT( slotBorderChanged( int )));
// connect( cbUseMiniWindows, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
// Allow kwin dcop signal to update our selection list
connectDCOPSignal("kwin", 0, "dcopResetAllClients()", "dcopUpdateClientList()", false);
KAboutData *about =
new KAboutData(I18N_NOOP("kcmkwindecoration"),
I18N_NOOP("Window Decoration Control Module"),
@ -514,18 +513,6 @@ void KWinDecorationModule::writeConfig( KConfig* conf )
}
void KWinDecorationModule::dcopUpdateClientList()
{
// Changes the current active ListBox item, and
// Loads a new plugin configuration tab if required.
KConfig kwinConfig("kwinrc");
kwinConfig.setGroup("Style");
readConfig( &kwinConfig );
resetPlugin( &kwinConfig );
}
// Virutal functions required by KCModule
void KWinDecorationModule::load()
{
@ -547,8 +534,8 @@ void KWinDecorationModule::save()
emit pluginSave( &kwinConfig );
kwinConfig.sync();
resetKWin();
// resetPlugin() will get called via the above DCOP function
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}
@ -615,18 +602,6 @@ QString KWinDecorationModule::quickHelp() const
" In the \"Buttons\" tab you can change the positions of the buttons to your liking.</p>" );
}
void KWinDecorationModule::resetKWin()
{
#warning "kde4: port it to dbus call kwin*"
#if 0
bool ok = kapp->dcopClient()->send("kwin*", "KWinInterface",
"reconfigure()", QByteArray());
if (!ok)
kDebug() << "kcmkwindecoration: Could not reconfigure kwin" << endl;
#endif
}
#include "kwindecoration.moc"
// vim: ts=4
// kate: space-indent off; tab-width 4;

View file

@ -31,7 +31,6 @@
#define KWINDECORATION_H
#include <kcmodule.h>
#include <dcopobject.h>
#include "buttons.h"
#include <kconfig.h>
#include <klibloader.h>
@ -74,8 +73,6 @@ class KWinDecorationModule : public KCModule, public KDecorationDefines
QString quickHelp() const;
virtual void dcopUpdateClientList();
signals:
void pluginLoad( KConfig* conf );
void pluginSave( KConfig* conf );
@ -98,7 +95,6 @@ class KWinDecorationModule : public KCModule, public KDecorationDefines
QString decorationName ( QString& libName );
static QString styleToConfigLib( QString& styleLib );
void resetPlugin( KConfig* conf, const QString& currentDecoName = QString() );
void resetKWin();
void checkSupportedBorderSizes();
static int borderSizeToIndex( BorderSize size, QList< BorderSize > sizes );
static BorderSize indexToBorderSize( int index, QList< BorderSize > sizes );

View file

@ -11,7 +11,7 @@ kde4_add_plugin(kcm_kwinoptions ${kcm_kwinoptions_PART_SRCS})
kde4_install_libtool_file( ${PLUGIN_INSTALL_DIR} kcm_kwinoptions )
target_link_libraries(kcm_kwinoptions ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} DCOP ${QT_QT3SUPPORT_LIBRARY})
target_link_libraries(kcm_kwinoptions ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QT3SUPPORT_LIBRARY})
install_targets(${PLUGIN_INSTALL_DIR} kcm_kwinoptions )

View file

@ -21,7 +21,7 @@
//Added by qt3to4:
#include <QVBoxLayout>
#include <dcopclient.h>
#include <dbus/qdbus.h>
#include <kapplication.h>
#include <kglobal.h>
@ -175,9 +175,12 @@ void KWinOptions::save()
emit KCModule::changed( false );
// Send signal to kwin
mConfig->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
#ifdef __GNUC__
#warning D-BUS TODO
// All these calls in kcmkwin modules should be actually kwin*, because of multihead.
#endif
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}
@ -250,9 +253,8 @@ void KActionsOptions::save()
emit KCModule::changed( false );
// Send signal to kwin
mConfig->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}

View file

@ -31,13 +31,13 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <dcopclient.h>
#include <klocale.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdialog.h>
#include <kglobalsettings.h>
#include <kseparator.h>
#include <dbus/qdbus.h>
#include <X11/X.h>
#include <X11/Xlib.h>
@ -571,9 +571,8 @@ void KTitleBarActionsConfig::save()
if (standAlone)
{
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}
}
@ -848,9 +847,8 @@ void KWindowActionsConfig::save()
if (standAlone)
{
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}
}

View file

@ -46,10 +46,10 @@
#include <knuminput.h>
#include <kapplication.h>
#include <kdialog.h>
#include <dcopclient.h>
#include <kglobal.h>
#include <kprocess.h>
#include <QTabWidget>
#include <dbus/qdbus.h>
#include <X11/X.h>
#include <X11/Xlib.h>
@ -497,9 +497,8 @@ void KFocusConfig::save( void )
if (standAlone)
{
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}
emit KCModule::changed(false);
}
@ -725,9 +724,8 @@ void KAdvancedConfig::save( void )
if (standAlone)
{
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}
emit KCModule::changed(false);
}
@ -1190,9 +1188,8 @@ void KMovingConfig::save( void )
if (standAlone)
{
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}
emit KCModule::changed(false);
}
@ -1594,9 +1591,8 @@ void KTranslucencyConfig::save( void )
if (standAlone)
{
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}
emit KCModule::changed(false);
}

View file

@ -24,8 +24,8 @@
#include <QVBoxLayout>
#include <klocale.h>
#include <kapplication.h>
#include <dcopclient.h>
#include <kaboutdata.h>
#include <dbus/qdbus.h>
#include "ruleslist.h"
@ -67,9 +67,8 @@ void KCMRules::save()
emit KCModule::changed( false );
// Send signal to kwin
config.sync();
if( !kapp->dcopClient()->isAttached())
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
}
void KCMRules::defaults()

View file

@ -18,10 +18,10 @@
#include <kcmdlineargs.h>
#include <kapplication.h>
#include <dcopclient.h>
#include <kconfig.h>
#include <klocale.h>
#include <kwin.h>
#include <dbus/qdbus.h>
#include <X11/Xlib.h>
#include <fixx11h.h>
@ -257,9 +257,8 @@ static int edit( Window wid, bool whole_app )
delete orig_rule;
}
saveRules( rules );
if( !kapp->dcopClient()->isAttached())
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
QDBusInterfacePtr kwin( "org.kde.kwin", "/kwin", "org.kde.KWin" );
kwin->call( "reconfigure" );
return 0;
}

View file

@ -18,12 +18,13 @@ License. See the file "COPYING" for the exact licensing terms.
#include <stdlib.h>
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <dcopclient.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <QX11Info>
#include <stdio.h>
#include <fixx11h.h>
#include <dbus/qdbus.h>
#include "atoms.h"
#include "options.h"
@ -122,8 +123,9 @@ Application::Application( )
syncX(); // trigger possible errors, there's still a chance to abort
initting = false; // startup done, we are up and running now.
dcopClient()->send( "ksplash", "", "upAndRunning(QString)", QString("wm started"));
QDBusInterfacePtr ksplash( "org.kde.ksplash", "/ksplash", "org.kde.KSplash" );
ksplash->call( "upAndRunning", QString( "wm started" ));
XEvent e;
e.xclient.type = ClientMessage;
e.xclient.message_type = XInternAtom( QX11Info::display(), "_KDE_SPLASH_PROGRESS", False );
@ -262,8 +264,10 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
signal(SIGINT, SIG_IGN);
if (signal(SIGHUP, KWinInternal::sighandler) == SIG_IGN)
signal(SIGHUP, SIG_IGN);
KApplication::disableAutoDcopRegistration();
#ifdef __GNUC__
#warning D-BUS TODO
// KApplication::disableAutoDcopRegistration();
#endif
KWinInternal::Application a;
KWinInternal::SessionManaged weAreIndeed;
KWinInternal::SessionSaveDoneHelper helper;
@ -276,9 +280,7 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
else
appname.sprintf("kwin-screen-%d", KWinInternal::screen_number);
DCOPClient* client = a.dcopClient();
client->registerAs( DCOPCString( appname.toAscii() ) , false);
client->setDefaultObject( "KWinInterface" );
QDBus::sessionBus().busService()->requestName( appname, 0 );
return a.exec();
}

View file

@ -42,6 +42,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "notifications.h"
#include "group.h"
#include "rules.h"
#include "kwinadaptor.h"
#include <X11/extensions/shape.h>
#include <X11/keysym.h>
@ -128,7 +129,7 @@ Workspace::Workspace( bool restore )
forced_global_mouse_grab( false )
{
new KWinAdaptor(this);
QDBus::sessionBus().registerObject("/KWinInterface", this);
QDBus::sessionBus().registerObject("/KWin", this);
setObjectName( "workspace" );
_self = this;
@ -2438,7 +2439,10 @@ void Workspace::startKompmgr()
QByteArray ba;
QDataStream arg(&ba, QIODevice::WriteOnly);
arg << "";
kapp->dcopClient()->emitDCOPSignal("default", "kompmgrStarted()", ba);
#ifdef __GNUC__
#warning D-BUS TODO
// kapp->dcopClient()->emitDCOPSignal("default", "kompmgrStarted()", ba);
#endif
}
if (popup){ delete popup; popup = 0L; } // to add/remove opacity slider
}
@ -2454,7 +2458,10 @@ void Workspace::stopKompmgr()
QByteArray ba;
QDataStream arg(&ba, QIODevice::WriteOnly);
arg << "";
kapp->dcopClient()->emitDCOPSignal("default", "kompmgrStopped()", ba);
#ifdef __GNUC__
#warning D-BUS TODO
// kapp->dcopClient()->emitDCOPSignal("default", "kompmgrStopped()", ba);
#endif
}
bool Workspace::kompmgrIsRunning()