setGroup to KConfigGroup

svn path=/trunk/KDE/kdebase/workspace/; revision=635823
icc-effect-5.14.5
Barış Metin 2007-02-21 02:59:04 +00:00
parent 249a84c5d9
commit 12d1b8b0fd
18 changed files with 619 additions and 568 deletions

View File

@ -102,15 +102,15 @@ void B2Config::slotSelectionChanged()
// It is passed the open config from kwindecoration to improve efficiency
void B2Config::load(KConfig * /*conf*/)
{
b2Config->setGroup("General");
KConfigGroup cg(b2Config, "General");
bool override = b2Config->readEntry("UseTitleBarBorderColors", false);
cbColorBorder->setChecked(override);
bool override = cg.readEntry("UseTitleBarBorderColors", false);
cbColorBorder->setChecked(override);
override = b2Config->readEntry( "DrawGrabHandle", true);
override = cg.readEntry( "DrawGrabHandle", true);
showGrabHandleCb->setChecked(override);
QString returnString = b2Config->readEntry(
QString returnString = cg.readEntry(
"MenuButtonDoubleClickOperation", "NoOp");
int op;
@ -147,13 +147,13 @@ static QString opToString(int op)
// Saves the configurable options to the kwinrc config file
void B2Config::save(KConfig * /*conf*/)
{
b2Config->setGroup("General");
b2Config->writeEntry("UseTitleBarBorderColors", cbColorBorder->isChecked());
b2Config->writeEntry("DrawGrabHandle", showGrabHandleCb->isChecked());
b2Config->writeEntry("MenuButtonDoubleClickOperation",
opToString(menuDblClickOp->currentIndex()));
// Ensure others trying to read this config get updated
b2Config->sync();
KConfigGroup cg(b2Config, "General");
cg.writeEntry("UseTitleBarBorderColors", cbColorBorder->isChecked());
cg.writeEntry("DrawGrabHandle", showGrabHandleCb->isChecked());
cg.writeEntry("MenuButtonDoubleClickOperation",
opToString(menuDblClickOp->currentIndex()));
// Ensure others trying to read this config get updated
b2Config->sync();
}

View File

@ -90,15 +90,15 @@ void KDEDefaultConfig::slotSelectionChanged()
// It is passed the open config from kwindecoration to improve efficiency
void KDEDefaultConfig::load( KConfig* conf )
{
conf->setGroup("KDEDefault");
bool override = conf->readEntry( "ShowTitleBarStipple", true);
KConfigGroup cg(conf, "KDEDefault");
bool override = cg.readEntry( "ShowTitleBarStipple", true);
cbShowStipple->setChecked( override );
override = conf->readEntry( "ShowGrabBar", true);
override = cg.readEntry( "ShowGrabBar", true);
cbShowGrabBar->setChecked( override );
if (highcolor) {
override = conf->readEntry( "UseGradients", true);
override = cg.readEntry( "UseGradients", true);
cbUseGradients->setChecked( override );
}
}
@ -107,12 +107,12 @@ void KDEDefaultConfig::load( KConfig* conf )
// Saves the configurable options to the kwinrc config file
void KDEDefaultConfig::save( KConfig* conf )
{
conf->setGroup("KDEDefault");
conf->writeEntry( "ShowTitleBarStipple", cbShowStipple->isChecked() );
conf->writeEntry( "ShowGrabBar", cbShowGrabBar->isChecked() );
KConfigGroup cg(conf, "KDEDefault");
cg.writeEntry( "ShowTitleBarStipple", cbShowStipple->isChecked() );
cg.writeEntry( "ShowGrabBar", cbShowGrabBar->isChecked() );
if (highcolor)
conf->writeEntry( "UseGradients", cbUseGradients->isChecked() );
cg.writeEntry( "UseGradients", cbUseGradients->isChecked() );
// No need to conf->sync() - kwindecoration will do it for us
}

View File

@ -76,22 +76,22 @@ KeramikConfig::~KeramikConfig()
// It is passed the open config from kwindecoration to improve efficiency
void KeramikConfig::load( KConfig* )
{
c->setGroup("General");
ui->showAppIcons->setChecked( c->readEntry("ShowAppIcons", true) );
ui->smallCaptions->setChecked( c->readEntry("SmallCaptionBubbles", false) );
ui->largeGrabBars->setChecked( c->readEntry("LargeGrabBars", true) );
ui->useShadowedText->setChecked( c->readEntry("UseShadowedText", true) );
KConfigGroup cg(c, "General");
ui->showAppIcons->setChecked( cg.readEntry("ShowAppIcons", true) );
ui->smallCaptions->setChecked( cg.readEntry("SmallCaptionBubbles", false) );
ui->largeGrabBars->setChecked( cg.readEntry("LargeGrabBars", true) );
ui->useShadowedText->setChecked( cg.readEntry("UseShadowedText", true) );
}
// Saves the configurable options to the kwinrc config file
void KeramikConfig::save( KConfig* )
{
c->setGroup( "General" );
c->writeEntry( "ShowAppIcons", ui->showAppIcons->isChecked() );
c->writeEntry( "SmallCaptionBubbles", ui->smallCaptions->isChecked() );
c->writeEntry( "LargeGrabBars", ui->largeGrabBars->isChecked() );
c->writeEntry( "UseShadowedText", ui->useShadowedText->isChecked() );
KConfigGroup cg(c, "General");
cg.writeEntry( "ShowAppIcons", ui->showAppIcons->isChecked() );
cg.writeEntry( "SmallCaptionBubbles", ui->smallCaptions->isChecked() );
cg.writeEntry( "LargeGrabBars", ui->largeGrabBars->isChecked() );
cg.writeEntry( "UseShadowedText", ui->useShadowedText->isChecked() );
c->sync();
}

View File

@ -561,12 +561,11 @@ void KeramikHandler::pretile( QPixmap *&pix, int size, Qt::Orientation dir )
void KeramikHandler::readConfig()
{
KConfig *c = new KConfig( "kwinkeramikrc" );
c->setGroup( "General" );
showIcons = c->readEntry( "ShowAppIcons", true);
shadowedText = c->readEntry( "UseShadowedText", true);
smallCaptionBubbles = c->readEntry( "SmallCaptionBubbles", false);
largeGrabBars = c->readEntry( "LargeGrabBars", true);
KConfigGroup cg(c, "General");
showIcons = cg.readEntry( "ShowAppIcons", true);
shadowedText = cg.readEntry( "UseShadowedText", true);
smallCaptionBubbles = cg.readEntry( "SmallCaptionBubbles", false);
largeGrabBars = cg.readEntry( "LargeGrabBars", true);
if ( ! settings_cache ) {
settings_cache = new SettingsCache;

View File

@ -83,14 +83,15 @@ static void create_pixmaps()
return;
pixmaps_created = true;
KSharedConfig::Ptr config = KGlobal::config();
config->setGroup("General");
KSharedConfig::Ptr _config = KGlobal::config();
KConfigGroup config(_config, "General");
QString tmpStr;
for(int i=0; i < 8; ++i)
{
framePixmaps[i] = new QPixmap(locate("data",
"kwin/pics/"+config->readEntry(keys[i], " ")));
"kwin/pics/"+config.readEntry(keys[i], " ")));
if(framePixmaps[i]->isNull())
kWarning() << "Unable to load frame pixmap for " << keys[i] << endl;
}
@ -111,19 +112,19 @@ static void create_pixmaps()
maxExtent++;
menuPix = new QPixmap(locate("data",
"kwin/pics/"+config->readEntry("menu", " ")));
"kwin/pics/"+config.readEntry("menu", " ")));
iconifyPix = new QPixmap(locate("data",
"kwin/pics/"+config->readEntry("iconify", " ")));
"kwin/pics/"+config.readEntry("iconify", " ")));
maxPix = new QPixmap(locate("appdata",
"pics/"+config->readEntry("maximize", " ")));
"pics/"+config.readEntry("maximize", " ")));
minmaxPix = new QPixmap(locate("data",
"kwin/pics/"+config->readEntry("maximizedown", " ")));
"kwin/pics/"+config.readEntry("maximizedown", " ")));
closePix = new QPixmap(locate("data",
"kwin/pics/"+config->readEntry("close", " ")));
"kwin/pics/"+config.readEntry("close", " ")));
pinupPix = new QPixmap(locate("data",
"kwin/pics/"+config->readEntry("pinup", " ")));
"kwin/pics/"+config.readEntry("pinup", " ")));
pindownPix = new QPixmap(locate("data",
"kwin/pics/"+config->readEntry("pindown", " ")));
"kwin/pics/"+config.readEntry("pindown", " ")));
if(menuPix->isNull())
menuPix->load(locate("data", "kwin/pics/menu.png"));
if(iconifyPix->isNull())
@ -139,18 +140,18 @@ static void create_pixmaps()
if(pindownPix->isNull())
pindownPix->load(locate("data", "kwin/pics/pindown.png"));
tmpStr = config->readEntry("TitleAlignment");
tmpStr = config.readEntry("TitleAlignment");
if(tmpStr == "right")
titleAlign = Qt::AlignRight | Qt::AlignVCenter;
else if(tmpStr == "middle")
titleAlign = Qt::AlignCenter;
else
titleAlign = Qt::AlignLeft | Qt::AlignVCenter;
titleSunken = config->readEntry("TitleFrameShaded", QVariant(true)).toBool();
titleSunken = config.readEntry("TitleFrameShaded", QVariant(true)).toBool();
// titleSunken = true; // is this fixed?
titleTransparent = config->readEntry("PixmapUnderTitleText", QVariant(true)).toBool();
titleTransparent = config.readEntry("PixmapUnderTitleText", QVariant(true)).toBool();
tmpStr = config->readEntry("TitlebarLook");
tmpStr = config.readEntry("TitlebarLook");
if(tmpStr == "shadedVertical"){
aTitlePix = new QPixmap;
aTitlePix->resize(32, 20);
@ -183,14 +184,14 @@ static void create_pixmaps()
grType = KPixmapEffect::EllipticGradient;
else{
titleGradient = false;
tmpStr = config->readEntry("TitlebarPixmapActive", "");
tmpStr = config.readEntry("TitlebarPixmapActive", "");
if(!tmpStr.isEmpty()){
aTitlePix = new QPixmap;
aTitlePix->load(locate("data", "kwin/pics/" + tmpStr));
}
else
aTitlePix = NULL;
tmpStr = config->readEntry("TitlebarPixmapInactive", "");
tmpStr = config.readEntry("TitlebarPixmapInactive", "");
if(!tmpStr.isEmpty()){
iTitlePix = new QPixmap;
iTitlePix->load(locate("data", "kwin/pics/" + tmpStr));
@ -270,8 +271,8 @@ void KWMThemeClient::init()
QBoxLayout* hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
layout->addLayout( hb, 1, 1 );
KSharedConfig::Ptr config = KGlobal::config();
config->setGroup("Buttons");
KSharedConfig::Ptr _config = KGlobal::config();
KConfigGroup config(_config, "Buttons");
QString val;
MyButton *btn;
int i;
@ -286,7 +287,7 @@ void KWMThemeClient::init()
}
QString key("Button");
key += QChar(keyOffsets[i]);
val = config->readEntry(key, defaultButtons[i]);
val = config.readEntry(key, defaultButtons[i]);
if(val == "Menu"){
mnuBtn = new MyButton(widget(), "menu");
mnuBtn->setToolTip( i18n("Menu"));

View File

@ -107,13 +107,13 @@ void ModernSysConfig::slotSelectionChanged()
void ModernSysConfig::load(KConfig* /*conf*/)
{
clientrc->setGroup("General");
bool i = clientrc->readEntry("ShowHandle", true);
KConfigGroup cg(clientrc, "General");
bool i = cg.readEntry("ShowHandle", true);
cbShowHandle->setChecked(i);
hbox->setEnabled(i);
handleSizeSlider->setEnabled(i);
handleWidth = clientrc->readEntry("HandleWidth", 6);
handleSize = clientrc->readEntry("HandleSize", 30);
handleWidth = cg.readEntry("HandleWidth", 6);
handleSize = cg.readEntry("HandleSize", 30);
handleSizeSlider->setValue(qMin((handleWidth - 6) / 2, (uint)4));
}
@ -121,10 +121,10 @@ void ModernSysConfig::load(KConfig* /*conf*/)
void ModernSysConfig::save(KConfig* /*conf*/)
{
clientrc->setGroup("General");
clientrc->writeEntry("ShowHandle", cbShowHandle->isChecked());
clientrc->writeEntry("HandleWidth", 6 + 2 * handleSizeSlider->value());
clientrc->writeEntry("HandleSize", 30 + 4 * handleSizeSlider->value());
KConfigGroup cg(clientrc, "General");
cg.writeEntry("ShowHandle", cbShowHandle->isChecked());
cg.writeEntry("HandleWidth", 6 + 2 * handleSizeSlider->value());
cg.writeEntry("HandleSize", 30 + 4 * handleSizeSlider->value());
clientrc->sync();
}

View File

@ -68,32 +68,32 @@ PlastikConfig::~PlastikConfig()
void PlastikConfig::load(KConfig*)
{
m_config->setGroup("General");
KConfigGroup cg(m_config, "General");
QString value = m_config->readEntry("TitleAlignment", "AlignLeft");
QString value = cg.readEntry("TitleAlignment", "AlignLeft");
QRadioButton *button = m_dialog->titleAlign->findChild<QRadioButton*>(value.toLatin1());
if (button) button->setChecked(true);
bool animateButtons = m_config->readEntry("AnimateButtons", true);
bool animateButtons = cg.readEntry("AnimateButtons", true);
m_dialog->animateButtons->setChecked(animateButtons);
bool menuClose = m_config->readEntry("CloseOnMenuDoubleClick", true);
bool menuClose = cg.readEntry("CloseOnMenuDoubleClick", true);
m_dialog->menuClose->setChecked(menuClose);
bool titleShadow = m_config->readEntry("TitleShadow", true);
bool titleShadow = cg.readEntry("TitleShadow", true);
m_dialog->titleShadow->setChecked(titleShadow);
bool coloredBorder = m_config->readEntry("ColoredBorder", true);
bool coloredBorder = cg.readEntry("ColoredBorder", true);
m_dialog->coloredBorder->setChecked(coloredBorder);
}
void PlastikConfig::save(KConfig*)
{
m_config->setGroup("General");
KConfigGroup cg(m_config, "General");
QRadioButton *button = (QRadioButton*)m_dialog->titleAlign->selected();
if (button) m_config->writeEntry("TitleAlignment", QString(button->objectName()));
m_config->writeEntry("AnimateButtons", m_dialog->animateButtons->isChecked() );
m_config->writeEntry("CloseOnMenuDoubleClick", m_dialog->menuClose->isChecked() );
m_config->writeEntry("TitleShadow", m_dialog->titleShadow->isChecked() );
m_config->writeEntry("ColoredBorder", m_dialog->coloredBorder->isChecked() );
if (button) cg.writeEntry("TitleAlignment", QString(button->objectName()));
cg.writeEntry("AnimateButtons", m_dialog->animateButtons->isChecked() );
cg.writeEntry("CloseOnMenuDoubleClick", m_dialog->menuClose->isChecked() );
cg.writeEntry("TitleShadow", m_dialog->titleShadow->isChecked() );
cg.writeEntry("ColoredBorder", m_dialog->coloredBorder->isChecked() );
m_config->sync();
}

View File

@ -75,10 +75,10 @@ void QuartzConfig::slotSelectionChanged()
// It is passed the open config from kwindecoration to improve efficiency
void QuartzConfig::load( KConfig* /*conf*/ )
{
quartzConfig->setGroup("General");
bool override = quartzConfig->readEntry( "UseTitleBarBorderColors", true);
KConfigGroup cg(quartzConfig, "General");
bool override = cg.readEntry( "UseTitleBarBorderColors", true);
cbColorBorder->setChecked( override );
override = quartzConfig->readEntry( "UseQuartzExtraSlim", false);
override = cg.readEntry( "UseQuartzExtraSlim", false);
cbExtraSmall->setChecked( override );
}
@ -86,9 +86,9 @@ void QuartzConfig::load( KConfig* /*conf*/ )
// Saves the configurable options to the kwinrc config file
void QuartzConfig::save( KConfig* /*conf*/ )
{
quartzConfig->setGroup("General");
quartzConfig->writeEntry( "UseTitleBarBorderColors", cbColorBorder->isChecked() );
quartzConfig->writeEntry( "UseQuartzExtraSlim", cbExtraSmall->isChecked() );
KConfigGroup cg(quartzConfig, "General");
cg.writeEntry( "UseTitleBarBorderColors", cbColorBorder->isChecked() );
cg.writeEntry( "UseQuartzExtraSlim", cbExtraSmall->isChecked() );
// Ensure others trying to read this config get updated
quartzConfig->sync();
}

View File

@ -186,8 +186,7 @@ WebClient::init()
titleHeight_ += 1;
KConfig c("kwinwebrc");
c.setGroup("General");
shape_ = c.readEntry("Shape", true);
shape_ = c.group("General").readEntry("Shape", true);
KCommonDecoration::init();
}

View File

@ -48,7 +48,6 @@
#include "mouse.h"
#include "mouse.moc"
namespace {
char const * const cnf_Max[] = {
@ -112,13 +111,13 @@ void createMaxButtonPixmaps()
"..............."},
};
QString baseColor(". c " + KGlobalSettings::baseColor().name());
QString textColor("# c " + KGlobalSettings::textColor().name());
QByteArray baseColor(". c " + KGlobalSettings::baseColor().name().toAscii());
QByteArray textColor("# c " + KGlobalSettings::textColor().name().toAscii());
for (int t = 0; t < 3; ++t)
{
maxButtonXpms[t][0] = "15 13 2 1";
maxButtonXpms[t][1] = baseColor.toAscii();
maxButtonXpms[t][2] = textColor.toAscii();
maxButtonXpms[t][1] = baseColor.constData();
maxButtonXpms[t][2] = textColor.constData();
maxButtonPixmaps[t] = QPixmap(maxButtonXpms[t]);
maxButtonPixmaps[t].setMask(maxButtonPixmaps[t].createHeuristicMask());
}
@ -374,7 +373,7 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
coMax[b]->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ));
}
connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(paletteChanged()));
connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), SLOT(paletteChanged()));
layout->addStretch();
@ -537,42 +536,45 @@ const char* KTitleBarActionsConfig::functionMax( int i )
void KTitleBarActionsConfig::load()
{
config->setGroup("Windows");
setComboText(coTiDbl, config->readEntry("TitlebarDoubleClickCommand","Shade").toAscii());
KConfigGroup windowsConfig(config, "Windows");
setComboText(coTiDbl, windowsConfig.readEntry("TitlebarDoubleClickCommand","Shade").toAscii());
for (int t = 0; t < 3; ++t)
setComboText(coMax[t],config->readEntry(cnf_Max[t], tbl_Max[t]).toAscii());
setComboText(coMax[t],windowsConfig.readEntry(cnf_Max[t], tbl_Max[t]).toAscii());
config->setGroup( "MouseBindings");
setComboText(coTiAct1,config->readEntry("CommandActiveTitlebar1","Raise").toAscii());
setComboText(coTiAct2,config->readEntry("CommandActiveTitlebar2","Lower").toAscii());
setComboText(coTiAct3,config->readEntry("CommandActiveTitlebar3","Operations menu").toAscii());
setComboText(coTiAct4,config->readEntry("CommandTitlebarWheel","Nothing").toAscii());
setComboText(coTiInAct1,config->readEntry("CommandInactiveTitlebar1","Activate and raise").toAscii());
setComboText(coTiInAct2,config->readEntry("CommandInactiveTitlebar2","Activate and lower").toAscii());
setComboText(coTiInAct3,config->readEntry("CommandInactiveTitlebar3","Operations menu").toAscii());
KConfigGroup cg(config, "MouseBindings");
setComboText(coTiAct1,cg.readEntry("CommandActiveTitlebar1","Raise").toAscii());
setComboText(coTiAct2,cg.readEntry("CommandActiveTitlebar2","Lower").toAscii());
setComboText(coTiAct3,cg.readEntry("CommandActiveTitlebar3","Operations menu").toAscii());
setComboText(coTiAct4,cg.readEntry("CommandTitlebarWheel","Nothing").toAscii());
setComboText(coTiInAct1,cg.readEntry("CommandInactiveTitlebar1","Activate and raise").toAscii());
setComboText(coTiInAct2,cg.readEntry("CommandInactiveTitlebar2","Activate and lower").toAscii());
setComboText(coTiInAct3,cg.readEntry("CommandInactiveTitlebar3","Operations menu").toAscii());
}
void KTitleBarActionsConfig::save()
{
config->setGroup("Windows");
config->writeEntry("TitlebarDoubleClickCommand", functionTiDbl( coTiDbl->currentIndex() ) );
KConfigGroup windowsConfig(config, "Windows");
windowsConfig.writeEntry("TitlebarDoubleClickCommand", functionTiDbl( coTiDbl->currentIndex() ) );
for (int t = 0; t < 3; ++t)
config->writeEntry(cnf_Max[t], functionMax(coMax[t]->currentIndex()));
windowsConfig.writeEntry(cnf_Max[t], functionMax(coMax[t]->currentIndex()));
config->setGroup("MouseBindings");
config->writeEntry("CommandActiveTitlebar1", functionTiAc(coTiAct1->currentIndex()));
config->writeEntry("CommandActiveTitlebar2", functionTiAc(coTiAct2->currentIndex()));
config->writeEntry("CommandActiveTitlebar3", functionTiAc(coTiAct3->currentIndex()));
config->writeEntry("CommandInactiveTitlebar1", functionTiInAc(coTiInAct1->currentIndex()));
config->writeEntry("CommandTitlebarWheel", functionTiWAc(coTiAct4->currentIndex()));
config->writeEntry("CommandInactiveTitlebar2", functionTiInAc(coTiInAct2->currentIndex()));
config->writeEntry("CommandInactiveTitlebar3", functionTiInAc(coTiInAct3->currentIndex()));
KConfigGroup cg(config, "MouseBindings");
cg.writeEntry("CommandActiveTitlebar1", functionTiAc(coTiAct1->currentIndex()));
cg.writeEntry("CommandActiveTitlebar2", functionTiAc(coTiAct2->currentIndex()));
cg.writeEntry("CommandActiveTitlebar3", functionTiAc(coTiAct3->currentIndex()));
cg.writeEntry("CommandInactiveTitlebar1", functionTiInAc(coTiInAct1->currentIndex()));
cg.writeEntry("CommandTitlebarWheel", functionTiWAc(coTiAct4->currentIndex()));
cg.writeEntry("CommandInactiveTitlebar2", functionTiInAc(coTiInAct2->currentIndex()));
cg.writeEntry("CommandInactiveTitlebar3", functionTiInAc(coTiInAct3->currentIndex()));
if (standAlone)
{
config->sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
}
@ -821,34 +823,36 @@ const char* KWindowActionsConfig::functionAllW(int i)
void KWindowActionsConfig::load()
{
config->setGroup( "MouseBindings");
setComboText(coWin1,config->readEntry("CommandWindow1","Activate, raise and pass click").toAscii());
setComboText(coWin2,config->readEntry("CommandWindow2","Activate and pass click").toAscii());
setComboText(coWin3,config->readEntry("CommandWindow3","Activate and pass click").toAscii());
setComboText(coAllKey,config->readEntry("CommandAllKey","Alt").toAscii());
setComboText(coAll1,config->readEntry("CommandAll1","Move").toAscii());
setComboText(coAll2,config->readEntry("CommandAll2","Toggle raise and lower").toAscii());
setComboText(coAll3,config->readEntry("CommandAll3","Resize").toAscii());
setComboText(coAllW,config->readEntry("CommandAllWheel","Nothing").toAscii());
KConfigGroup cg(config, "MouseBindings");
setComboText(coWin1,cg.readEntry("CommandWindow1","Activate, raise and pass click").toAscii());
setComboText(coWin2,cg.readEntry("CommandWindow2","Activate and pass click").toAscii());
setComboText(coWin3,cg.readEntry("CommandWindow3","Activate and pass click").toAscii());
setComboText(coAllKey,cg.readEntry("CommandAllKey","Alt").toAscii());
setComboText(coAll1,cg.readEntry("CommandAll1","Move").toAscii());
setComboText(coAll2,cg.readEntry("CommandAll2","Toggle raise and lower").toAscii());
setComboText(coAll3,cg.readEntry("CommandAll3","Resize").toAscii());
setComboText(coAllW,cg.readEntry("CommandAllWheel","Nothing").toAscii());
}
void KWindowActionsConfig::save()
{
config->setGroup("MouseBindings");
config->writeEntry("CommandWindow1", functionWin(coWin1->currentIndex()));
config->writeEntry("CommandWindow2", functionWin(coWin2->currentIndex()));
config->writeEntry("CommandWindow3", functionWin(coWin3->currentIndex()));
config->writeEntry("CommandAllKey", functionAllKey(coAllKey->currentIndex()));
config->writeEntry("CommandAll1", functionAll(coAll1->currentIndex()));
config->writeEntry("CommandAll2", functionAll(coAll2->currentIndex()));
config->writeEntry("CommandAll3", functionAll(coAll3->currentIndex()));
config->writeEntry("CommandAllWheel", functionAllW(coAllW->currentIndex()));
KConfigGroup cg(config, "MouseBindings");
cg.writeEntry("CommandWindow1", functionWin(coWin1->currentIndex()));
cg.writeEntry("CommandWindow2", functionWin(coWin2->currentIndex()));
cg.writeEntry("CommandWindow3", functionWin(coWin3->currentIndex()));
cg.writeEntry("CommandAllKey", functionAllKey(coAllKey->currentIndex()));
cg.writeEntry("CommandAll1", functionAll(coAll1->currentIndex()));
cg.writeEntry("CommandAll2", functionAll(coAll2->currentIndex()));
cg.writeEntry("CommandAll3", functionAll(coAll3->currentIndex()));
cg.writeEntry("CommandAllWheel", functionAllW(coAllW->currentIndex()));
if (standAlone)
{
config->sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
}

View File

@ -39,6 +39,7 @@
#include <QVBoxLayout>
#include <kmessagebox.h>
#include <qlabel.h>
#include <klocale.h>
#include <kcolorbutton.h>
#include <kconfig.h>
@ -56,7 +57,6 @@
#include "windows.h"
// kwin config keywords
#define KWIN_FOCUS "FocusPolicy"
#define KWIN_PLACEMENT "Placement"
@ -397,9 +397,9 @@ void KFocusConfig::load( void )
{
QString key;
config->setGroup( "Windows" );
KConfigGroup cg(config, "Windows");
key = config->readEntry(KWIN_FOCUS);
key = cg.readEntry(KWIN_FOCUS);
if( key == "ClickToFocus")
setFocus(CLICK_TO_FOCUS);
else if( key == "FocusFollowsMouse")
@ -409,31 +409,29 @@ void KFocusConfig::load( void )
else if(key == "FocusStrictlyUnderMouse")
setFocus(FOCUS_STRICTLY_UNDER_MOUSE);
int k = config->readEntry(KWIN_AUTORAISE_INTERVAL,750);
int k = cg.readEntry(KWIN_AUTORAISE_INTERVAL,750);
setAutoRaiseInterval(k);
k = config->readEntry(KWIN_DELAYFOCUS_INTERVAL,750);
k = cg.readEntry(KWIN_DELAYFOCUS_INTERVAL,750);
setDelayFocusInterval(k);
key = config->readEntry(KWIN_AUTORAISE);
key = cg.readEntry(KWIN_AUTORAISE);
setAutoRaise(key == "on");
key = config->readEntry(KWIN_DELAYFOCUS);
key = cg.readEntry(KWIN_DELAYFOCUS);
setDelayFocus(key == "on");
key = config->readEntry(KWIN_CLICKRAISE);
key = cg.readEntry(KWIN_CLICKRAISE);
setClickRaise(key != "off");
setAutoRaiseEnabled(); // this will disable/hide the auto raise delay widget if focus==click
setDelayFocusEnabled();
key = config->readEntry(KWIN_ALTTABMODE, "KDE");
key = cg.readEntry(KWIN_ALTTABMODE, "KDE");
setAltTabMode(key == "KDE");
setRollOverDesktops( config->readEntry(KWIN_ROLL_OVER_DESKTOPS, true));
setRollOverDesktops( cg.readEntry(KWIN_ROLL_OVER_DESKTOPS, true));
config->setGroup( "PopupInfo" );
setShowPopupinfo( config->readEntry(KWIN_SHOW_POPUP, false));
setShowPopupinfo( config->group("PopupInfo").readEntry(KWIN_SHOW_POPUP, false));
config->setGroup( "TabBox" );
setTraverseAll( config->readEntry(KWIN_TRAVERSE_ALL, false));
setTraverseAll( config->group("TabBox").readEntry(KWIN_TRAVERSE_ALL, false));
config->setGroup("Desktops");
emit KCModule::changed(false);
@ -443,61 +441,61 @@ void KFocusConfig::save( void )
{
int v;
config->setGroup( "Windows" );
KConfigGroup cg(config, "Windows");
v = getFocus();
if (v == CLICK_TO_FOCUS)
config->writeEntry(KWIN_FOCUS,"ClickToFocus");
cg.writeEntry(KWIN_FOCUS,"ClickToFocus");
else if (v == FOCUS_UNDER_MOUSE)
config->writeEntry(KWIN_FOCUS,"FocusUnderMouse");
cg.writeEntry(KWIN_FOCUS,"FocusUnderMouse");
else if (v == FOCUS_STRICTLY_UNDER_MOUSE)
config->writeEntry(KWIN_FOCUS,"FocusStrictlyUnderMouse");
cg.writeEntry(KWIN_FOCUS,"FocusStrictlyUnderMouse");
else
config->writeEntry(KWIN_FOCUS,"FocusFollowsMouse");
cg.writeEntry(KWIN_FOCUS,"FocusFollowsMouse");
v = getAutoRaiseInterval();
if (v <0) v = 0;
config->writeEntry(KWIN_AUTORAISE_INTERVAL,v);
cg.writeEntry(KWIN_AUTORAISE_INTERVAL,v);
v = getDelayFocusInterval();
if (v <0) v = 0;
config->writeEntry(KWIN_DELAYFOCUS_INTERVAL,v);
cg.writeEntry(KWIN_DELAYFOCUS_INTERVAL,v);
if (autoRaiseOn->isChecked())
config->writeEntry(KWIN_AUTORAISE, "on");
cg.writeEntry(KWIN_AUTORAISE, "on");
else
config->writeEntry(KWIN_AUTORAISE, "off");
cg.writeEntry(KWIN_AUTORAISE, "off");
if (delayFocusOn->isChecked())
config->writeEntry(KWIN_DELAYFOCUS, "on");
cg.writeEntry(KWIN_DELAYFOCUS, "on");
else
config->writeEntry(KWIN_DELAYFOCUS, "off");
cg.writeEntry(KWIN_DELAYFOCUS, "off");
if (clickRaiseOn->isChecked())
config->writeEntry(KWIN_CLICKRAISE, "on");
cg.writeEntry(KWIN_CLICKRAISE, "on");
else
config->writeEntry(KWIN_CLICKRAISE, "off");
cg.writeEntry(KWIN_CLICKRAISE, "off");
if (altTabPopup->isChecked())
config->writeEntry(KWIN_ALTTABMODE, "KDE");
cg.writeEntry(KWIN_ALTTABMODE, "KDE");
else
config->writeEntry(KWIN_ALTTABMODE, "CDE");
cg.writeEntry(KWIN_ALTTABMODE, "CDE");
config->writeEntry( KWIN_ROLL_OVER_DESKTOPS, rollOverDesktops->isChecked());
cg.writeEntry( KWIN_ROLL_OVER_DESKTOPS, rollOverDesktops->isChecked());
config->setGroup( "PopupInfo" );
config->writeEntry( KWIN_SHOW_POPUP, showPopupinfo->isChecked());
config->group("PopupInfo").writeEntry( KWIN_SHOW_POPUP, showPopupinfo->isChecked());
config->setGroup( "TabBox" );
config->writeEntry( KWIN_TRAVERSE_ALL , traverseAll->isChecked());
config->group("TabBox").writeEntry( KWIN_TRAVERSE_ALL , traverseAll->isChecked());
config->setGroup("Desktops");
if (standAlone)
{
config->sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}
@ -682,19 +680,19 @@ void KAdvancedConfig::setHideUtilityWindowsForInactive(bool s) {
void KAdvancedConfig::load( void )
{
config->setGroup( "Windows" );
KConfigGroup cg(config, "Windows");
setAnimateShade(config->readEntry(KWIN_ANIMSHADE, true));
setShadeHover(config->readEntry(KWIN_SHADEHOVER, false));
setShadeHoverInterval(config->readEntry(KWIN_SHADEHOVER_INTERVAL, 250));
setAnimateShade(cg.readEntry(KWIN_ANIMSHADE, true));
setShadeHover(cg.readEntry(KWIN_SHADEHOVER, false));
setShadeHoverInterval(cg.readEntry(KWIN_SHADEHOVER_INTERVAL, 250));
setElectricBorders(config->readEntry(KWM_ELECTRIC_BORDER, false));
setElectricBorderDelay(config->readEntry(KWM_ELECTRIC_BORDER_DELAY, 150));
setElectricBorders(cg.readEntry(KWM_ELECTRIC_BORDER, 0));
setElectricBorderDelay(cg.readEntry(KWM_ELECTRIC_BORDER_DELAY, 150));
// setFocusStealing( config->readEntry(KWIN_FOCUS_STEALING, 2 ));
// setFocusStealing( cg.readEntry(KWIN_FOCUS_STEALING, 2 ));
// TODO default to low for now
setFocusStealing( config->readEntry(KWIN_FOCUS_STEALING, 1 ));
setHideUtilityWindowsForInactive( config->readEntry( KWIN_HIDE_UTILITY, true));
setFocusStealing( cg.readEntry(KWIN_FOCUS_STEALING, 1 ));
setHideUtilityWindowsForInactive( cg.readEntry( KWIN_HIDE_UTILITY, true));
emit KCModule::changed(false);
}
@ -703,28 +701,31 @@ void KAdvancedConfig::save( void )
{
int v;
config->setGroup( "Windows" );
config->writeEntry(KWIN_ANIMSHADE, animateShade->isChecked());
KConfigGroup cg(config, "Windows");
cg.writeEntry(KWIN_ANIMSHADE, animateShade->isChecked());
if (shadeHoverOn->isChecked())
config->writeEntry(KWIN_SHADEHOVER, "on");
cg.writeEntry(KWIN_SHADEHOVER, "on");
else
config->writeEntry(KWIN_SHADEHOVER, "off");
cg.writeEntry(KWIN_SHADEHOVER, "off");
v = getShadeHoverInterval();
if (v<0) v = 0;
config->writeEntry(KWIN_SHADEHOVER_INTERVAL, v);
cg.writeEntry(KWIN_SHADEHOVER_INTERVAL, v);
config->writeEntry(KWM_ELECTRIC_BORDER, getElectricBorders());
config->writeEntry(KWM_ELECTRIC_BORDER_DELAY,getElectricBorderDelay());
cg.writeEntry(KWM_ELECTRIC_BORDER, getElectricBorders());
cg.writeEntry(KWM_ELECTRIC_BORDER_DELAY,getElectricBorderDelay());
config->writeEntry(KWIN_FOCUS_STEALING, focusStealing->currentIndex());
config->writeEntry(KWIN_HIDE_UTILITY, hideUtilityWindowsForInactive->isChecked());
cg.writeEntry(KWIN_FOCUS_STEALING, focusStealing->currentIndex());
cg.writeEntry(KWIN_HIDE_UTILITY, hideUtilityWindowsForInactive->isChecked());
if (standAlone)
{
config->sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}
@ -1052,35 +1053,35 @@ void KMovingConfig::load( void )
{
QString key;
config->setGroup( "Windows" );
KConfigGroup cg(config, "Windows");
key = config->readEntry(KWIN_MOVE, "Opaque");
key = cg.readEntry(KWIN_MOVE, "Opaque");
if( key == "Transparent")
setMove(TRANSPARENT);
else if( key == "Opaque")
setMove(OPAQUE);
//CT 17Jun1998 - variable animation speed from 0 (none!!) to 10 (max)
bool anim = config->readEntry(KWIN_MINIMIZE_ANIM, true);
int animSpeed = config->readEntry(KWIN_MINIMIZE_ANIM_SPEED, 5);
bool anim = cg.readEntry(KWIN_MINIMIZE_ANIM, true);
int animSpeed = cg.readEntry(KWIN_MINIMIZE_ANIM_SPEED, 5);
if( animSpeed < 1 ) animSpeed = 0;
if( animSpeed > 10 ) animSpeed = 10;
setMinimizeAnim( anim );
setMinimizeAnimSpeed( animSpeed );
// DF: please keep the default consistent with kwin (options.cpp line 145)
key = config->readEntry(KWIN_RESIZE_OPAQUE, "Opaque");
key = cg.readEntry(KWIN_RESIZE_OPAQUE, "Opaque");
if( key == "Opaque")
setResizeOpaque(RESIZE_OPAQUE);
else if ( key == "Transparent")
setResizeOpaque(RESIZE_TRANSPARENT);
//KS 10Jan2003 - Geometry Tip during window move/resize
bool showGeomTip = config->readEntry(KWIN_GEOMETRY, false);
bool showGeomTip = cg.readEntry(KWIN_GEOMETRY, false);
setGeometryTip( showGeomTip );
// placement policy --- CT 19jan98 ---
key = config->readEntry(KWIN_PLACEMENT);
key = cg.readEntry(KWIN_PLACEMENT);
//CT 13mar98 interactive placement
// if( key.left(11) == "interactive") {
// setPlacement(INTERACTIVE_PLACEMENT);
@ -1114,21 +1115,21 @@ void KMovingConfig::load( void )
setPlacement(SMART_PLACEMENT);
// }
setMoveResizeMaximized(config->readEntry(KWIN_MOVE_RESIZE_MAXIMIZED, false));
setMoveResizeMaximized(cg.readEntry(KWIN_MOVE_RESIZE_MAXIMIZED, false));
int v;
v = config->readEntry(KWM_BRDR_SNAP_ZONE, KWM_BRDR_SNAP_ZONE_DEFAULT);
v = cg.readEntry(KWM_BRDR_SNAP_ZONE, KWM_BRDR_SNAP_ZONE_DEFAULT);
if (v > MAX_BRDR_SNAP) setBorderSnapZone(MAX_BRDR_SNAP);
else if (v < 0) setBorderSnapZone (0);
else setBorderSnapZone(v);
v = config->readEntry(KWM_WNDW_SNAP_ZONE, KWM_WNDW_SNAP_ZONE_DEFAULT);
v = cg.readEntry(KWM_WNDW_SNAP_ZONE, KWM_WNDW_SNAP_ZONE_DEFAULT);
if (v > MAX_WNDW_SNAP) setWindowSnapZone(MAX_WNDW_SNAP);
else if (v < 0) setWindowSnapZone (0);
else setWindowSnapZone(v);
OverlapSnap->setChecked(config->readEntry("SnapOnlyWhenOverlapping", false));
OverlapSnap->setChecked(cg.readEntry("SnapOnlyWhenOverlapping", false));
emit KCModule::changed(false);
}
@ -1136,59 +1137,61 @@ void KMovingConfig::save( void )
{
int v;
config->setGroup( "Windows" );
KConfigGroup cg(config, "Windows");
v = getMove();
if (v == TRANSPARENT)
config->writeEntry(KWIN_MOVE,"Transparent");
cg.writeEntry(KWIN_MOVE,"Transparent");
else
config->writeEntry(KWIN_MOVE,"Opaque");
cg.writeEntry(KWIN_MOVE,"Opaque");
config->writeEntry(KWIN_GEOMETRY, getGeometryTip());
cg.writeEntry(KWIN_GEOMETRY, getGeometryTip());
// placement policy --- CT 31jan98 ---
v =getPlacement();
if (v == RANDOM_PLACEMENT)
config->writeEntry(KWIN_PLACEMENT, "Random");
cg.writeEntry(KWIN_PLACEMENT, "Random");
else if (v == CASCADE_PLACEMENT)
config->writeEntry(KWIN_PLACEMENT, "Cascade");
cg.writeEntry(KWIN_PLACEMENT, "Cascade");
else if (v == CENTERED_PLACEMENT)
config->writeEntry(KWIN_PLACEMENT, "Centered");
cg.writeEntry(KWIN_PLACEMENT, "Centered");
else if (v == ZEROCORNERED_PLACEMENT)
config->writeEntry(KWIN_PLACEMENT, "ZeroCornered");
cg.writeEntry(KWIN_PLACEMENT, "ZeroCornered");
else if (v == MAXIMIZING_PLACEMENT)
config->writeEntry(KWIN_PLACEMENT, "Maximizing");
cg.writeEntry(KWIN_PLACEMENT, "Maximizing");
//CT 13mar98 manual and interactive placement
// else if (v == MANUAL_PLACEMENT)
// config->writeEntry(KWIN_PLACEMENT, "Manual");
// cg.writeEntry(KWIN_PLACEMENT, "Manual");
// else if (v == INTERACTIVE_PLACEMENT) {
// QString tmpstr = QString("Interactive,%1").arg(interactiveTrigger->value());
// config->writeEntry(KWIN_PLACEMENT, tmpstr);
// cg.writeEntry(KWIN_PLACEMENT, tmpstr);
// }
else
config->writeEntry(KWIN_PLACEMENT, "Smart");
cg.writeEntry(KWIN_PLACEMENT, "Smart");
config->writeEntry(KWIN_MINIMIZE_ANIM, getMinimizeAnim());
config->writeEntry(KWIN_MINIMIZE_ANIM_SPEED, getMinimizeAnimSpeed());
cg.writeEntry(KWIN_MINIMIZE_ANIM, getMinimizeAnim());
cg.writeEntry(KWIN_MINIMIZE_ANIM_SPEED, getMinimizeAnimSpeed());
v = getResizeOpaque();
if (v == RESIZE_OPAQUE)
config->writeEntry(KWIN_RESIZE_OPAQUE, "Opaque");
cg.writeEntry(KWIN_RESIZE_OPAQUE, "Opaque");
else
config->writeEntry(KWIN_RESIZE_OPAQUE, "Transparent");
cg.writeEntry(KWIN_RESIZE_OPAQUE, "Transparent");
config->writeEntry(KWIN_MOVE_RESIZE_MAXIMIZED, moveResizeMaximized->isChecked());
cg.writeEntry(KWIN_MOVE_RESIZE_MAXIMIZED, moveResizeMaximized->isChecked());
config->writeEntry(KWM_BRDR_SNAP_ZONE,getBorderSnapZone());
config->writeEntry(KWM_WNDW_SNAP_ZONE,getWindowSnapZone());
config->writeEntry("SnapOnlyWhenOverlapping",OverlapSnap->isChecked());
cg.writeEntry(KWM_BRDR_SNAP_ZONE,getBorderSnapZone());
cg.writeEntry(KWM_WNDW_SNAP_ZONE,getWindowSnapZone());
cg.writeEntry("SnapOnlyWhenOverlapping",OverlapSnap->isChecked());
if (standAlone)
{
config->sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
}
emit KCModule::changed(false);
}
@ -1254,6 +1257,8 @@ KTranslucencyConfig::KTranslucencyConfig (bool _standAlone, KConfig *_config, co
"And if your GPU provides hardware-accelerated Xrender support (mainly nVidia cards):<br><br>"
"<i>Option \"RenderAccel\" \"true\"</i><br>"
"In <i>Section \"Device\"</i></qt>"), this);
label->setOpenExternalLinks(true);
label->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
lay->addWidget(label);
}
else
@ -1474,34 +1479,35 @@ void KTranslucencyConfig::load( void )
if (!kompmgrAvailable_)
return;
config->setGroup( "Translucency" );
useTranslucency->setChecked(config->readEntry("UseTranslucency", false));
activeWindowTransparency->setChecked(config->readEntry("TranslucentActiveWindows", false));
inactiveWindowTransparency->setChecked(config->readEntry("TranslucentInactiveWindows", true));
movingWindowTransparency->setChecked(config->readEntry("TranslucentMovingWindows", false));
removeShadowsOnMove->setChecked(config->readEntry("RemoveShadowsOnMove", false));
removeShadowsOnResize->setChecked(config->readEntry("RemoveShadowsOnResize", false));
dockWindowTransparency->setChecked(config->readEntry("TranslucentDocks", true));
keepAboveAsActive->setChecked(config->readEntry("TreatKeepAboveAsActive", true));
onlyDecoTranslucent->setChecked(config->readEntry("OnlyDecoTranslucent", false));
useTranslucency->setChecked(config->group("Notification Messages").readEntry("UseTranslucency", false));
activeWindowOpacity->setValue(config->readEntry("ActiveWindowOpacity",100));
inactiveWindowOpacity->setValue(config->readEntry("InactiveWindowOpacity",75));
movingWindowOpacity->setValue(config->readEntry("MovingWindowOpacity",25));
dockWindowOpacity->setValue(config->readEntry("DockOpacity",80));
KConfigGroup translucencyConfig(config, "Translucency");
activeWindowTransparency->setChecked(translucencyConfig.readEntry("TranslucentActiveWindows", false));
inactiveWindowTransparency->setChecked(translucencyConfig.readEntry("TranslucentInactiveWindows", true));
movingWindowTransparency->setChecked(translucencyConfig.readEntry("TranslucentMovingWindows", false));
removeShadowsOnMove->setChecked(translucencyConfig.readEntry("RemoveShadowsOnMove", false));
removeShadowsOnResize->setChecked(translucencyConfig.readEntry("RemoveShadowsOnResize", false));
dockWindowTransparency->setChecked(translucencyConfig.readEntry("TranslucentDocks", true));
keepAboveAsActive->setChecked(translucencyConfig.readEntry("TreatKeepAboveAsActive", true));
onlyDecoTranslucent->setChecked(translucencyConfig.readEntry("OnlyDecoTranslucent", false));
activeWindowOpacity->setValue(translucencyConfig.readEntry("ActiveWindowOpacity",100));
inactiveWindowOpacity->setValue(translucencyConfig.readEntry("InactiveWindowOpacity",75));
movingWindowOpacity->setValue(translucencyConfig.readEntry("MovingWindowOpacity",25));
dockWindowOpacity->setValue(translucencyConfig.readEntry("DockOpacity",80));
int ass, iss, dss;
dss = config->readEntry("DockShadowSize", 33);
ass = config->readEntry("ActiveWindowShadowSize", 133);
iss = config->readEntry("InactiveWindowShadowSize", 67);
dss = translucencyConfig.readEntry("DockShadowSize", 33);
ass = translucencyConfig.readEntry("ActiveWindowShadowSize", 133);
iss = translucencyConfig.readEntry("InactiveWindowShadowSize", 67);
activeWindowOpacity->setEnabled(activeWindowTransparency->isChecked());
inactiveWindowOpacity->setEnabled(inactiveWindowTransparency->isChecked());
movingWindowOpacity->setEnabled(movingWindowTransparency->isChecked());
dockWindowOpacity->setEnabled(dockWindowTransparency->isChecked());
KConfig conf_(QDir::homePath() + "/.xcompmgrrc");
conf_.setGroup("xcompmgr");
KConfig *pConf = new KConfig(QDir::homePath() + "/.xcompmgrrc");
KConfigGroup conf_(pConf, "xcompmgr");
disableARGB->setChecked(conf_.readEntry("DisableARGB", false));
@ -1527,6 +1533,8 @@ void KTranslucencyConfig::load( void )
fadeOnOpacityChange->setChecked(conf_.readEntry("FadeTrans", false));
fadeInSpeed->setValue((int)(conf_.readEntry("FadeInStep",0.020)*1000.0));
fadeOutSpeed->setValue((int)(conf_.readEntry("FadeOutStep",0.070)*1000.0));
delete pConf;
emit KCModule::changed(false);
}
@ -1535,31 +1543,32 @@ void KTranslucencyConfig::save( void )
{
if (!kompmgrAvailable_)
return;
config->setGroup( "Translucency" );
config->writeEntry("UseTranslucency",useTranslucency->isChecked());
config->writeEntry("TranslucentActiveWindows",activeWindowTransparency->isChecked());
config->writeEntry("TranslucentInactiveWindows",inactiveWindowTransparency->isChecked());
config->writeEntry("TranslucentMovingWindows",movingWindowTransparency->isChecked());
config->writeEntry("TranslucentDocks",dockWindowTransparency->isChecked());
config->writeEntry("TreatKeepAboveAsActive",keepAboveAsActive->isChecked());
config->writeEntry("ActiveWindowOpacity",activeWindowOpacity->value());
config->writeEntry("InactiveWindowOpacity",inactiveWindowOpacity->value());
config->writeEntry("MovingWindowOpacity",movingWindowOpacity->value());
config->writeEntry("DockOpacity",dockWindowOpacity->value());
config->group("Notification Messages").writeEntry("UseTranslucency",useTranslucency->isChecked());
KConfigGroup translucencyConfig(config, "Translucency");
translucencyConfig.writeEntry("TranslucentActiveWindows",activeWindowTransparency->isChecked());
translucencyConfig.writeEntry("TranslucentInactiveWindows",inactiveWindowTransparency->isChecked());
translucencyConfig.writeEntry("TranslucentMovingWindows",movingWindowTransparency->isChecked());
translucencyConfig.writeEntry("TranslucentDocks",dockWindowTransparency->isChecked());
translucencyConfig.writeEntry("TreatKeepAboveAsActive",keepAboveAsActive->isChecked());
translucencyConfig.writeEntry("ActiveWindowOpacity",activeWindowOpacity->value());
translucencyConfig.writeEntry("InactiveWindowOpacity",inactiveWindowOpacity->value());
translucencyConfig.writeEntry("MovingWindowOpacity",movingWindowOpacity->value());
translucencyConfig.writeEntry("DockOpacity",dockWindowOpacity->value());
// for simplification:
// xcompmgr supports a general shadow radius and additionally lets external apps set a multiplicator for each window
// (speed reasons, so the shadow matrix hasn't to be recreated for every window)
// we set inactive windows to 100%, the radius to the inactive window value and adjust the multiplicators for docks and active windows
// this way the user can set the three values without caring about the radius/multiplicator stuff
// additionally we find a value between big and small values to have a more smooth appereance
config->writeEntry("DockShadowSize",(int)(200.0 * dockWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
config->writeEntry("ActiveWindowShadowSize",(int)(200.0 * activeWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
config->writeEntry("InctiveWindowShadowSize",(int)(200.0 * inactiveWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
translucencyConfig.writeEntry("DockShadowSize",(int)(200.0 * dockWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
translucencyConfig.writeEntry("ActiveWindowShadowSize",(int)(200.0 * activeWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
translucencyConfig.writeEntry("InctiveWindowShadowSize",(int)(200.0 * inactiveWindowShadowSize->value() / (activeWindowShadowSize->value() + inactiveWindowShadowSize->value())));
config->writeEntry("RemoveShadowsOnMove",removeShadowsOnMove->isChecked());
config->writeEntry("RemoveShadowsOnResize",removeShadowsOnResize->isChecked());
config->writeEntry("OnlyDecoTranslucent", onlyDecoTranslucent->isChecked());
config->writeEntry("ResetKompmgr",resetKompmgr_);
translucencyConfig.writeEntry("RemoveShadowsOnMove",removeShadowsOnMove->isChecked());
translucencyConfig.writeEntry("RemoveShadowsOnResize",removeShadowsOnResize->isChecked());
translucencyConfig.writeEntry("OnlyDecoTranslucent", onlyDecoTranslucent->isChecked());
translucencyConfig.writeEntry("ResetKompmgr",resetKompmgr_);
KConfig *pConf = new KConfig(QDir::homePath() + "/.xcompmgrrc");
KConfigGroup conf_(pConf, "xcompmgr");
@ -1586,8 +1595,11 @@ void KTranslucencyConfig::save( void )
if (standAlone)
{
config->sync();
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "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

@ -22,7 +22,6 @@
#include <klocale.h>
#include <kwin.h>
#include <QtDBus/QtDBus>
#include <X11/Xlib.h>
#include <fixx11h.h>
@ -56,8 +55,7 @@ static void saveRules( const QList< Rules* >& rules )
it != groups.end();
++it )
cfg.deleteGroup( *it );
cfg.setGroup( "General" );
cfg.writeEntry( "count", rules.count());
cfg.group("General").writeEntry( "count", rules.count());
int i = 1;
for( QList< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
@ -257,8 +255,10 @@ static int edit( Window wid, bool whole_app )
delete orig_rule;
}
saveRules( rules );
QDBusInterface kwin( "org.kde.kwin", "/KWin", "org.kde.KWin" );
kwin.call( "reconfigure" );
// Send signal to all kwin instances
QDBusMessage message =
QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
QDBusConnection::sessionBus().send(message);
return 0;
}

View File

@ -18,6 +18,7 @@
#include "ruleslist.h"
#include <klistwidget.h>
#include <kpushbutton.h>
#include <assert.h>
#include <kdebug.h>
@ -28,14 +29,14 @@
namespace KWinInternal
{
KCMRulesList::KCMRulesList( QWidget* parent, const char* name )
: KCMRulesListBase( parent, name )
KCMRulesList::KCMRulesList( QWidget* parent)
: KCMRulesListBase( parent)
{
// connect both current/selected, so that current==selected (stupid QListBox :( )
connect( rules_listbox, SIGNAL( currentChanged( Q3ListBoxItem* )),
SLOT( activeChanged( Q3ListBoxItem*)));
connect( rules_listbox, SIGNAL( selectionChanged( Q3ListBoxItem* )),
SLOT( activeChanged( Q3ListBoxItem*)));
connect( rules_listbox, SIGNAL(itemChanged(QListWidgetItem*)),
SLOT(activeChanged(QListWidgetItem*)));
connect( rules_listbox, SIGNAL( selectionChanged( QListWidgetItem* )),
SLOT( activeChanged( QListWidgetItem*)));
connect( new_button, SIGNAL( clicked()),
SLOT( newClicked()));
connect( modify_button, SIGNAL( clicked()),
@ -46,7 +47,7 @@ KCMRulesList::KCMRulesList( QWidget* parent, const char* name )
SLOT( moveupClicked()));
connect( movedown_button, SIGNAL( clicked()),
SLOT( movedownClicked()));
connect( rules_listbox, SIGNAL( doubleClicked ( Q3ListBoxItem * ) ),
connect( rules_listbox, SIGNAL(itemDoubleClicked(QListWidgetItem*) ),
SLOT( modifyClicked()));
load();
}
@ -60,14 +61,16 @@ KCMRulesList::~KCMRulesList()
rules.clear();
}
void KCMRulesList::activeChanged( Q3ListBoxItem* item )
void KCMRulesList::activeChanged( QListWidgetItem* item )
{
int itemRow = rules_listbox->row(item);
if( item != NULL )
rules_listbox->setSelected( item, true ); // make current==selected
item->setSelected( true ); // make current==selected
modify_button->setEnabled( item != NULL );
delete_button->setEnabled( item != NULL );
moveup_button->setEnabled( item != NULL && item->prev() != NULL );
movedown_button->setEnabled( item != NULL && item->next() != NULL );
moveup_button->setEnabled( item != NULL && itemRow > 0 );
movedown_button->setEnabled( item != NULL && itemRow < (rules_listbox->count()-1) );
}
void KCMRulesList::newClicked()
@ -76,16 +79,16 @@ void KCMRulesList::newClicked()
Rules* rule = dlg.edit( NULL, 0, false );
if( rule == NULL )
return;
int pos = rules_listbox->currentItem() + 1;
rules_listbox->insertItem( rule->description, pos );
rules_listbox->setSelected( pos, true );
int pos = rules_listbox->currentRow() + 1;
rules_listbox->insertItem( pos , rule->description );
rules_listbox->item(pos)->setSelected( true );
rules.insert( rules.begin() + pos, rule );
emit changed( true );
}
void KCMRulesList::modifyClicked()
{
int pos = rules_listbox->currentItem();
int pos = rules_listbox->currentRow();
if ( pos == -1 )
return;
RulesDialog dlg;
@ -94,29 +97,29 @@ void KCMRulesList::modifyClicked()
return;
delete rules[ pos ];
rules[ pos ] = rule;
rules_listbox->changeItem( rule->description, pos );
rules_listbox->item(pos)->setText( rule->description );
emit changed( true );
}
void KCMRulesList::deleteClicked()
{
int pos = rules_listbox->currentItem();
int pos = rules_listbox->currentRow();
assert( pos != -1 );
rules_listbox->removeItem( pos );
delete rules_listbox->takeItem( pos );
rules.erase( rules.begin() + pos );
emit changed( true );
}
void KCMRulesList::moveupClicked()
{
int pos = rules_listbox->currentItem();
int pos = rules_listbox->currentRow();
assert( pos != -1 );
if( pos > 0 )
{
QString txt = rules_listbox->text( pos );
rules_listbox->removeItem( pos );
rules_listbox->insertItem( txt, pos - 1 );
rules_listbox->setSelected( pos - 1, true );
QString txt = rules_listbox->item(pos)->text();
delete rules_listbox->takeItem( pos );
rules_listbox->insertItem( pos - 1 , txt );
rules_listbox->item(pos-1)->setSelected( true );
Rules* rule = rules[ pos ];
rules[ pos ] = rules[ pos - 1 ];
rules[ pos - 1 ] = rule;
@ -126,14 +129,14 @@ void KCMRulesList::moveupClicked()
void KCMRulesList::movedownClicked()
{
int pos = rules_listbox->currentItem();
int pos = rules_listbox->currentRow();
assert( pos != -1 );
if( pos < int( rules_listbox->count()) - 1 )
{
QString txt = rules_listbox->text( pos );
rules_listbox->removeItem( pos );
rules_listbox->insertItem( txt, pos + 1 );
rules_listbox->setSelected( pos + 1, true );
QString txt = rules_listbox->item(pos)->text();
delete rules_listbox->takeItem( pos );
rules_listbox->insertItem( pos + 1 , txt);
rules_listbox->item(pos+1)->setSelected( true );
Rules* rule = rules[ pos ];
rules[ pos ] = rules[ pos + 1 ];
rules[ pos + 1 ] = rule;
@ -160,10 +163,10 @@ void KCMRulesList::load()
cfg.changeGroup( QString::number( i ));
Rules* rule = new Rules( cfg );
rules.append( rule );
rules_listbox->insertItem( rule->description );
rules_listbox->addItem( rule->description );
}
if( rules.count() > 0 )
rules_listbox->setSelected( 0, true );
rules_listbox->item(0)->setSelected( true );
else
activeChanged( NULL );
}
@ -176,8 +179,7 @@ void KCMRulesList::save()
it != groups.end();
++it )
cfg.deleteGroup( *it );
cfg.setGroup( "General" );
cfg.writeEntry( "count", rules.count());
cfg.group("General").writeEntry( "count", rules.count());
int i = 1;
for( QVector< Rules* >::ConstIterator it = rules.begin();
it != rules.end();

View File

@ -66,8 +66,7 @@ void KDecorationOptionsPrivate::defaultKWinSettings()
unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
{
unsigned long changed = 0;
QString old_group = config->group();
config->setGroup( "WM" );
KConfigGroup wmConfig(config, "WM");
// SettingColors
QColor old_colors[NUM_COLORS*2];
@ -79,35 +78,35 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
QPalette appPal = QApplication::palette();
// normal colors
colors[ColorFrame] = appPal.color( QPalette::Active, QPalette::Background );
colors[ColorFrame] = config->readEntry("frame", colors[ColorFrame]);
colors[ColorFrame] = wmConfig.readEntry("frame", colors[ColorFrame]);
colors[ColorHandle] = colors[ColorFrame];
colors[ColorHandle] = config->readEntry("handle", colors[ColorHandle]);
colors[ColorHandle] = wmConfig.readEntry("handle", colors[ColorHandle]);
// full button configuration (background, blend, and foreground
if(QPixmap::defaultDepth() > 8)
colors[ColorButtonBg] = colors[ColorFrame].light(130);
else
colors[ColorButtonBg] = colors[ColorFrame];
colors[ColorButtonBg] = config->readEntry("activeTitleBtnBg",
colors[ColorButtonBg] = wmConfig.readEntry("activeTitleBtnBg",
colors[ColorFrame]);
colors[ColorTitleBar] = appPal.color( QPalette::Active, QPalette::Highlight );
colors[ColorTitleBar] = config->readEntry("activeBackground",
colors[ColorTitleBar] = wmConfig.readEntry("activeBackground",
colors[ColorTitleBar]);
if(QPixmap::defaultDepth() > 8)
colors[ColorTitleBlend] = colors[ ColorTitleBar ].dark(110);
else
colors[ColorTitleBlend] = colors[ ColorTitleBar ];
colors[ColorTitleBlend] = config->readEntry("activeBlend",
colors[ColorTitleBlend] = wmConfig.readEntry("activeBlend",
colors[ColorTitleBlend]);
colors[ColorFont] = appPal.color( QPalette::Active, QPalette::HighlightedText );
colors[ColorFont] = config->readEntry("activeForeground", colors[ColorFont]);
colors[ColorFont] = wmConfig.readEntry("activeForeground", colors[ColorFont]);
// inactive
colors[ColorFrame+NUM_COLORS] = config->readEntry("inactiveFrame",
colors[ColorFrame+NUM_COLORS] = wmConfig.readEntry("inactiveFrame",
colors[ColorFrame]);
colors[ColorTitleBar+NUM_COLORS] = colors[ColorFrame];
colors[ColorTitleBar+NUM_COLORS] = config->
colors[ColorTitleBar+NUM_COLORS] = wmConfig.
readEntry("inactiveBackground", colors[ColorTitleBar+NUM_COLORS]);
if(QPixmap::defaultDepth() > 8)
@ -115,7 +114,7 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
else
colors[ColorTitleBlend+NUM_COLORS] = colors[ ColorTitleBar+NUM_COLORS ];
colors[ColorTitleBlend+NUM_COLORS] =
config->readEntry("inactiveBlend", colors[ColorTitleBlend+NUM_COLORS]);
wmConfig.readEntry("inactiveBlend", colors[ColorTitleBlend+NUM_COLORS]);
// full button configuration
if(QPixmap::defaultDepth() > 8)
@ -123,14 +122,14 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
else
colors[ColorButtonBg+NUM_COLORS] = colors[ColorFrame+NUM_COLORS];
colors[ColorButtonBg+NUM_COLORS] =
config->readEntry("inactiveTitleBtnBg",
wmConfig.readEntry("inactiveTitleBtnBg",
colors[ColorButtonBg]);
colors[ColorHandle+NUM_COLORS] =
config->readEntry("inactiveHandle", colors[ColorHandle]);
wmConfig.readEntry("inactiveHandle", colors[ColorHandle]);
colors[ColorFont+NUM_COLORS] = colors[ColorFrame].dark();
colors[ColorFont+NUM_COLORS] = config->readEntry("inactiveForeground",
colors[ColorFont+NUM_COLORS] = wmConfig.readEntry("inactiveForeground",
colors[ColorFont+NUM_COLORS]);
for( int i = 0;
@ -147,16 +146,16 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
QFont activeFontGuess = KGlobalSettings::windowTitleFont();
activeFont = config->readEntry("activeFont", activeFontGuess);
inactiveFont = config->readEntry("inactiveFont", activeFont);
activeFont = wmConfig.readEntry("activeFont", activeFontGuess);
inactiveFont = wmConfig.readEntry("inactiveFont", activeFont);
activeFontSmall = activeFont;
#ifdef __GNUC__
#warning KDE4 : is it useful ? ( temporary hack )
#endif
// activeFontSmall.setPointSize(activeFont.pointSize() - 2 > 0 ? activeFont.pointSize() - 2 : activeFont.pointSize()+1 );
activeFontSmall = config->readEntry("activeFontSmall", activeFontSmall);
inactiveFontSmall = config->readEntry("inactiveFontSmall", activeFontSmall);
activeFontSmall = wmConfig.readEntry("activeFontSmall", activeFontSmall);
inactiveFontSmall = wmConfig.readEntry("inactiveFontSmall", activeFontSmall);
if( old_activeFont != activeFont
|| old_inactiveFont != inactiveFont
@ -164,16 +163,16 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
|| old_inactiveFontSmall != inactiveFontSmall )
changed |= SettingFont;
config->setGroup( "Style" );
KConfigGroup styleConfig(config, "Style");
// SettingsButtons
QString old_title_buttons_left = title_buttons_left;
QString old_title_buttons_right = title_buttons_right;
bool old_custom_button_positions = custom_button_positions;
custom_button_positions = config->readEntry("CustomButtonPositions", false);
custom_button_positions = styleConfig.readEntry("CustomButtonPositions", false);
if (custom_button_positions)
{
title_buttons_left = config->readEntry("ButtonsOnLeft", "MS");
title_buttons_right = config->readEntry("ButtonsOnRight", "HIAX");
title_buttons_left = styleConfig.readEntry("ButtonsOnLeft", "MS");
title_buttons_right = styleConfig.readEntry("ButtonsOnRight", "HIAX");
}
else
{
@ -188,14 +187,14 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
// SettingTooltips
bool old_show_tooltips = show_tooltips;
show_tooltips = config->readEntry("ShowToolTips", true);
show_tooltips = styleConfig.readEntry("ShowToolTips", true);
if( old_show_tooltips != show_tooltips )
changed |= SettingTooltips;
// SettingBorder
BorderSize old_border_size = border_size;
int border_size_num = config->readEntry( "BorderSize", (int)BorderNormal );
int border_size_num = styleConfig.readEntry( "BorderSize", (int)BorderNormal );
if( border_size_num >= 0 && border_size_num < BordersCount )
border_size = static_cast< BorderSize >( border_size_num );
else
@ -204,9 +203,9 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
changed |= SettingBorder;
cached_border_size = BordersCount; // invalid
config->setGroup( "Windows" );
KConfigGroup windowsConfig(config, "Windows");
bool old_move_resize_maximized_windows = move_resize_maximized_windows;
move_resize_maximized_windows = config->readEntry( "MoveResizeMaximizedWindows", false);
move_resize_maximized_windows = windowsConfig.readEntry( "MoveResizeMaximizedWindows", false);
if( old_move_resize_maximized_windows != move_resize_maximized_windows )
changed |= SettingBorder;
@ -221,8 +220,6 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
}
}
config->setGroup( old_group );
return changed;
}

View File

@ -51,14 +51,14 @@ unsigned long Options::updateSettings()
unsigned long changed = 0;
changed |= d->updateKWinSettings( config.data() ); // read decoration settings
config->setGroup( "Windows" );
moveMode = stringToMoveResizeMode( config->readEntry("MoveMode", "Opaque" ));
resizeMode = stringToMoveResizeMode( config->readEntry("ResizeMode", "Opaque" ));
show_geometry_tip = config->readEntry("GeometryTip", false);
KConfigGroup windowsConfig(config, "Windows");
moveMode = stringToMoveResizeMode( windowsConfig.readEntry("MoveMode", "Opaque" ));
resizeMode = stringToMoveResizeMode( windowsConfig.readEntry("ResizeMode", "Opaque" ));
show_geometry_tip = windowsConfig.readEntry("GeometryTip", false);
QString val;
val = config->readEntry ("FocusPolicy", "ClickToFocus");
val = windowsConfig.readEntry ("FocusPolicy", "ClickToFocus");
focusPolicy = ClickToFocus; // what a default :-)
if ( val == "FocusFollowsMouse" )
focusPolicy = FocusFollowsMouse;
@ -67,31 +67,31 @@ unsigned long Options::updateSettings()
else if ( val == "FocusStrictlyUnderMouse" )
focusPolicy = FocusStrictlyUnderMouse;
val = config->readEntry ("AltTabStyle", "KDE");
val = windowsConfig.readEntry ("AltTabStyle", "KDE");
altTabStyle = KDE; // what a default :-)
if ( val == "CDE" )
altTabStyle = CDE;
rollOverDesktops = config->readEntry("RollOverDesktops", true);
rollOverDesktops = windowsConfig.readEntry("RollOverDesktops", true);
// focusStealingPreventionLevel = config->readEntry( "FocusStealingPreventionLevel", 2 );
// TODO use low level for now
focusStealingPreventionLevel = config->readEntry( "FocusStealingPreventionLevel", 1 );
focusStealingPreventionLevel = windowsConfig.readEntry( "FocusStealingPreventionLevel", 1 );
focusStealingPreventionLevel = qMax( 0, qMin( 4, focusStealingPreventionLevel ));
if( !focusPolicyIsReasonable()) // #48786, comments #7 and later
focusStealingPreventionLevel = 0;
KConfig *gc = new KConfig("kdeglobals", KConfig::NoGlobals);
bool isVirtual = KApplication::desktop()->isVirtualDesktop();
gc->setGroup("Windows");
xineramaEnabled = gc->readEntry ("XineramaEnabled", isVirtual) &&
KConfigGroup gWindowsConfig(gc, "Windows");
xineramaEnabled = gWindowsConfig.readEntry ("XineramaEnabled", isVirtual) &&
isVirtual;
if (xineramaEnabled)
{
xineramaPlacementEnabled = gc->readEntry ("XineramaPlacementEnabled", true);
xineramaMovementEnabled = gc->readEntry ("XineramaMovementEnabled", true);
xineramaMaximizeEnabled = gc->readEntry ("XineramaMaximizeEnabled", true);
xineramaFullscreenEnabled = gc->readEntry ("XineramaFullscreenEnabled", true);
xineramaPlacementEnabled = gWindowsConfig.readEntry ("XineramaPlacementEnabled", true);
xineramaMovementEnabled = gWindowsConfig.readEntry ("XineramaMovementEnabled", true);
xineramaMaximizeEnabled = gWindowsConfig.readEntry ("XineramaMaximizeEnabled", true);
xineramaFullscreenEnabled = gWindowsConfig.readEntry ("XineramaFullscreenEnabled", true);
}
else
{
@ -99,12 +99,12 @@ unsigned long Options::updateSettings()
}
delete gc;
placement = Placement::policyFromString( config->readEntry("Placement"), true );
placement = Placement::policyFromString( windowsConfig.readEntry("Placement"), true );
animateShade = config->readEntry("AnimateShade", true);
animateShade = windowsConfig.readEntry("AnimateShade", true);
animateMinimize = config->readEntry("AnimateMinimize", true);
animateMinimizeSpeed = config->readEntry("AnimateMinimizeSpeed", 5 );
animateMinimize = windowsConfig.readEntry("AnimateMinimize", true);
animateMinimizeSpeed = windowsConfig.readEntry("AnimateMinimizeSpeed", 5 );
if( focusPolicy == ClickToFocus )
{
@ -115,31 +115,31 @@ unsigned long Options::updateSettings()
}
else
{
autoRaise = config->readEntry("AutoRaise", false);
autoRaiseInterval = config->readEntry("AutoRaiseInterval", 0 );
delayFocus = config->readEntry("DelayFocus", false);
delayFocusInterval = config->readEntry("DelayFocusInterval", 0 );
autoRaise = windowsConfig.readEntry("AutoRaise", false);
autoRaiseInterval = windowsConfig.readEntry("AutoRaiseInterval", 0 );
delayFocus = windowsConfig.readEntry("DelayFocus", false);
delayFocusInterval = windowsConfig.readEntry("DelayFocusInterval", 0 );
}
shadeHover = config->readEntry("ShadeHover", false);
shadeHoverInterval = config->readEntry("ShadeHoverInterval", 250 );
shadeHover = windowsConfig.readEntry("ShadeHover", false);
shadeHoverInterval = windowsConfig.readEntry("ShadeHoverInterval", 250 );
// important: autoRaise implies ClickRaise
clickRaise = autoRaise || config->readEntry("ClickRaise", true);
clickRaise = autoRaise || windowsConfig.readEntry("ClickRaise", true);
borderSnapZone = config->readEntry("BorderSnapZone", 10);
windowSnapZone = config->readEntry("WindowSnapZone", 10);
snapOnlyWhenOverlapping=config->readEntry("SnapOnlyWhenOverlapping", false);
electric_borders = config->readEntry("ElectricBorders", 0);
electric_border_delay = config->readEntry("ElectricBorderDelay", 150);
borderSnapZone = windowsConfig.readEntry("BorderSnapZone", 10);
windowSnapZone = windowsConfig.readEntry("WindowSnapZone", 10);
snapOnlyWhenOverlapping = windowsConfig.readEntry("SnapOnlyWhenOverlapping", false);
electric_borders = windowsConfig.readEntry("ElectricBorders", 0);
electric_border_delay = windowsConfig.readEntry("ElectricBorderDelay", 150);
OpTitlebarDblClick = windowOperation( config->readEntry("TitlebarDoubleClickCommand", "Shade"), true );
d->OpMaxButtonLeftClick = windowOperation( config->readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true );
d->OpMaxButtonMiddleClick = windowOperation( config->readEntry("MaximizeButtonMiddleClickCommand", "Maximize (vertical only)"), true );
d->OpMaxButtonRightClick = windowOperation( config->readEntry("MaximizeButtonRightClickCommand", "Maximize (horizontal only)"), true );
OpTitlebarDblClick = windowOperation( windowsConfig.readEntry("TitlebarDoubleClickCommand", "Shade"), true );
d->OpMaxButtonLeftClick = windowOperation( windowsConfig.readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true );
d->OpMaxButtonMiddleClick = windowOperation( windowsConfig.readEntry("MaximizeButtonMiddleClickCommand", "Maximize (vertical only)"), true );
d->OpMaxButtonRightClick = windowOperation( windowsConfig.readEntry("MaximizeButtonRightClickCommand", "Maximize (horizontal only)"), true );
ignorePositionClasses = config->readEntry("IgnorePositionClasses",QStringList());
ignoreFocusStealingClasses = config->readEntry("IgnoreFocusStealingClasses",QStringList());
ignorePositionClasses = windowsConfig.readEntry("IgnorePositionClasses",QStringList());
ignoreFocusStealingClasses = windowsConfig.readEntry("IgnoreFocusStealingClasses",QStringList());
// Qt3.2 and older had resource class all lowercase, but Qt3.3 has it capitalized
// therefore Client::resourceClass() forces lowercase, force here lowercase as well
for( QStringList::Iterator it = ignorePositionClasses.begin();
@ -151,70 +151,49 @@ unsigned long Options::updateSettings()
++it )
(*it) = (*it).toLower();
killPingTimeout = config->readEntry( "KillPingTimeout", 5000 );
hideUtilityWindowsForInactive = config->readEntry( "HideUtilityWindowsForInactive", true);
showDesktopIsMinimizeAll = config->readEntry( "ShowDesktopIsMinimizeAll", false );
killPingTimeout = windowsConfig.readEntry( "KillPingTimeout", 5000 );
hideUtilityWindowsForInactive = windowsConfig.readEntry( "HideUtilityWindowsForInactive", true);
showDesktopIsMinimizeAll = windowsConfig.readEntry( "ShowDesktopIsMinimizeAll", false );
// Mouse bindings
config->setGroup( "MouseBindings");
CmdActiveTitlebar1 = mouseCommand(config->readEntry("CommandActiveTitlebar1","Raise"), true );
CmdActiveTitlebar2 = mouseCommand(config->readEntry("CommandActiveTitlebar2","Lower"), true );
CmdActiveTitlebar3 = mouseCommand(config->readEntry("CommandActiveTitlebar3","Operations menu"), true );
CmdInactiveTitlebar1 = mouseCommand(config->readEntry("CommandInactiveTitlebar1","Activate and raise"), true );
CmdInactiveTitlebar2 = mouseCommand(config->readEntry("CommandInactiveTitlebar2","Activate and lower"), true );
CmdInactiveTitlebar3 = mouseCommand(config->readEntry("CommandInactiveTitlebar3","Operations menu"), true );
CmdTitlebarWheel = mouseWheelCommand(config->readEntry("CommandTitlebarWheel","Nothing"));
CmdWindow1 = mouseCommand(config->readEntry("CommandWindow1","Activate, raise and pass click"), false );
CmdWindow2 = mouseCommand(config->readEntry("CommandWindow2","Activate and pass click"), false );
CmdWindow3 = mouseCommand(config->readEntry("CommandWindow3","Activate and pass click"), false );
CmdAllModKey = (config->readEntry("CommandAllKey","Alt") == "Meta") ? Qt::Key_Meta : Qt::Key_Alt;
CmdAll1 = mouseCommand(config->readEntry("CommandAll1","Move"), false );
CmdAll2 = mouseCommand(config->readEntry("CommandAll2","Toggle raise and lower"), false );
CmdAll3 = mouseCommand(config->readEntry("CommandAll3","Resize"), false );
CmdAllWheel = mouseWheelCommand(config->readEntry("CommandAllWheel","Nothing"));
KConfigGroup mouseConfig(config, "MouseBindings");
CmdActiveTitlebar1 = mouseCommand(mouseConfig.readEntry("CommandActiveTitlebar1","Raise"), true );
CmdActiveTitlebar2 = mouseCommand(mouseConfig.readEntry("CommandActiveTitlebar2","Lower"), true );
CmdActiveTitlebar3 = mouseCommand(mouseConfig.readEntry("CommandActiveTitlebar3","Operations menu"), true );
CmdInactiveTitlebar1 = mouseCommand(mouseConfig.readEntry("CommandInactiveTitlebar1","Activate and raise"), true );
CmdInactiveTitlebar2 = mouseCommand(mouseConfig.readEntry("CommandInactiveTitlebar2","Activate and lower"), true );
CmdInactiveTitlebar3 = mouseCommand(mouseConfig.readEntry("CommandInactiveTitlebar3","Operations menu"), true );
CmdTitlebarWheel = mouseWheelCommand(mouseConfig.readEntry("CommandTitlebarWheel","Nothing"));
CmdWindow1 = mouseCommand(mouseConfig.readEntry("CommandWindow1","Activate, raise and pass click"), false );
CmdWindow2 = mouseCommand(mouseConfig.readEntry("CommandWindow2","Activate and pass click"), false );
CmdWindow3 = mouseCommand(mouseConfig.readEntry("CommandWindow3","Activate and pass click"), false );
CmdAllModKey = (mouseConfig.readEntry("CommandAllKey","Alt") == "Meta") ? Qt::Key_Meta : Qt::Key_Alt;
CmdAll1 = mouseCommand(mouseConfig.readEntry("CommandAll1","Move"), false );
CmdAll2 = mouseCommand(mouseConfig.readEntry("CommandAll2","Toggle raise and lower"), false );
CmdAll3 = mouseCommand(mouseConfig.readEntry("CommandAll3","Resize"), false );
CmdAllWheel = mouseWheelCommand(mouseConfig.readEntry("CommandAllWheel","Nothing"));
//translucency settings - TODO
config->setGroup( "Translucency");
useTranslucency = config->readEntry("UseTranslucency", true);
translucentActiveWindows = config->readEntry("TranslucentActiveWindows", false);
activeWindowOpacity = uint((config->readEntry("ActiveWindowOpacity", 100)/100.0)*0xFFFFFFFF);
translucentInactiveWindows = config->readEntry("TranslucentInactiveWindows", false);
inactiveWindowOpacity = uint((config->readEntry("InactiveWindowOpacity", 75)/100.0)*0xFFFFFFFF);
translucentMovingWindows = config->readEntry("TranslucentMovingWindows", false);
movingWindowOpacity = uint((config->readEntry("MovingWindowOpacity", 50)/100.0)*0xFFFFFFFF);
translucentDocks = config->readEntry("TranslucentDocks", false);
dockOpacity = uint((config->readEntry("DockOpacity", 80)/100.0)*0xFFFFFFFF);
keepAboveAsActive = config->readEntry("TreatKeepAboveAsActive", true);
useTranslucency = config->group("Notification Messages").readEntry("UseTranslucency", false);
KConfigGroup translucencyConfig(config, "Translucency");
translucentActiveWindows = translucencyConfig.readEntry("TranslucentActiveWindows", false);
activeWindowOpacity = uint((translucencyConfig.readEntry("ActiveWindowOpacity", 100)/100.0)*0xFFFFFFFF);
translucentInactiveWindows = translucencyConfig.readEntry("TranslucentInactiveWindows", false);
inactiveWindowOpacity = uint((translucencyConfig.readEntry("InactiveWindowOpacity", 75)/100.0)*0xFFFFFFFF);
translucentMovingWindows = translucencyConfig.readEntry("TranslucentMovingWindows", false);
movingWindowOpacity = uint((translucencyConfig.readEntry("MovingWindowOpacity", 50)/100.0)*0xFFFFFFFF);
translucentDocks = translucencyConfig.readEntry("TranslucentDocks", false);
dockOpacity = uint((translucencyConfig.readEntry("DockOpacity", 80)/100.0)*0xFFFFFFFF);
keepAboveAsActive = translucencyConfig.readEntry("TreatKeepAboveAsActive", true);
//TODO: remove this variable
useTitleMenuSlider = true;
activeWindowShadowSize = config->readEntry("ActiveWindowShadowSize", 200);
inactiveWindowShadowSize = config->readEntry("InactiveWindowShadowSize", 100);
dockShadowSize = config->readEntry("DockShadowSize", 80);
removeShadowsOnMove = config->readEntry("RemoveShadowsOnMove", true);
removeShadowsOnResize = config->readEntry("RemoveShadowsOnResize", true);
onlyDecoTranslucent = config->readEntry("OnlyDecoTranslucent", false);
activeWindowShadowSize = translucencyConfig.readEntry("ActiveWindowShadowSize", 200);
inactiveWindowShadowSize = translucencyConfig.readEntry("InactiveWindowShadowSize", 100);
dockShadowSize = translucencyConfig.readEntry("DockShadowSize", 80);
removeShadowsOnMove = translucencyConfig.readEntry("RemoveShadowsOnMove", true);
removeShadowsOnResize = translucencyConfig.readEntry("RemoveShadowsOnResize", true);
onlyDecoTranslucent = translucencyConfig.readEntry("OnlyDecoTranslucent", false);
refreshRate = config->readEntry( "RefreshRate", 0 );
smoothScale = qBound( -1, config->readEntry( "SmoothScale", -1 ), 2 );
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( "Effects" );
defaultEffects = config->readEntry( "Load", QStringList() << "ShowFps" << "Fade" );
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

137
sm.cpp
View File

@ -11,6 +11,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "sm.h"
//#include <kdebug.h>
#include <unistd.h>
#include <stdlib.h>
#include <pwd.h>
@ -22,7 +23,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "client.h"
#include <QSocketNotifier>
#include <qsessionmanager.h>
#include <kdebug.h>
namespace KWinInternal
{
@ -69,7 +69,7 @@ bool SessionManager::commitData( QSessionManager& sm )
*/
void Workspace::storeSession( KConfig* config, SMSavePhase phase )
{
config->setGroup("Session" );
KConfigGroup cg(config, "Session");
int count = 0;
int active_client = -1;
for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it)
@ -88,33 +88,33 @@ void Workspace::storeSession( KConfig* config, SMSavePhase phase )
QString n = QString::number(count);
if( phase == SMSavePhase2 || phase == SMSavePhase2Full )
{
config->writeEntry( QString("sessionId")+n, sessionId.constData() );
config->writeEntry( QString("windowRole")+n, c->windowRole().constData() );
config->writeEntry( QString("wmCommand")+n, wmCommand.constData() );
config->writeEntry( QString("wmClientMachine")+n, c->wmClientMachine( true ).constData() );
config->writeEntry( QString("resourceName")+n, c->resourceName().constData() );
config->writeEntry( QString("resourceClass")+n, c->resourceClass().constData() );
config->writeEntry( QString("geometry")+n, QRect( c->calculateGravitation(true), c->clientSize() ) ); // FRAME
config->writeEntry( QString("restore")+n, c->geometryRestore() );
config->writeEntry( QString("fsrestore")+n, c->geometryFSRestore() );
config->writeEntry( QString("maximize")+n, (int) c->maximizeMode() );
config->writeEntry( QString("fullscreen")+n, (int) c->fullScreenMode() );
config->writeEntry( QString("desktop")+n, c->desktop() );
cg.writeEntry( QString("sessionId")+n, sessionId.constData() );
cg.writeEntry( QString("windowRole")+n, c->windowRole().constData() );
cg.writeEntry( QString("wmCommand")+n, wmCommand.constData() );
cg.writeEntry( QString("wmClientMachine")+n, c->wmClientMachine( true ).constData() );
cg.writeEntry( QString("resourceName")+n, c->resourceName().constData() );
cg.writeEntry( QString("resourceClass")+n, c->resourceClass().constData() );
cg.writeEntry( QString("geometry")+n, QRect( c->calculateGravitation(true), c->clientSize() ) ); // FRAME
cg.writeEntry( QString("restore")+n, c->geometryRestore() );
cg.writeEntry( QString("fsrestore")+n, c->geometryFSRestore() );
cg.writeEntry( QString("maximize")+n, (int) c->maximizeMode() );
cg.writeEntry( QString("fullscreen")+n, (int) c->fullScreenMode() );
cg.writeEntry( QString("desktop")+n, c->desktop() );
// the config entry is called "iconified" for back. comp. reasons
// (kconf_update script for updating session files would be too complicated)
config->writeEntry( QString("iconified")+n, c->isMinimized() );
cg.writeEntry( QString("iconified")+n, c->isMinimized() );
// the config entry is called "sticky" for back. comp. reasons
config->writeEntry( QString("sticky")+n, c->isOnAllDesktops() );
config->writeEntry( QString("shaded")+n, c->isShade() );
cg.writeEntry( QString("sticky")+n, c->isOnAllDesktops() );
cg.writeEntry( QString("shaded")+n, c->isShade() );
// the config entry is called "staysOnTop" for back. comp. reasons
config->writeEntry( QString("staysOnTop")+n, c->keepAbove() );
config->writeEntry( QString("keepBelow")+n, c->keepBelow() );
config->writeEntry( QString("skipTaskbar")+n, c->skipTaskbar( true ) );
config->writeEntry( QString("skipPager")+n, c->skipPager() );
config->writeEntry( QString("userNoBorder")+n, c->isUserNoBorder() );
config->writeEntry( QString("windowType")+n, windowTypeToTxt( c->windowType()));
config->writeEntry( QString("shortcut")+n, c->shortcut().toString());
config->writeEntry( QString("stackingOrder")+n, unconstrained_stacking_order.indexOf( c ));
cg.writeEntry( QString("staysOnTop")+n, c->keepAbove() );
cg.writeEntry( QString("keepBelow")+n, c->keepBelow() );
cg.writeEntry( QString("skipTaskbar")+n, c->skipTaskbar( true ) );
cg.writeEntry( QString("skipPager")+n, c->skipPager() );
cg.writeEntry( QString("userNoBorder")+n, c->isUserNoBorder() );
cg.writeEntry( QString("windowType")+n, windowTypeToTxt( c->windowType()));
cg.writeEntry( QString("shortcut")+n, c->shortcut().toString());
cg.writeEntry( QString("stackingOrder")+n, unconstrained_stacking_order.indexOf( c ));
}
}
if( phase == SMSavePhase0 )
@ -127,15 +127,15 @@ void Workspace::storeSession( KConfig* config, SMSavePhase phase )
}
else if( phase == SMSavePhase2 )
{
config->writeEntry( "count", count );
config->writeEntry( "active", session_active_client );
config->writeEntry( "desktop", session_desktop );
cg.writeEntry( "count", count );
cg.writeEntry( "active", session_active_client );
cg.writeEntry( "desktop", session_desktop );
}
else // SMSavePhase2Full
{
config->writeEntry( "count", count );
config->writeEntry( "active", session_active_client );
config->writeEntry( "desktop", currentDesktop());
cg.writeEntry( "count", count );
cg.writeEntry( "active", session_active_client );
cg.writeEntry( "desktop", currentDesktop());
}
}
@ -148,39 +148,38 @@ void Workspace::storeSession( KConfig* config, SMSavePhase phase )
void Workspace::loadSessionInfo()
{
session.clear();
KConfig* config = kapp->sessionConfig();
config->setGroup("Session" );
int count = config->readEntry( "count",0 );
int active_client = config->readEntry( "active",0 );
KConfigGroup cg(kapp->sessionConfig(), "Session");
int count = cg.readEntry( "count",0 );
int active_client = cg.readEntry( "active",0 );
for ( int i = 1; i <= count; i++ )
{
QString n = QString::number(i);
SessionInfo* info = new SessionInfo;
session.append( info );
info->sessionId = config->readEntry( QString("sessionId")+n, QString() ).toLatin1();
info->windowRole = config->readEntry( QString("windowRole")+n, QString() ).toLatin1();
info->wmCommand = config->readEntry( QString("wmCommand")+n, QString() ).toLatin1();
info->wmClientMachine = config->readEntry( QString("wmClientMachine")+n, QString() ).toLatin1();
info->resourceName = config->readEntry( QString("resourceName")+n, QString() ).toLatin1();
info->resourceClass = config->readEntry( QString("resourceClass")+n, QString() ).toLower().toLatin1();
info->geometry = config->readEntry( QString("geometry")+n,QRect() );
info->restore = config->readEntry( QString("restore")+n,QRect() );
info->fsrestore = config->readEntry( QString("fsrestore")+n,QRect() );
info->maximized = config->readEntry( QString("maximize")+n, 0 );
info->fullscreen = config->readEntry( QString("fullscreen")+n, 0 );
info->desktop = config->readEntry( QString("desktop")+n, 0 );
info->minimized = config->readEntry( QString("iconified")+n, false );
info->onAllDesktops = config->readEntry( QString("sticky")+n, false );
info->shaded = config->readEntry( QString("shaded")+n, false );
info->keepAbove = config->readEntry( QString("staysOnTop")+n, false );
info->keepBelow = config->readEntry( QString("keepBelow")+n, false );
info->skipTaskbar = config->readEntry( QString("skipTaskbar")+n, false );
info->skipPager = config->readEntry( QString("skipPager")+n, false );
info->userNoBorder = config->readEntry( QString("userNoBorder")+n, false );
info->windowType = txtToWindowType( config->readEntry( QString("windowType")+n, QString() ).toLatin1());
info->shortcut = config->readEntry( QString("shortcut")+n, QString() );
info->sessionId = cg.readEntry( QString("sessionId")+n, QString() ).toLatin1();
info->windowRole = cg.readEntry( QString("windowRole")+n, QString() ).toLatin1();
info->wmCommand = cg.readEntry( QString("wmCommand")+n, QString() ).toLatin1();
info->wmClientMachine = cg.readEntry( QString("wmClientMachine")+n, QString() ).toLatin1();
info->resourceName = cg.readEntry( QString("resourceName")+n, QString() ).toLatin1();
info->resourceClass = cg.readEntry( QString("resourceClass")+n, QString() ).toLower().toLatin1();
info->geometry = cg.readEntry( QString("geometry")+n,QRect() );
info->restore = cg.readEntry( QString("restore")+n,QRect() );
info->fsrestore = cg.readEntry( QString("fsrestore")+n,QRect() );
info->maximized = cg.readEntry( QString("maximize")+n, 0 );
info->fullscreen = cg.readEntry( QString("fullscreen")+n, 0 );
info->desktop = cg.readEntry( QString("desktop")+n, 0 );
info->minimized = cg.readEntry( QString("iconified")+n, false );
info->onAllDesktops = cg.readEntry( QString("sticky")+n, false );
info->shaded = cg.readEntry( QString("shaded")+n, false );
info->keepAbove = cg.readEntry( QString("staysOnTop")+n, false );
info->keepBelow = cg.readEntry( QString("keepBelow")+n, false );
info->skipTaskbar = cg.readEntry( QString("skipTaskbar")+n, false );
info->skipPager = cg.readEntry( QString("skipPager")+n, false );
info->userNoBorder = cg.readEntry( QString("userNoBorder")+n, false );
info->windowType = txtToWindowType( cg.readEntry( QString("windowType")+n, QString() ).toLatin1());
info->shortcut = cg.readEntry( QString("shortcut")+n, QString() );
info->active = ( active_client == i );
info->stackingOrder = config->readEntry( QString("stackingOrder")+n, -1 );
info->stackingOrder = cg.readEntry( QString("stackingOrder")+n, -1 );
}
}
@ -257,28 +256,6 @@ bool Workspace::sessionInfoWindowTypeMatch( Client* c, SessionInfo* info )
return info->windowType == c->windowType();
}
// maybe needed later
#if 0
// KMainWindow's without name() given have WM_WINDOW_ROLE in the form
// of <appname>-mainwindow#<number>
// when comparing them for fake session info, it's probably better to check
// them without the trailing number
bool Workspace::windowRoleMatch( const QByteArray& role1, const QByteArray& role2 )
{
if( role1.isEmpty() && role2.isEmpty())
return true;
int pos1 = role1.find( '#' );
int pos2 = role2.find( '#' );
bool ret;
if( pos1 < 0 || pos2 < 0 || pos1 != pos2 )
ret = role1 == role2;
else
ret = qstrncmp( role1, role2, pos1 ) == 0;
kDebug() << "WR:" << role1 << ":" << pos1 << ":" << role2 << ":" << pos2 << ":::" << ret << endl;
return ret;
}
#endif
static const char* const window_type_names[] =
{
"Unknown", "Normal" , "Desktop", "Dock", "Toolbar", "Menu", "Dialog",

View File

@ -44,7 +44,7 @@ namespace KWinInternal
extern QPixmap* kwin_get_menu_pix_hack();
TabBox::TabBox( Workspace *ws, const char *name )
: Q3Frame( 0, name, Qt::WNoAutoErase | Qt::X11BypassWindowManagerHint ), client(0), wspace(ws)
: Q3Frame( 0, name, Qt::WNoAutoErase ), current_client( NULL ), wspace(ws)
{
setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
setLineWidth(2);
@ -54,14 +54,28 @@ TabBox::TabBox( Workspace *ws, const char *name )
no_tasks = i18n("*** No Windows ***");
m = DesktopMode; // init variables
updateKeyMapping();
reconfigure();
reset();
connect(&delayedShowTimer, SIGNAL(timeout()), this, SLOT(show()));
XSetWindowAttributes attr;
attr.override_redirect = 1;
outline_left = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
outline_right = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
outline_top = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
outline_bottom = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect, &attr );
}
TabBox::~TabBox()
{
XDestroyWindow( display(), outline_left );
XDestroyWindow( display(), outline_right );
XDestroyWindow( display(), outline_top );
XDestroyWindow( display(), outline_bottom );
}
@ -111,6 +125,10 @@ void TabBox::createClientList(ClientList &list, int desktop /*-1 = all*/, Client
list += c;
else if( !list.contains( modal ))
list += modal;
else
{
// nothing
}
}
}
@ -138,7 +156,7 @@ void TabBox::reset()
{
int w, h, cw = 0, wmax = 0;
QRect r = KGlobalSettings::desktopGeometry(cursorPos());
QRect r = KGlobalSettings::desktopGeometry(QCursor::pos());
// calculate height of 1 line
// fontheight + 1 pixel above + 1 pixel below, or 32x32 icon + 2 pixel above + below
@ -146,10 +164,10 @@ void TabBox::reset()
if ( mode() == WindowsMode )
{
client = workspace()->activeClient();
setCurrentClient( workspace()->activeClient());
// get all clients to show
createClientList(clients, options_traverse_all ? -1 : workspace()->currentDesktop(), client, true);
createClientList(clients, options_traverse_all ? -1 : workspace()->currentDesktop(), current_client, true);
// calculate maximum caption width
cw = fontMetrics().width(no_tasks)+20;
@ -226,7 +244,8 @@ void TabBox::nextPrev( bool next)
{
if ( mode() == WindowsMode )
{
Client* firstClient = 0;
Client* firstClient = NULL;
Client* client = current_client;
do
{
if ( next )
@ -246,6 +265,7 @@ void TabBox::nextPrev( bool next)
break;
}
} while ( client && !clients.contains( client ));
setCurrentClient( client );
}
else if( mode() == DesktopMode )
{
@ -283,9 +303,18 @@ Client* TabBox::currentClient()
{
if ( mode() != WindowsMode )
return 0;
if (!workspace()->hasClient( client ))
if (!workspace()->hasClient( current_client ))
return 0;
return client;
return current_client;
}
void TabBox::setCurrentClient( Client* c )
{
if( current_client != c )
{
current_client = c;
updateOutline();
}
}
/*!
@ -307,6 +336,11 @@ int TabBox::currentDesktop()
*/
void TabBox::showEvent( QShowEvent* )
{
updateOutline();
XRaiseWindow( display(), outline_left );
XRaiseWindow( display(), outline_right );
XRaiseWindow( display(), outline_top );
XRaiseWindow( display(), outline_bottom );
raise();
}
@ -316,6 +350,10 @@ void TabBox::showEvent( QShowEvent* )
*/
void TabBox::hideEvent( QHideEvent* )
{
XUnmapWindow( display(), outline_left );
XUnmapWindow( display(), outline_right );
XUnmapWindow( display(), outline_top );
XUnmapWindow( display(), outline_bottom );
}
/*!
@ -354,7 +392,7 @@ void TabBox::drawContents( QPainter * )
if ( workspace()->hasClient( *it ) ) // safety
{
// draw highlight background
if ( (*it) == currentClient() )
if ( (*it) == current_client )
p.fillRect(x, y, r.width(), lineHeight, palette().brush( QPalette::Highlight ));
// draw icon
@ -388,10 +426,10 @@ void TabBox::drawContents( QPainter * )
else
s += (*it)->caption();
s = KStringHandler::cPixelSqueeze(s, fontMetrics(), r.width() - 5 - iconWidth - 8);
s = fontMetrics().elidedText(s, Qt::ElideMiddle, r.width() - 5 - iconWidth - 8);
// draw text
if ( (*it) == currentClient() )
if ( (*it) == current_client )
p.setPen(palette().color( QPalette::HighlightedText ));
else if( (*it)->isMinimized())
{
@ -509,6 +547,91 @@ void TabBox::drawContents( QPainter * )
localPainter.drawImage( QPoint( r.x(), r.y() ), pix.toImage() );
}
void TabBox::updateOutline()
{
Client* c = currentClient();
if( c == NULL || this->isHidden() || !c->isShown( true ) || !c->isOnCurrentDesktop())
{
XUnmapWindow( display(), outline_left );
XUnmapWindow( display(), outline_right );
XUnmapWindow( display(), outline_top );
XUnmapWindow( display(), outline_bottom );
return;
}
// left/right parts are between top/bottom, they don't reach as far as the corners
XMoveResizeWindow( display(), outline_left, c->x(), c->y() + 5, 5, c->height() - 10 );
XMoveResizeWindow( display(), outline_right, c->x() + c->width() - 5, c->y() + 5, 5, c->height() - 10 );
XMoveResizeWindow( display(), outline_top, c->x(), c->y(), c->width(), 5 );
XMoveResizeWindow( display(), outline_bottom, c->x(), c->y() + c->height() - 5, c->width(), 5 );
{
QPixmap pix( 5, c->height() - 10 );
QPainter p( &pix );
p.setPen( Qt::white );
p.drawLine( 0, 0, 0, pix.height() - 1 );
p.drawLine( 4, 0, 4, pix.height() - 1 );
p.setPen( Qt::gray );
p.drawLine( 1, 0, 1, pix.height() - 1 );
p.drawLine( 3, 0, 3, pix.height() - 1 );
p.setPen( Qt::black );
p.drawLine( 2, 0, 2, pix.height() - 1 );
p.end();
XSetWindowBackgroundPixmap( display(), outline_left, pix.handle());
XSetWindowBackgroundPixmap( display(), outline_right, pix.handle());
}
{
QPixmap pix( c->width(), 5 );
QPainter p( &pix );
p.setPen( Qt::white );
p.drawLine( 0, 0, pix.width() - 1 - 0, 0 );
p.drawLine( 4, 4, pix.width() - 1 - 4, 4 );
p.drawLine( 0, 0, 0, 4 );
p.drawLine( pix.width() - 1 - 0, 0, pix.width() - 1 - 0, 4 );
p.setPen( Qt::gray );
p.drawLine( 1, 1, pix.width() - 1 - 1, 1 );
p.drawLine( 3, 3, pix.width() - 1 - 3, 3 );
p.drawLine( 1, 1, 1, 4 );
p.drawLine( 3, 3, 3, 4 );
p.drawLine( pix.width() - 1 - 1, 1, pix.width() - 1 - 1, 4 );
p.drawLine( pix.width() - 1 - 3, 3, pix.width() - 1 - 3, 4 );
p.setPen( Qt::black );
p.drawLine( 2, 2, pix.width() - 1 - 2, 2 );
p.drawLine( 2, 2, 2, 4 );
p.drawLine( pix.width() - 1 - 2, 2, pix.width() - 1 - 2, 4 );
p.end();
XSetWindowBackgroundPixmap( display(), outline_top, pix.handle());
}
{
QPixmap pix( c->width(), 5 );
QPainter p( &pix );
p.setPen( Qt::white );
p.drawLine( 4, 0, pix.width() - 1 - 4, 0 );
p.drawLine( 0, 4, pix.width() - 1 - 0, 4 );
p.drawLine( 0, 4, 0, 0 );
p.drawLine( pix.width() - 1 - 0, 4, pix.width() - 1 - 0, 0 );
p.setPen( Qt::gray );
p.drawLine( 3, 1, pix.width() - 1 - 3, 1 );
p.drawLine( 1, 3, pix.width() - 1 - 1, 3 );
p.drawLine( 3, 1, 3, 0 );
p.drawLine( 1, 3, 1, 0 );
p.drawLine( pix.width() - 1 - 3, 1, pix.width() - 1 - 3, 0 );
p.drawLine( pix.width() - 1 - 1, 3, pix.width() - 1 - 1, 0 );
p.setPen( Qt::black );
p.drawLine( 2, 2, pix.width() - 1 - 2, 2 );
p.drawLine( 2, 0, 2, 2 );
p.drawLine( pix.width() - 1 - 2, 0, pix.width() - 1 - 2 , 2 );
p.end();
XSetWindowBackgroundPixmap( display(), outline_bottom, pix.handle());
}
XClearWindow( display(), outline_left );
XClearWindow( display(), outline_right );
XClearWindow( display(), outline_top );
XClearWindow( display(), outline_bottom );
XMapWindow( display(), outline_left );
XMapWindow( display(), outline_right );
XMapWindow( display(), outline_top );
XMapWindow( display(), outline_bottom );
}
void TabBox::hide()
{
delayedShowTimer.stop();
@ -523,8 +646,7 @@ void TabBox::hide()
void TabBox::reconfigure()
{
KSharedConfigPtr c(KGlobal::config());
c->setGroup("TabBox");
options_traverse_all = c->readEntry("TraverseAll", false );
options_traverse_all = c->group("TabBox").readEntry("TraverseAll", false );
}
/*!
@ -548,8 +670,8 @@ void TabBox::reconfigure()
void TabBox::delayedShow()
{
KSharedConfigPtr c(KGlobal::config());
c->setGroup("TabBox");
bool delay = c->readEntry("ShowDelay", true);
KConfigGroup cg(c, "TabBox");
bool delay = cg.readEntry("ShowDelay", true);
if (!delay)
{
@ -557,7 +679,7 @@ void TabBox::delayedShow()
return;
}
int delayTime = c->readEntry("DelayTime", 90);
int delayTime = cg.readEntry("DelayTime", 90);
delayedShowTimer.setSingleShot(true);
delayedShowTimer.start(delayTime);
}
@ -586,7 +708,7 @@ void TabBox::handleMouseEvent( XEvent* e )
{
if( workspace()->hasClient( *it ) && (num == 0) ) // safety
{
client = *it;
setCurrentClient( *it );
break;
}
num--;
@ -666,10 +788,6 @@ bool areKeySymXsDepressed( bool bAll, const uint keySyms[], int nKeySyms )
return bAll;
}
static const int MAX_KEYSYMS = 4;
static uint alt_keysyms[ MAX_KEYSYMS ];
static uint win_keysyms[ MAX_KEYSYMS ];
static bool areModKeysDepressed( const QKeySequence& seq )
{
uint rgKeySyms[10];
@ -690,17 +808,18 @@ static bool areModKeysDepressed( const QKeySequence& seq )
}
if( mod & Qt::ALT )
{
for( int i = 0;
i < MAX_KEYSYMS && alt_keysyms[ i ] != NoSymbol;
++i )
rgKeySyms[nKeySyms++] = alt_keysyms[ i ];
rgKeySyms[nKeySyms++] = XK_Alt_L;
rgKeySyms[nKeySyms++] = XK_Alt_R;
}
if( mod & Qt::META )
{
for( int i = 0;
i < MAX_KEYSYMS && win_keysyms[ i ] != NoSymbol;
++i )
rgKeySyms[nKeySyms++] = win_keysyms[ i ];
// It would take some code to determine whether the Win key
// is associated with Super or Meta, so check for both.
// See bug #140023 for details.
rgKeySyms[nKeySyms++] = XK_Super_L;
rgKeySyms[nKeySyms++] = XK_Super_R;
rgKeySyms[nKeySyms++] = XK_Meta_L;
rgKeySyms[nKeySyms++] = XK_Meta_R;
}
return areKeySymXsDepressed( false, rgKeySyms, nKeySyms );
@ -714,44 +833,6 @@ static bool areModKeysDepressed( const KShortcut& cut )
return false;
}
void TabBox::updateKeyMapping()
{
const int size = 6;
uint keysyms[ size ] = { XK_Alt_L, XK_Alt_R, XK_Super_L, XK_Super_R, XK_Meta_L, XK_Meta_R };
XModifierKeymap* map = XGetModifierMapping( display() );
int altpos = 0;
int winpos = 0;
int winmodpos = -1;
int winmod = KKeyServer::modXMeta();
while( winmod > 0 ) // get position of the set bit in winmod
{
winmod >>= 1;
++winmodpos;
}
for( int i = 0;
i < MAX_KEYSYMS;
++i )
alt_keysyms[ i ] = win_keysyms[ i ] = NoSymbol;
for( int i = 0;
i < size;
++i )
{
KeyCode keycode = XKeysymToKeycode( display(), keysyms[ i ] );
for( int j = 0;
j < map->max_keypermod;
++j )
{
if( map->modifiermap[ 3 * map->max_keypermod + j ] == keycode ) // Alt
if( altpos < MAX_KEYSYMS )
alt_keysyms[ altpos++ ] = keysyms[ i ];
if( winmodpos >= 0 && map->modifiermap[ winmodpos * map->max_keypermod + j ] == keycode )
if( winpos < MAX_KEYSYMS )
win_keysyms[ winpos++ ] = keysyms[ i ];
}
}
XFreeModifiermap( map );
}
void Workspace::slotWalkThroughWindows()
{
if ( root != rootWindow() )

View File

@ -2392,8 +2392,8 @@ void Workspace::helperDialog( const QString& message, const Client* c )
if( !type.isEmpty())
{
KConfig cfg( "kwin_dialogsrc" );
cfg.setGroup( "Notification Messages" ); // this depends on KMessageBox
if( !cfg.readEntry( type, QVariant(true )).toBool()) // has don't show again checked
KConfigGroup cg(&cfg, "Notification Messages" ); // this depends on KMessageBox
if( !cg.readEntry( type, QVariant(true )).toBool()) // has don't show again checked
return; // save launching kdialog
proc << "--dontagain" << "kwin_dialogsrc:" + type;
}