From 7b5a71d2dd1b7d440c5d65de5c9feb52f0ec25f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 6 Feb 2009 09:37:18 +0000 Subject: [PATCH] Option to not change the opacity of windows in cube mode. That way only the cube (that is the desktops) will be painted in a transparent way. FEATURE: 182195 svn path=/trunk/KDE/kdebase/workspace/; revision=922029 --- effects/cube/cube.cpp | 6 +++++- effects/cube/cube.h | 1 + effects/cube/cube_config.cpp | 5 +++++ effects/cube/cube_config.ui | 10 +++++++++- effects/cube/cylinder_config.cpp | 5 +++++ effects/cube/cylinder_config.ui | 10 +++++++++- effects/cube/sphere_config.cpp | 5 +++++ effects/cube/sphere_config.ui | 10 +++++++++- 8 files changed, 48 insertions(+), 4 deletions(-) diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index f6ed78533a..b7c7dbfd0e 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -52,7 +52,8 @@ CubeEffect::CubeEffect() , borderActivate( ElectricNone ) , frontDesktop( 0 ) , cubeOpacity( 1.0 ) - , displayDesktopName( true ) + , opacityDesktopOnly( true ) + , displayDesktopName( false ) , reflection( true ) , rotating( false ) , desktopChangedWhileRotating( false ) @@ -111,6 +112,7 @@ void CubeEffect::loadConfig( QString config ) effects->reserveElectricBorder( borderActivate ); cubeOpacity = (float)conf.readEntry( "Opacity", 80 )/100.0f; + opacityDesktopOnly = conf.readEntry( "OpacityDesktopOnly", false ); displayDesktopName = conf.readEntry( "DisplayDesktopName", true ); reflection = conf.readEntry( "Reflection", true ); rotationDuration = animationTime( conf, "RotationDuration", 500 ); @@ -1373,6 +1375,8 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP // bug #173214 if( opacity > 0.99f ) opacity = 0.99f; + if( opacityDesktopOnly && !w->isDesktop() ) + opacity = 0.99f; data.opacity *= opacity; } diff --git a/effects/cube/cube.h b/effects/cube/cube.h index 3c56088b85..50e9f5d4bc 100644 --- a/effects/cube/cube.h +++ b/effects/cube/cube.h @@ -85,6 +85,7 @@ class CubeEffect Window input; int frontDesktop; float cubeOpacity; + bool opacityDesktopOnly; bool displayDesktopName; bool reflection; bool rotating; diff --git a/effects/cube/cube_config.cpp b/effects/cube/cube_config.cpp index d9ca3b0c0d..f28504af16 100644 --- a/effects/cube/cube_config.cpp +++ b/effects/cube/cube_config.cpp @@ -68,6 +68,7 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) : connect(m_ui->rotationDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); connect(m_ui->cubeOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(changed())); connect(m_ui->cubeOpacitySpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); + connect(m_ui->desktopOpacityOnlyBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->displayDesktopNameBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->reflectionBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->backgroundColorButton, SIGNAL(changed(QColor)), this, SLOT(changed())); @@ -96,6 +97,7 @@ void CubeEffectConfig::load() int duration = conf.readEntry( "RotationDuration", 0 ); float opacity = conf.readEntry( "Opacity", 80 ); + bool desktopOpacityOnly = conf.readEntry( "OpacityDesktopOnly", false ); bool desktopName = conf.readEntry( "DisplayDesktopName", true ); bool reflection = conf.readEntry( "Reflection", true ); QColor background = conf.readEntry( "BackgroundColor", QColor( Qt::black ) ); @@ -115,6 +117,7 @@ void CubeEffectConfig::load() m_ui->rotationDurationSpin->setValue( duration ); m_ui->cubeOpacitySlider->setValue( opacity ); m_ui->cubeOpacitySpin->setValue( opacity ); + m_ui->desktopOpacityOnlyBox->setChecked( desktopOpacityOnly ); if( desktopName ) { m_ui->displayDesktopNameBox->setCheckState( Qt::Checked ); @@ -197,6 +200,7 @@ void CubeEffectConfig::save() conf.writeEntry( "DisplayDesktopName", m_ui->displayDesktopNameBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "Reflection", m_ui->reflectionBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "Opacity", m_ui->cubeOpacitySpin->value() ); + conf.writeEntry( "OpacityDesktopOnly", m_ui->desktopOpacityOnlyBox->isChecked() ); conf.writeEntry( "BackgroundColor", m_ui->backgroundColorButton->color() ); conf.writeEntry( "Caps", m_ui->cubeCapsBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "CapColor", m_ui->capColorButton->color() ); @@ -226,6 +230,7 @@ void CubeEffectConfig::defaults() m_ui->reflectionBox->setCheckState( Qt::Checked ); m_ui->cubeOpacitySpin->setValue( 80 ); m_ui->cubeOpacitySlider->setValue( 80 ); + m_ui->desktopOpacityOnlyBox->setChecked( false ); m_ui->backgroundColorButton->setColor( QColor( Qt::black ) ); m_ui->cubeCapsBox->setCheckState( Qt::Checked ); m_ui->capColorButton->setColor( KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); diff --git a/effects/cube/cube_config.ui b/effects/cube/cube_config.ui index 16eb979ca3..8ecbfa7b4a 100644 --- a/effects/cube/cube_config.ui +++ b/effects/cube/cube_config.ui @@ -5,7 +5,7 @@ 0 0 - 610 + 700 566 @@ -241,6 +241,13 @@ + + + + Do not change opacity of windows + + + @@ -488,6 +495,7 @@ otherwise it will remain active rotationDurationSpin cubeOpacitySlider cubeOpacitySpin + desktopOpacityOnlyBox backgroundColorButton wallpaperRequester cubeCapsBox diff --git a/effects/cube/cylinder_config.cpp b/effects/cube/cylinder_config.cpp index 861b053c88..4971996953 100644 --- a/effects/cube/cylinder_config.cpp +++ b/effects/cube/cylinder_config.cpp @@ -66,6 +66,7 @@ CylinderEffectConfig::CylinderEffectConfig(QWidget* parent, const QVariantList& connect(m_ui->rotationDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); connect(m_ui->cubeOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(changed())); connect(m_ui->cubeOpacitySpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); + connect(m_ui->desktopOpacityOnlyBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->displayDesktopNameBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->reflectionBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->backgroundColorButton, SIGNAL(changed(QColor)), this, SLOT(changed())); @@ -92,6 +93,7 @@ void CylinderEffectConfig::load() int duration = conf.readEntry( "RotationDuration", 0 ); float opacity = conf.readEntry( "Opacity", 80 ); + bool desktopOpacityOnly = conf.readEntry( "OpacityDesktopOnly", false ); bool desktopName = conf.readEntry( "DisplayDesktopName", true ); bool reflection = conf.readEntry( "Reflection", true ); QColor background = conf.readEntry( "BackgroundColor", QColor( Qt::black ) ); @@ -109,6 +111,7 @@ void CylinderEffectConfig::load() m_ui->rotationDurationSpin->setValue( duration ); m_ui->cubeOpacitySlider->setValue( opacity ); m_ui->cubeOpacitySpin->setValue( opacity ); + m_ui->desktopOpacityOnlyBox->setChecked( desktopOpacityOnly ); if( desktopName ) { m_ui->displayDesktopNameBox->setCheckState( Qt::Checked ); @@ -175,6 +178,7 @@ void CylinderEffectConfig::save() conf.writeEntry( "DisplayDesktopName", m_ui->displayDesktopNameBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "Reflection", m_ui->reflectionBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "Opacity", m_ui->cubeOpacitySpin->value() ); + conf.writeEntry( "OpacityDesktopOnly", m_ui->desktopOpacityOnlyBox->isChecked() ); conf.writeEntry( "BackgroundColor", m_ui->backgroundColorButton->color() ); conf.writeEntry( "Caps", m_ui->cubeCapsBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "CapColor", m_ui->capColorButton->color() ); @@ -202,6 +206,7 @@ void CylinderEffectConfig::defaults() m_ui->reflectionBox->setCheckState( Qt::Checked ); m_ui->cubeOpacitySpin->setValue( 80 ); m_ui->cubeOpacitySlider->setValue( 80 ); + m_ui->desktopOpacityOnlyBox->setChecked( false ); m_ui->backgroundColorButton->setColor( QColor( Qt::black ) ); m_ui->cubeCapsBox->setCheckState( Qt::Checked ); m_ui->capColorButton->setColor( KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); diff --git a/effects/cube/cylinder_config.ui b/effects/cube/cylinder_config.ui index 057fd7fe62..433db2d8f9 100644 --- a/effects/cube/cylinder_config.ui +++ b/effects/cube/cylinder_config.ui @@ -5,7 +5,7 @@ 0 0 - 610 + 729 542 @@ -241,6 +241,13 @@ + + + + Do not change opacity of windows + + + @@ -460,6 +467,7 @@ otherwise it will remain active. rotationDurationSpin cubeOpacitySlider cubeOpacitySpin + desktopOpacityOnlyBox backgroundColorButton wallpaperRequester cubeCapsBox diff --git a/effects/cube/sphere_config.cpp b/effects/cube/sphere_config.cpp index cf5eb5e662..9e0df2d548 100644 --- a/effects/cube/sphere_config.cpp +++ b/effects/cube/sphere_config.cpp @@ -66,6 +66,7 @@ SphereEffectConfig::SphereEffectConfig(QWidget* parent, const QVariantList& args connect(m_ui->rotationDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); connect(m_ui->cubeOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(changed())); connect(m_ui->cubeOpacitySpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); + connect(m_ui->desktopOpacityOnlyBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->displayDesktopNameBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->backgroundColorButton, SIGNAL(changed(QColor)), this, SLOT(changed())); connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); @@ -91,6 +92,7 @@ void SphereEffectConfig::load() int duration = conf.readEntry( "RotationDuration", 0 ); float opacity = conf.readEntry( "Opacity", 80 ); + bool desktopOpacityOnly = conf.readEntry( "OpacityDesktopOnly", false ); bool desktopName = conf.readEntry( "DisplayDesktopName", true ); QColor background = conf.readEntry( "BackgroundColor", QColor( Qt::black ) ); QColor capColor = conf.readEntry( "CapColor", KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); @@ -107,6 +109,7 @@ void SphereEffectConfig::load() m_ui->rotationDurationSpin->setValue( duration ); m_ui->cubeOpacitySlider->setValue( opacity ); m_ui->cubeOpacitySpin->setValue( opacity ); + m_ui->desktopOpacityOnlyBox->setChecked( desktopOpacityOnly ); if( desktopName ) { m_ui->displayDesktopNameBox->setCheckState( Qt::Checked ); @@ -163,6 +166,7 @@ void SphereEffectConfig::save() conf.writeEntry( "RotationDuration", m_ui->rotationDurationSpin->value() ); conf.writeEntry( "DisplayDesktopName", m_ui->displayDesktopNameBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "Opacity", m_ui->cubeOpacitySpin->value() ); + conf.writeEntry( "OpacityDesktopOnly", m_ui->desktopOpacityOnlyBox->isChecked() ); conf.writeEntry( "BackgroundColor", m_ui->backgroundColorButton->color() ); conf.writeEntry( "Caps", m_ui->cubeCapsBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "CapColor", m_ui->capColorButton->color() ); @@ -189,6 +193,7 @@ void SphereEffectConfig::defaults() m_ui->displayDesktopNameBox->setCheckState( Qt::Checked ); m_ui->cubeOpacitySpin->setValue( 80 ); m_ui->cubeOpacitySlider->setValue( 80 ); + m_ui->desktopOpacityOnlyBox->setChecked( false ); m_ui->backgroundColorButton->setColor( QColor( Qt::black ) ); m_ui->cubeCapsBox->setCheckState( Qt::Checked ); m_ui->capColorButton->setColor( KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); diff --git a/effects/cube/sphere_config.ui b/effects/cube/sphere_config.ui index bef6d65a1a..406cf3a13c 100644 --- a/effects/cube/sphere_config.ui +++ b/effects/cube/sphere_config.ui @@ -5,7 +5,7 @@ 0 0 - 610 + 700 542 @@ -241,6 +241,13 @@ + + + + Do not change opacity of windows + + + @@ -502,6 +509,7 @@ otherwise it will remain active rotationDurationSpin cubeOpacitySlider cubeOpacitySpin + desktopOpacityOnlyBox backgroundColorButton wallpaperRequester cubeCapsBox