merge the kinstance-redesign branch back to trunk.

svn path=/trunk/KDE/kdebase/workspace/; revision=628276
This commit is contained in:
Matthias Kretz 2007-01-29 17:14:20 +00:00
parent 409ceae7ff
commit 3003c4ecf8
22 changed files with 124 additions and 180 deletions

View file

@ -195,7 +195,7 @@ bool KDEDefaultHandler::reset( unsigned long changed )
unsigned long KDEDefaultHandler::readConfig( bool update )
{
unsigned long changed = 0;
KConfig* conf = KGlobal::config();
KSharedConfig::Ptr conf = KGlobal::config();
conf->setGroup("KDEDefault");
bool new_showGrabBar = conf->readEntry("ShowGrabBar", QVariant(true)).toBool();

View file

@ -69,7 +69,7 @@ int main(int argc, char **argv)
QFileInfo fi(f);
KSimpleConfig input(fi.absoluteFilePath());
srcStr = fi.dirPath(true) + '/';
KConfig *output = KGlobal::config();
KSharedConfig::Ptr output = KGlobal::config();
input.setGroup("Window Border");
output->setGroup("General");

View file

@ -83,7 +83,7 @@ static void create_pixmaps()
return;
pixmaps_created = true;
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
config->setGroup("General");
QString tmpStr;
@ -270,7 +270,7 @@ void KWMThemeClient::init()
QBoxLayout* hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
layout->addLayout( hb, 1, 1 );
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
config->setGroup("Buttons");
QString val;
MyButton *btn;

View file

@ -12,7 +12,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <kconfig.h>
#include <kdebug.h>
#include <kinstance.h>
#include <kcomponentdata.h>
#include <kstandarddirs.h>
#include <QtDBus/QtDBus>
@ -20,7 +20,7 @@ int main( int argc, char* argv[] )
{
if( argc != 2 )
return 1;
KInstance inst( "kwin_update_default_rules" );
KComponentData inst( "kwin_update_default_rules" );
QString file = KStandardDirs::locate( "data", QString( "kwin/default_rules/" ) + argv[ 1 ] );
if( file.isEmpty())
{

View file

@ -12,7 +12,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <netwm_def.h>
#include <kconfig.h>
#include <kinstance.h>
#include <kcomponentdata.h>
#include <QRect>
#include <QByteArray>
#include <QList>
@ -160,7 +160,7 @@ void writeRules( KConfig& cfg )
int main()
{
KInstance inst( "kwin_update_window_settings" );
KComponentData inst( "kwin_update_window_settings" );
KConfig src_cfg( "kwinrc" );
KConfig dest_cfg( "kwinrulesrc" );
loadFakeSessionInfo( &src_cfg );

View file

@ -69,12 +69,12 @@ typedef KGenericFactory<KWinDecorationModule, QWidget> KWinDecoFactory;
K_EXPORT_COMPONENT_FACTORY( kcm_kwindecoration, KWinDecoFactory("kcmkwindecoration") )
KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QStringList &)
: KCModule(KWinDecoFactory::instance(), parent),
kwinConfig("kwinrc"),
pluginObject(0)
: KCModule(KWinDecoFactory::componentData(), parent),
kwinConfig(KSharedConfig::openConfig("kwinrc")),
pluginObject(0)
{
kwinConfig.setGroup("Style");
plugins = new KDecorationPreviewPlugins( &kwinConfig );
kwinConfig->setGroup("Style");
plugins = new KDecorationPreviewPlugins(kwinConfig);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
@ -172,8 +172,8 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const QStringList &)
// Set up the decoration lists and other UI settings
findDecorations();
createDecorationList();
readConfig( &kwinConfig );
resetPlugin( &kwinConfig );
readConfig( kwinConfig.data() );
resetPlugin( kwinConfig.data() );
tabWidget->addTab( pluginPage, i18n("&Window Decoration") );
tabWidget->addTab( buttonPage, i18n("&Buttons") );

View file

@ -107,7 +107,7 @@ class KWinDecorationModule : public KCModule, public KDecorationDefines
KDecorationPreview* preview;
KDecorationPlugins* plugins;
KConfig kwinConfig;
KSharedConfigPtr kwinConfig;
QCheckBox* cbUseCustomButtonPositions;
// QCheckBox* cbUseMiniWindows;

View file

@ -142,11 +142,11 @@ class KDecorationPreviewPlugins
: public KDecorationPlugins
{
public:
KDecorationPreviewPlugins( KConfig* cfg );
KDecorationPreviewPlugins(const KSharedConfigPtr &cfg);
virtual bool provides( Requirement );
};
inline KDecorationPreviewPlugins::KDecorationPreviewPlugins( KConfig* cfg )
inline KDecorationPreviewPlugins::KDecorationPreviewPlugins(const KSharedConfigPtr &cfg)
: KDecorationPlugins( cfg )
{
}

View file

@ -35,13 +35,13 @@
#include "windows.h"
#include "main.h"
static KInstance *_kcmkwm = 0;
static KComponentData *_kcmkwm = 0;
inline KInstance *inst() {
if (_kcmkwm)
return _kcmkwm;
_kcmkwm = new KInstance("kcmkwm");
return _kcmkwm;
inline KComponentData inst() {
if (!_kcmkwm) {
_kcmkwm = new KComponentData("kcmkwm");
}
return *_kcmkwm;
}
class KFocusConfigStandalone : public KFocusConfig
@ -96,37 +96,37 @@ KWinOptions::KWinOptions(QWidget *parent, const QStringList &)
tab = new QTabWidget(this);
layout->addWidget(tab);
mFocus = new KFocusConfig(false, mConfig, instance(), this);
mFocus = new KFocusConfig(false, mConfig, componentData(), this);
mFocus->setObjectName("KWin Focus Config");
mFocus->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mFocus, i18n("&Focus"));
connect(mFocus, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, instance(), this);
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, componentData(), this);
mTitleBarActions->setObjectName("KWin TitleBar Actions");
mTitleBarActions->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mWindowActions = new KWindowActionsConfig(false, mConfig, instance(), this);
mWindowActions = new KWindowActionsConfig(false, mConfig, componentData(), this);
mWindowActions->setObjectName("KWin Window Actions");
mWindowActions->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mWindowActions, i18n("Window Actio&ns"));
connect(mWindowActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mMoving = new KMovingConfig(false, mConfig, instance(), this);
mMoving = new KMovingConfig(false, mConfig, componentData(), this);
mMoving->setObjectName("KWin Moving");
mMoving->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mMoving, i18n("&Moving"));
connect(mMoving, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mAdvanced = new KAdvancedConfig(false, mConfig, instance(), this);
mAdvanced = new KAdvancedConfig(false, mConfig, componentData(), this);
mAdvanced->setObjectName("KWin Advanced");
mAdvanced->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mAdvanced, i18n("Ad&vanced"));
connect(mAdvanced, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mTranslucency = new KTranslucencyConfig(false, mConfig, instance(), this);
mTranslucency = new KTranslucencyConfig(false, mConfig, componentData(), this);
mTranslucency->setObjectName("KWin Translucency");
mTranslucency->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mTranslucency, i18n("&Translucency"));
@ -225,13 +225,13 @@ KActionsOptions::KActionsOptions(QWidget *parent, const QStringList &)
tab = new QTabWidget(this);
layout->addWidget(tab);
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, instance(), this);
mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, componentData(), this);
mTitleBarActions->setObjectName("KWin TitleBar Actions");
mTitleBarActions->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mTitleBarActions, i18n("&Titlebar Actions"));
connect(mTitleBarActions, SIGNAL(changed(bool)), this, SLOT(moduleChanged(bool)));
mWindowActions = new KWindowActionsConfig(false, mConfig, instance(), this);
mWindowActions = new KWindowActionsConfig(false, mConfig, componentData(), this);
mWindowActions->setObjectName("KWin Window Actions");
mWindowActions->layout()->setMargin( KDialog::marginHint() );
tab->addTab(mWindowActions, i18n("Window Actio&ns"));

View file

@ -134,7 +134,7 @@ void KTitleBarActionsConfig::paletteChanged()
}
KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_config, KInstance *inst, QWidget * parent)
KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget * parent)
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
{
QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3;
@ -593,7 +593,7 @@ void KTitleBarActionsConfig::defaults()
}
KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config, KInstance *inst, QWidget * parent)
KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget * parent)
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
{
QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3, strAllW;

View file

@ -54,7 +54,7 @@ class KTitleBarActionsConfig : public KCModule
public:
KTitleBarActionsConfig( bool _standAlone, KConfig *_config, KInstance *inst, QWidget *parent );
KTitleBarActionsConfig( bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent );
~KTitleBarActionsConfig( );
void load();
@ -100,7 +100,7 @@ class KWindowActionsConfig : public KCModule
public:
KWindowActionsConfig( bool _standAlone, KConfig *_config, KInstance *inst, QWidget *parent );
KWindowActionsConfig( bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent );
~KWindowActionsConfig( );
void load();

View file

@ -103,7 +103,7 @@ KFocusConfig::~KFocusConfig ()
}
// removed the LCD display over the slider - this is not good GUI design :) RNolden 051701
KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, KInstance *inst, QWidget * parent)
KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget * parent)
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
{
QString wtstr;
@ -525,7 +525,7 @@ KAdvancedConfig::~KAdvancedConfig ()
delete config;
}
KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, KInstance *inst, QWidget *parent)
KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent)
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
{
QString wtstr;
@ -789,7 +789,7 @@ KMovingConfig::~KMovingConfig ()
delete config;
}
KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, KInstance *inst, QWidget *parent)
KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent)
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
{
QString wtstr;
@ -1242,7 +1242,7 @@ KTranslucencyConfig::~KTranslucencyConfig ()
kompmgr->detach();
}
KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, KInstance *inst, QWidget *parent)
KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent)
: KCModule(inst, parent), config(_config), standAlone(_standAlone)
{
kompmgr = 0L;

View file

@ -72,7 +72,7 @@ class KFocusConfig : public KCModule
{
Q_OBJECT
public:
KFocusConfig( bool _standAlone, KConfig *_config, KInstance *inst, QWidget *parent );
KFocusConfig( bool _standAlone, KConfig *_config, const KComponentData &inst, QWidget *parent );
~KFocusConfig();
void load();
@ -128,7 +128,7 @@ class KMovingConfig : public KCModule
{
Q_OBJECT
public:
KMovingConfig( bool _standAlone, KConfig *config, KInstance *inst, QWidget *parent );
KMovingConfig( bool _standAlone, KConfig *config, const KComponentData &inst, QWidget *parent );
~KMovingConfig();
void load();
@ -185,7 +185,7 @@ class KAdvancedConfig : public KCModule
{
Q_OBJECT
public:
KAdvancedConfig( bool _standAlone, KConfig *config, KInstance *inst, QWidget *parent );
KAdvancedConfig( bool _standAlone, KConfig *config, const KComponentData &inst, QWidget *parent );
~KAdvancedConfig();
void load();
@ -238,7 +238,7 @@ class KTranslucencyConfig : public KCModule
{
Q_OBJECT
public:
KTranslucencyConfig( bool _standAlone, KConfig *config, KInstance *inst, QWidget *parent);
KTranslucencyConfig( bool _standAlone, KConfig *config, const KComponentData &inst, QWidget *parent);
~KTranslucencyConfig();
void load();

View file

@ -37,7 +37,7 @@ namespace KWinInternal
{
KCMRules::KCMRules( QWidget *parent, const QStringList & )
: KCModule( KCMRulesFactory::instance(), parent )
: KCModule( KCMRulesFactory::componentData(), parent )
, config( "kwinrulesrc" )
{
QVBoxLayout *layout = new QVBoxLayout( this );

View file

@ -1,4 +1,6 @@
#include "/home/mkretz/KDE/src/branches/work/kinstance-redesign/kdebase/workspace/kwin/lib/kdecoration_plugins_p.h"
/*****************************************************************
// vim: sw=4 sts=4 et tw=100
This file is part of the KDE project.
Copyright (C) 1999, 2000 Daniel M. Duley <mosfet@kde.org>
@ -29,6 +31,7 @@ DEALINGS IN THE SOFTWARE.
#include <kdebug.h>
#include <klocale.h>
#include <klibloader.h>
#include <kconfiggroup.h>
#include <assert.h>
#include <QDir>
@ -36,7 +39,7 @@ DEALINGS IN THE SOFTWARE.
#include "kdecorationfactory.h"
KDecorationPlugins::KDecorationPlugins( KConfig* cfg )
KDecorationPlugins::KDecorationPlugins(const KSharedConfigPtr &cfg)
: create_ptr( NULL ),
library( NULL ),
fact( NULL ),

View file

@ -32,6 +32,7 @@ DEALINGS IN THE SOFTWARE.
#include <QString>
#include <QWidget>
#include <kconfig.h>
#include "kdecoration.h"
@ -45,7 +46,7 @@ class KWIN_EXPORT KDecorationPlugins
: public KDecorationProvides
{
public:
KDecorationPlugins( KConfig* cfg );
KDecorationPlugins(const KSharedConfigPtr &cfg);
virtual ~KDecorationPlugins();
bool loadPlugin( QString name );
void destroyPreviousPlugin();
@ -63,7 +64,7 @@ class KWIN_EXPORT KDecorationPlugins
KLibrary *old_library;
KDecorationFactory* old_fact;
QString pluginStr;
KConfig* config;
KSharedConfigPtr config;
};
/*

View file

@ -14,6 +14,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "main.h"
#include <kglobal.h>
#include <klocale.h>
#include <stdlib.h>
#include <kcmdlineargs.h>
@ -25,13 +26,12 @@ License. See the file "COPYING" for the exact licensing terms.
#include <stdio.h>
#include <fixx11h.h>
#include <QtDBus/QtDBus>
#include <kglobal.h>
#include "ksplash_interface.h"
#include "atoms.h"
#include "options.h"
#include "sm.h"
#include "utils.h"
#include "effects.h"
#define INT8 _X11INT8
#define INT32 _X11INT32
@ -88,7 +88,7 @@ Application::Application( )
: KApplication( ), owner( screen_number )
{
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
if (!config->isImmutable() && args->isSet("lock"))
{
config->setReadOnly(true);
@ -119,8 +119,6 @@ Application::Application( )
options = new Options;
atoms = new Atoms;
initting = false; // TODO
// create workspace.
(void) new Workspace( isSessionRestored() );
@ -129,8 +127,9 @@ Application::Application( )
initting = false; // startup done, we are up and running now.
QDBusInterface ksplash( "org.kde.ksplash", "/ksplash", "org.kde.KSplash" );
ksplash.call( "upAndRunning", QString( "wm started" ));
org::kde::KSplash ksplash("org.kde.ksplash", "/KSplash", QDBusConnection::sessionBus());
ksplash.upAndRunning(QString( "wm started" ));
XEvent e;
e.xclient.type = ClientMessage;
e.xclient.message_type = XInternAtom( display(), "_KDE_SPLASH_PROGRESS", False );
@ -147,8 +146,6 @@ Application::~Application()
if( owner.ownerWindow() != None ) // if there was no --replace (no new WM)
XSetInputFocus( display(), PointerRoot, RevertToPointerRoot, xTime() );
delete options;
delete effects;
delete atoms;
}
void Application::lostSelection()
@ -283,9 +280,9 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
QString appname;
if (KWinInternal::screen_number == 0)
appname = "kwin";
appname = "org.kde.kwin";
else
appname.sprintf("kwin-screen-%d", KWinInternal::screen_number);
appname.sprintf("org.kde.kwin-screen-%d", KWinInternal::screen_number);
QDBusConnection::sessionBus().interface()->registerService( appname, QDBusConnectionInterface::DontQueueService );

View file

@ -47,9 +47,9 @@ Options::~Options()
unsigned long Options::updateSettings()
{
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
unsigned long changed = 0;
changed |= d->updateKWinSettings( config ); // read decoration settings
changed |= d->updateKWinSettings( config.data() ); // read decoration settings
config->setGroup( "Windows" );
moveMode = stringToMoveResizeMode( config->readEntry("MoveMode", "Opaque" ));
@ -174,8 +174,9 @@ unsigned long Options::updateSettings()
CmdAllWheel = mouseWheelCommand(config->readEntry("CommandAllWheel","Nothing"));
//translucency settings - TODO
config->setGroup( "Notification Messages" );
useTranslucency = config->readEntry("UseTranslucency", QVariant(false)).toBool();
config->setGroup( "Translucency");
useTranslucency = config->readEntry("UseTranslucency", QVariant(true)).toBool();
translucentActiveWindows = config->readEntry("TranslucentActiveWindows", QVariant(false)).toBool();
activeWindowOpacity = uint((config->readEntry("ActiveWindowOpacity", 100)/100.0)*0xFFFFFFFF);
translucentInactiveWindows = config->readEntry("TranslucentInactiveWindows", QVariant(false)).toBool();
@ -194,24 +195,6 @@ unsigned long Options::updateSettings()
removeShadowsOnResize = config->readEntry("RemoveShadowsOnResize", QVariant(true)).toBool();
onlyDecoTranslucent = config->readEntry("OnlyDecoTranslucent", QVariant(false)).toBool();
refreshRate = config->readEntry( "RefreshRate", 0 );
smoothScale = qBound( -1, config->readEntry( "SmoothScale", -1 ), 1 );
QString glmode = config->readEntry("GLMode", "TFP" ).upper();
if( glmode == "TFP" )
glMode = GLTFP;
else if( glmode == "SHM" )
glMode = GLSHM;
else
glMode = GLFallback;
glAlwaysRebind = config->readEntry("GLAlwaysRebind", false );
glDirect = config->readEntry("GLDirect", true );
glVSync = config->readEntry("GLVSync", true );
config->setGroup( "EffectShowFps" );
effectShowFpsAlpha = config->readEntry( "Alpha", 0.5 );
effectShowFpsX = config->readEntry( "X", -10000 );
effectShowFpsY = config->readEntry( "Y", 0 );
// Read button tooltip animation effect from kdeglobals
// Since we want to allow users to enable window decoration tooltips
// and not kstyle tooltips and vise-versa, we don't read the

View file

@ -66,7 +66,7 @@ PopupInfo::~PopupInfo()
*/
void PopupInfo::reset()
{
QRect r = KGlobalSettings::desktopGeometry(cursorPos());
QRect r = KGlobalSettings::desktopGeometry(QCursor::pos());
int w = fontMetrics().width( m_infoString ) + 30;
@ -126,7 +126,7 @@ void PopupInfo::hide()
void PopupInfo::reconfigure()
{
KConfig * c(KGlobal::config());
KSharedConfigPtr c(KGlobal::config());
c->setGroup("PopupInfo");
m_show = c->readEntry("ShowPopup", false );
m_delayTime = c->readEntry("PopupHideDelay", 350 );

2
sm.h
View file

@ -13,9 +13,9 @@ License. See the file "COPYING" for the exact licensing terms.
#define KWIN_SM_H
#include <QDataStream>
#include <X11/SM/SMlib.h>
#include <kapplication.h>
#include <ksessionmanager.h>
#include <X11/SM/SMlib.h>
#include <netwm_def.h>
class QSocketNotifier;

View file

@ -34,6 +34,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QX11Info>
#include <kactioncollection.h>
#include <kkeyserver.h>
#include <kconfiggroup.h>
// specify externals before namespace
@ -644,7 +645,7 @@ void TabBox::hide()
void TabBox::reconfigure()
{
KConfig * c(KGlobal::config());
KSharedConfigPtr c(KGlobal::config());
c->setGroup("TabBox");
options_traverse_all = c->readEntry("TraverseAll", false );
}
@ -669,7 +670,7 @@ void TabBox::reconfigure()
*/
void TabBox::delayedShow()
{
KConfig * c(KGlobal::config());
KSharedConfigPtr c(KGlobal::config());
c->setGroup("TabBox");
bool delay = c->readEntry("ShowDelay", true);

View file

@ -30,6 +30,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <QToolButton>
#include <kactioncollection.h>
#include <kaction.h>
#include <kconfiggroup.h>
#include <QtDBus/QtDBus>
#include "plugins.h"
@ -42,10 +43,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 "deleted.h"
#include "effects.h"
#include <X11/extensions/shape.h>
#include <X11/keysym.h>
@ -97,7 +94,6 @@ Workspace::Workspace( bool restore )
popupinfo (0),
popup (0),
advanced_popup (0),
trans_popup (0),
desk_popup (0),
desk_popup_index (0),
keys (0),
@ -127,17 +123,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();
@ -178,12 +169,10 @@ Workspace::Workspace( bool restore )
ColormapChangeMask |
SubstructureRedirectMask |
SubstructureNotifyMask |
FocusChangeMask | // for NotifyDetailNone
ExposureMask
FocusChangeMask // for NotifyDetailNone
);
Extensions::init();
setupCompositing();
Shape::init();
// compatibility
long data = 1;
@ -332,7 +321,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()));
@ -370,11 +358,7 @@ void Workspace::init()
XWindowAttributes attr;
XGetWindowAttributes(display(), wins[i], &attr);
if (attr.override_redirect )
{
if( compositing())
createUnmanaged( wins[ i ] );
continue;
}
if( topmenu_space && topmenu_space->winId() == wins[ i ] )
continue;
if (attr.map_state != IsUnmapped)
@ -437,7 +421,6 @@ void Workspace::init()
Workspace::~Workspace()
{
finishCompositing();
blockStackingUpdates( true );
// TODO grabXServer();
// use stacking_order, so that kwin --replace keeps stacking order
@ -447,12 +430,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;
@ -496,28 +479,6 @@ Client* Workspace::createClient( Window w, bool is_mapped )
return NULL;
}
addClient( c, Allowed );
if( scene )
scene->windowAdded( c );
if( effects )
effects->windowAdded( c->effectWindow());
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->effectWindow());
return c;
}
@ -558,11 +519,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();
}
/*
@ -619,28 +576,6 @@ void Workspace::removeClient( Client* c, allowed_t )
updateClientArea();
}
void Workspace::removeUnmanaged( Unmanaged* c, allowed_t )
{
assert( unmanaged.contains( c ));
unmanaged.removeAll( c );
}
void Workspace::addDeleted( Deleted* c, allowed_t )
{
assert( !deleted.contains( c ));
deleted.append( c );
}
void Workspace::removeDeleted( Deleted* c, allowed_t )
{
assert( deleted.contains( c ));
if( scene )
scene->windowDeleted( c );
if( effects )
effects->windowDeleted( c->effectWindow());
deleted.removeAll( c );
}
void Workspace::updateFocusChains( Client* c, FocusChainChange change )
{
if( !c->wantsTabFocus()) // doesn't want tab focus, remove
@ -666,7 +601,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
@ -686,7 +627,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 );
@ -703,7 +650,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()
@ -921,6 +874,11 @@ void Workspace::updateColormap()
}
}
void Workspace::slotReloadConfig()
{
reconfigure();
}
void Workspace::reconfigure()
{
reconfigureTimer.start( 200 );
@ -937,7 +895,7 @@ void Workspace::slotSettingsChanged(int category)
/*!
Reread settings
*/
KWIN_PROCEDURE( CheckBorderSizesProcedure, Client, cl->checkBorderSizes() );
KWIN_PROCEDURE( CheckBorderSizesProcedure, cl->checkBorderSizes() );
void Workspace::slotReconfigure()
{
@ -994,11 +952,6 @@ void Workspace::slotReconfigure()
updateTopMenuGeometry();
updateCurrentTopMenu();
}
if( options->useTranslucency )
setupCompositing();
else
finishCompositing();
loadWindowRules();
for( ClientList::Iterator it = clients.begin();
@ -1013,7 +966,7 @@ void Workspace::slotReconfigure()
void Workspace::loadDesktopSettings()
{
KConfig* c = KGlobal::config();
KSharedConfig::Ptr c = KGlobal::config();
QString groupname;
if (screen_number == 0)
groupname = "Desktops";
@ -1042,7 +995,7 @@ void Workspace::loadDesktopSettings()
void Workspace::saveDesktopSettings()
{
KConfig* c = KGlobal::config();
KSharedConfig::Ptr c = KGlobal::config();
QString groupname;
if (screen_number == 0)
groupname = "Desktops";
@ -1288,11 +1241,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:
@ -1693,7 +1653,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;
@ -1894,7 +1854,7 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev )
bool is_alt = km & Mod1Mask;
bool is_shift = km & ShiftMask;
int delta = is_control?1:is_alt?32:8;
QPoint pos = cursorPos();
QPoint pos = QCursor::pos();
switch ( kc )
{
@ -2046,8 +2006,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);