Use signal to refresh config into all kwin instance

svn path=/trunk/KDE/kdebase/workspace/; revision=619161
This commit is contained in:
Laurent Montel 2007-01-02 21:48:19 +00:00
parent 2bc3c12849
commit 9350d02134
13 changed files with 113 additions and 146 deletions

View file

@ -1,13 +1,9 @@
set(kwin_xml ${CMAKE_SOURCE_DIR}/workspace/kwin/org.kde.KWin.xml)
set(interface_file)
QT4_ADD_DBUS_INTERFACE( interface_file ${kwin_xml} kwin_interface )
########### next target ###############
set(kwin_update_window_settings_SRCS update_window_settings.cpp ${interface_file})
set(kwin_update_window_settings_SRCS update_window_settings.cpp )
kde4_automoc(${kwin_update_window_settings_SRCS})
@ -21,7 +17,7 @@ install(TARGETS kwin_update_window_settings DESTINATION ${LIB_INSTALL_DIR}/kconf
########### next target ###############
set(kwin_update_default_rules_SRCS update_default_rules.cpp ${interface_file})
set(kwin_update_default_rules_SRCS update_default_rules.cpp)
kde4_automoc(${kwin_update_default_rules})

View file

@ -15,7 +15,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include <kinstance.h>
#include <kstandarddirs.h>
#include <QtDBus/QtDBus>
#include <kwin_interface.h>
int main( int argc, char* argv[] )
{
@ -51,10 +50,9 @@ int main( int argc, char* argv[] )
dest_cfg.writeEntry( "count", pos );
src_cfg.sync();
dest_cfg.sync();
#ifdef __GNUC__
#warning D-BUS TODO
// kwin* , and an attach to dbus is missing as well
#endif
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}

View file

@ -17,7 +17,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QByteArray>
#include <QList>
#include <QtDBus/QtDBus>
#include <kwin_interface.h>
struct SessionInfo
{
QByteArray sessionId;
@ -168,10 +167,8 @@ int main()
writeRules( dest_cfg );
src_cfg.sync();
dest_cfg.sync();
#ifdef __GNUC__
#warning D-BUS TODO
// kwin* , and an attach to dbus is missing as well
#endif
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}

View file

@ -5,10 +5,6 @@ include_directories( ${CMAKE_SOURCE_DIR}/workspace/kwin/lib )
set(kcm_kwindecoration_PART_SRCS kwindecoration.cpp buttons.cpp preview.cpp )
set(kwin_xml ${CMAKE_SOURCE_DIR}/workspace/kwin/org.kde.KWin.xml)
QT4_ADD_DBUS_INTERFACE( kcm_kwindecoration_PART_SRCS ${kwin_xml} kwin_interface )
kde4_automoc(${kcm_kwindecoration_PART_SRCS})

View file

@ -62,7 +62,6 @@
#include <kdecoration_plugins_p.h>
#include <kdecorationfactory.h>
#include <kvbox.h>
#include <kwin_interface.h>
// KCModule plugin interface
// =========================
@ -531,8 +530,11 @@ void KWinDecorationModule::save()
emit pluginSave( &kwinConfig );
kwinConfig.sync();
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}

View file

@ -5,9 +5,6 @@
set(kcm_kwinoptions_PART_SRCS windows.cpp mouse.cpp main.cpp )
set(kwin_xml ${CMAKE_SOURCE_DIR}/workspace/kwin/org.kde.KWin.xml)
QT4_ADD_DBUS_INTERFACE( kcm_kwinoptions_PART_SRCS ${kwin_xml} kwin_interface )
kde4_automoc(${kcm_kwinoptions_PART_SRCS})

View file

@ -33,7 +33,6 @@
#include "mouse.h"
#include "windows.h"
#include "kwin_interface.h"
#include "main.h"
static KInstance *_kcmkwm = 0;
@ -180,12 +179,12 @@ void KWinOptions::save()
emit KCModule::changed( false );
// Send signal to kwin
mConfig->sync();
#ifdef __GNUC__
#warning D-BUS TODO
// All these calls in kcmkwin modules should be actually kwin*, because of multihead.
#endif
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
@ -260,8 +259,11 @@ void KActionsOptions::save()
emit KCModule::changed( false );
// Send signal to kwin
mConfig->sync();
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}

View file

@ -47,7 +47,6 @@
#include "mouse.h"
#include "mouse.moc"
#include "kwin_interface.h"
namespace {
@ -571,8 +570,11 @@ void KTitleBarActionsConfig::save()
if (standAlone)
{
config->sync();
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
}
@ -847,8 +849,10 @@ void KWindowActionsConfig::save()
if (standAlone)
{
config->sync();
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
}

View file

@ -56,7 +56,6 @@
#include <X11/Xutil.h>
#include "windows.h"
#include "kwin_interface.h"
// kwin config keywords
#define KWIN_FOCUS "FocusPolicy"
@ -497,8 +496,10 @@ void KFocusConfig::save( void )
if (standAlone)
{
config->sync();
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}
@ -724,8 +725,11 @@ void KAdvancedConfig::save( void )
if (standAlone)
{
config->sync();
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}
@ -1188,8 +1192,10 @@ void KMovingConfig::save( void )
if (standAlone)
{
config->sync();
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}
@ -1593,8 +1599,11 @@ void KTranslucencyConfig::save( void )
if (standAlone)
{
config->sync();
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}

View file

@ -5,10 +5,6 @@ ADD_DEFINITIONS(-DKCMRULES)
set(kwinrules_SRCS ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp)
set(kwin_xml ${CMAKE_SOURCE_DIR}/workspace/kwin/org.kde.KWin.xml)
QT4_ADD_DBUS_INTERFACE( kwinrules_SRCS ${kwin_xml} kwin_interface )
kde4_add_ui_files(kwinrules_SRCS ruleslistbase.ui detectwidgetbase.ui)
kde4_add_ui3_files(kwinrules_SRCS ruleswidgetbase.ui editshortcutbase.ui )

View file

@ -29,7 +29,6 @@
#include <QtDBus/QtDBus>
#include "ruleslist.h"
#include "kwin_interface.h"
typedef KGenericFactory<KWinInternal::KCMRules> KCMRulesFactory;
K_EXPORT_COMPONENT_FACTORY(kwinrules, KCMRulesFactory("kcmkwinrules"))
@ -65,8 +64,11 @@ void KCMRules::save()
emit KCModule::changed( false );
// Send signal to kwin
config.sync();
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
void KCMRules::defaults()

View file

@ -22,7 +22,6 @@
#include <klocale.h>
#include <kwin.h>
#include <QtDBus/QtDBus>
#include <kwin_interface.h>
#include <X11/Xlib.h>
#include <fixx11h.h>
@ -257,8 +256,10 @@ static int edit( Window wid, bool whole_app )
delete orig_rule;
}
saveRules( rules );
org::kde::KWin kwin("org.kde.kwin", "/KWin", QDBusConnection::sessionBus());
kwin.reconfigure();
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
return 0;
}

View file

@ -42,9 +42,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "group.h"
#include "rules.h"
#include "kwinadaptor.h"
#include "unmanaged.h"
#include "scene.h"
#include "effects.h"
#include <X11/extensions/shape.h>
#include <X11/keysym.h>
@ -96,7 +93,6 @@ Workspace::Workspace( bool restore )
popupinfo (0),
popup (0),
advanced_popup (0),
trans_popup (0),
desk_popup (0),
desk_popup_index (0),
keys (0),
@ -126,17 +122,12 @@ Workspace::Workspace( bool restore )
topmenu_space( NULL ),
set_active_client_recursion( 0 ),
block_stacking_updates( 0 ),
forced_global_mouse_grab( false ),
cm_selection( NULL ),
compositeRate( 0 ),
damage_region( None ),
overlay( None ),
transSlider( NULL ),
transButton( NULL )
forced_global_mouse_grab( false )
{
(void) new KWinAdaptor( this );
QDBusConnection::sessionBus().registerObject("/KWin", this);
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject("/KWin", this);
dbus.connect(QString(), "/KWin", "org.kde.KWin", "reloadConfig", this, SLOT(slotReloadConfig()));
_self = this;
mgr = new PluginMgr;
root = rootWindow();
@ -177,12 +168,10 @@ Workspace::Workspace( bool restore )
ColormapChangeMask |
SubstructureRedirectMask |
SubstructureNotifyMask |
FocusChangeMask | // for NotifyDetailNone
ExposureMask
FocusChangeMask // for NotifyDetailNone
);
Extensions::init();
setupCompositing();
Shape::init();
// compatibility
long data = 1;
@ -331,7 +320,6 @@ void Workspace::init()
connect(&reconfigureTimer, SIGNAL(timeout()), this,
SLOT(slotReconfigure()));
connect( &updateToolWindowsTimer, SIGNAL( timeout()), this, SLOT( slotUpdateToolWindows()));
connect( &compositeTimer, SIGNAL( timeout()), SLOT( performCompositing()));
connect(KGlobalSettings::self(), SIGNAL(appearanceChanged()), this,
SLOT(slotReconfigure()));
@ -369,11 +357,7 @@ void Workspace::init()
XWindowAttributes attr;
XGetWindowAttributes(display(), wins[i], &attr);
if (attr.override_redirect )
{
if( attr.map_state != IsUnmapped && attr.c_class != InputOnly && compositing())
createUnmanaged( wins[ i ] );
continue;
}
if( topmenu_space && topmenu_space->winId() == wins[ i ] )
continue;
if (attr.map_state != IsUnmapped)
@ -436,7 +420,6 @@ void Workspace::init()
Workspace::~Workspace()
{
finishCompositing();
blockStackingUpdates( true );
// TODO grabXServer();
// use stacking_order, so that kwin --replace keeps stacking order
@ -446,12 +429,12 @@ Workspace::~Workspace()
{
// only release the window
(*it)->releaseWindow( true );
// no removeClient() is called !
// No removeClient() is called, it does more than just removing.
// However, remove from some lists to e.g. prevent performTransiencyCheck()
// from crashing.
clients.remove( *it );
desktops.remove( *it );
}
for( UnmanagedList::ConstIterator it = unmanaged.begin();
it != unmanaged.end();
++it )
(*it)->release();
delete desktop_widget;
delete tab_box;
delete popupinfo;
@ -495,28 +478,6 @@ Client* Workspace::createClient( Window w, bool is_mapped )
return NULL;
}
addClient( c, Allowed );
if( scene )
scene->windowAdded( c );
if( effects )
effects->windowAdded( c );
return c;
}
Unmanaged* Workspace::createUnmanaged( Window w )
{
if( w == overlay )
return NULL;
Unmanaged* c = new Unmanaged( this );
if( !c->track( w ))
{
Unmanaged::deleteUnmanaged( c, Allowed );
return NULL;
}
addUnmanaged( c, Allowed );
if( scene )
scene->windowAdded( c );
if( effects )
effects->windowAdded( c );
return c;
}
@ -557,11 +518,7 @@ void Workspace::addClient( Client* c, allowed_t )
updateStackingOrder( true ); // propagate new client
if( c->isUtility() || c->isMenu() || c->isToolbar())
updateToolWindows( true );
}
void Workspace::addUnmanaged( Unmanaged* c, allowed_t )
{
unmanaged.append( c );
checkNonExistentClients();
}
/*
@ -583,10 +540,6 @@ void Workspace::removeClient( Client* c, allowed_t )
Notify::raise( Notify::Delete );
Q_ASSERT( clients.contains( c ) || desktops.contains( c ));
if( scene )
scene->windowDeleted( c );
if( effects )
effects->windowDeleted( c );
clients.removeAll( c );
desktops.removeAll( c );
unconstrained_stacking_order.removeAll( c );
@ -622,16 +575,6 @@ void Workspace::removeClient( Client* c, allowed_t )
updateClientArea();
}
void Workspace::removeUnmanaged( Unmanaged* c, allowed_t )
{
assert( unmanaged.contains( c ));
if( scene )
scene->windowDeleted( c );
if( effects )
effects->windowDeleted( c );
unmanaged.removeAll( c );
}
void Workspace::updateFocusChains( Client* c, FocusChainChange change )
{
if( !c->wantsTabFocus()) // doesn't want tab focus, remove
@ -657,7 +600,13 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change )
focus_chain[ i ].prepend( c );
}
else if( !focus_chain[ i ].contains( c ))
focus_chain[ i ].prepend( c ); // otherwise add as the last one
{ // add it after the active one
if( active_client != NULL && active_client != c
&& !focus_chain[ i ].isEmpty() && focus_chain[ i ].last() == active_client )
focus_chain[ i ].insert( focus_chain[ i ].size() - 1, c );
else
focus_chain[ i ].append( c ); // otherwise add as the first one
}
}
}
else //now only on desktop, remove it anywhere else
@ -677,7 +626,13 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change )
focus_chain[ i ].prepend( c );
}
else if( !focus_chain[ i ].contains( c ))
focus_chain[ i ].prepend( c );
{ // add it after the active one
if( active_client != NULL && active_client != c
&& !focus_chain[ i ].isEmpty() && focus_chain[ i ].last() == active_client )
focus_chain[ i ].insert( focus_chain[ i ].size() - 1, c );
else
focus_chain[ i ].append( c ); // otherwise add as the first one
}
}
else
focus_chain[ i ].removeAll( c );
@ -694,7 +649,13 @@ void Workspace::updateFocusChains( Client* c, FocusChainChange change )
global_focus_chain.prepend( c );
}
else if( !global_focus_chain.contains( c ))
global_focus_chain.prepend( c );
{ // add it after the active one
if( active_client != NULL && active_client != c
&& !global_focus_chain.isEmpty() && global_focus_chain.last() == active_client )
global_focus_chain.insert( global_focus_chain.size() - 1, c );
else
global_focus_chain.append( c ); // otherwise add as the first one
}
}
void Workspace::updateCurrentTopMenu()
@ -912,6 +873,11 @@ void Workspace::updateColormap()
}
}
void Workspace::slotReloadConfig()
{
reconfigure();
}
void Workspace::reconfigure()
{
reconfigureTimer.start( 200 );
@ -928,7 +894,7 @@ void Workspace::slotSettingsChanged(int category)
/*!
Reread settings
*/
KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() );
KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() );
void Workspace::slotReconfigure()
{
@ -985,11 +951,6 @@ void Workspace::slotReconfigure()
updateTopMenuGeometry();
updateCurrentTopMenu();
}
if( options->useTranslucency )
setupCompositing();
else
finishCompositing();
loadWindowRules();
for( ClientList::Iterator it = clients.begin();
@ -1279,11 +1240,18 @@ bool Workspace::setCurrentDesktop( int new_desktop )
if ( c )
requestFocus( c );
else if( !desktops.isEmpty() )
requestFocus( findDesktop( true, currentDesktop()));
else
focusToNull();
if( !desktops.isEmpty() )
{
Window w_tmp;
int i_tmp;
XGetInputFocus( display(), &w_tmp, &i_tmp );
if( w_tmp == null_focus_window ) // CHECKME?
requestFocus( findDesktop( true, currentDesktop()));
}
updateCurrentTopMenu();
// Update focus chain:
@ -1684,7 +1652,7 @@ void Workspace::slotGrabWindow()
QPixmap snapshot = QPixmap::grabWindow( active_client->frameId() );
//No XShape - no work.
if( Extensions::shapeAvailable())
if( Shape::available())
{
//As the first step, get the mask from XShape.
int count, order;
@ -2037,8 +2005,7 @@ void Workspace::createBorderWindows()
XSetWindowAttributes attributes;
unsigned long valuemask;
attributes.override_redirect = True;
attributes.event_mask = (EnterWindowMask | LeaveWindowMask |
VisibilityChangeMask);
attributes.event_mask = ( EnterWindowMask | LeaveWindowMask );
valuemask= (CWOverrideRedirect | CWEventMask | CWCursor );
attributes.cursor = XCreateFontCursor(display(),
XC_sb_up_arrow);