diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index 93ade8ab9c..4e3c3e3a8a 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -131,6 +131,7 @@ void CubeEffect::loadConfig( QString config ) invertKeys = conf.readEntry( "InvertKeys", false ); invertMouse = conf.readEntry( "InvertMouse", false ); capDeformationFactor = conf.readEntry( "CapDeformation", 0 )/100.0f; + useZOrdering = conf.readEntry( "ZOrdering", false ); QString file = conf.readEntry( "Wallpaper", QString("") ); if( wallpaper ) wallpaper->discard(); @@ -1287,11 +1288,11 @@ void CubeEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int if( w->isOnDesktop( painting_desktop )) { QRect rect = effects->clientArea( FullArea, activeScreen, painting_desktop ); - if( w->x() < rect.x() ) + if( w->x() < rect.x() && !useZOrdering ) { data.quads = data.quads.splitAtX( -w->x() ); } - if( w->x() + w->width() > rect.x() + rect.width() ) + if( w->x() + w->width() > rect.x() + rect.width() && !useZOrdering ) { data.quads = data.quads.splitAtX( rect.width() - w->x() ); } @@ -1311,7 +1312,7 @@ void CubeEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int int prev_desktop = painting_desktop -1; if( prev_desktop == 0 ) prev_desktop = effects->numberOfDesktops(); - if( w->isOnDesktop( prev_desktop ) ) + if( w->isOnDesktop( prev_desktop ) && !useZOrdering ) { QRect rect = effects->clientArea( FullArea, activeScreen, prev_desktop); if( w->x()+w->width() > rect.x() + rect.width() ) @@ -1335,7 +1336,7 @@ void CubeEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int int next_desktop = painting_desktop +1; if( next_desktop > effects->numberOfDesktops() ) next_desktop = 1; - if( w->isOnDesktop( next_desktop ) ) + if( w->isOnDesktop( next_desktop ) && !useZOrdering ) { QRect rect = effects->clientArea( FullArea, activeScreen, next_desktop); if( w->x() < rect.x() ) @@ -1405,6 +1406,16 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP if( painting_desktop == effects->currentDesktop() && (!w->isOnDesktop( painting_desktop )) ) opacity = cubeOpacity * (1.0 - timeLine.value()); } + // z-Ordering + if( !w->isDesktop() && !w->isDock() && useZOrdering ) + { + float zOrdering = (effects->stackingOrder().indexOf( w )-1)*25.0; + if( start ) + zOrdering *= timeLine.value(); + if( stop ) + zOrdering *= (1.0 - timeLine.value()); + data.zTranslate += zOrdering; + } // check for windows belonging to the previous desktop int prev_desktop = painting_desktop -1; if( prev_desktop == 0 ) @@ -1412,7 +1423,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP int next_desktop = painting_desktop +1; if( next_desktop > effects->numberOfDesktops() ) next_desktop = 1; - if( w->isOnDesktop( prev_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) ) + if( w->isOnDesktop( prev_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) && !useZOrdering ) { QRect rect = effects->clientArea( FullArea, activeScreen, prev_desktop); data.xTranslate = -rect.width(); @@ -1426,7 +1437,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP } data.quads = new_quads; } - if( w->isOnDesktop( next_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) ) + if( w->isOnDesktop( next_desktop ) && ( mask & PAINT_WINDOW_TRANSFORMED ) && !useZOrdering ) { QRect rect = effects->clientArea( FullArea, activeScreen, next_desktop); data.xTranslate = rect.width(); @@ -1468,7 +1479,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP opacity = 0.99f; data.opacity *= opacity; - if( w->isOnDesktop(painting_desktop) && w->x() < rect.x() ) + if( w->isOnDesktop(painting_desktop) && w->x() < rect.x() && !useZOrdering ) { WindowQuadList new_quads; foreach( const WindowQuad &quad, data.quads ) @@ -1480,7 +1491,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP } data.quads = new_quads; } - if( w->isOnDesktop(painting_desktop) && w->x() + w->width() > rect.x() + rect.width() ) + if( w->isOnDesktop(painting_desktop) && w->x() + w->width() > rect.x() + rect.width() && !useZOrdering ) { WindowQuadList new_quads; foreach( const WindowQuad &quad, data.quads ) @@ -1547,7 +1558,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP } } } - effects->paintWindow( w, mask, region, data ); + effects->paintWindow( w, PAINT_WINDOW_TRANSFORMED, region, data ); if( activated && cube_painting ) { if( mode == Cylinder ) diff --git a/effects/cube/cube.h b/effects/cube/cube.h index 240d1bebb2..bdde251f17 100644 --- a/effects/cube/cube.h +++ b/effects/cube/cube.h @@ -143,6 +143,7 @@ class CubeEffect GLShader* cylinderShader; GLShader* sphereShader; float capDeformationFactor; + bool useZOrdering; // GL lists bool capListCreated; diff --git a/effects/cube/cube_config.cpp b/effects/cube/cube_config.cpp index aa12894a98..d74d5b4007 100644 --- a/effects/cube/cube_config.cpp +++ b/effects/cube/cube_config.cpp @@ -94,6 +94,7 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) : connect(m_ui->invertKeysBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->invertMouseBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->capDeformationSlider, SIGNAL(valueChanged(int)), this, SLOT(changed())); + connect(m_ui->zOrderingBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); load(); } @@ -121,6 +122,7 @@ void CubeEffectConfig::load() bool invertKeys = conf.readEntry( "InvertKeys", false ); bool invertMouse = conf.readEntry( "InvertMouse", false ); m_ui->capDeformationSlider->setValue( conf.readEntry( "CapDeformation", 0 ) ); + bool zOrdering = conf.readEntry( "ZOrdering", false ); m_ui->rotationDurationSpin->setValue( duration ); m_ui->cubeOpacitySlider->setValue( opacity ); @@ -186,6 +188,7 @@ void CubeEffectConfig::load() m_ui->capColorButton->setColor( capColor ); m_ui->invertKeysBox->setChecked( invertKeys ); m_ui->invertMouseBox->setChecked( invertMouse ); + m_ui->zOrderingBox->setChecked( zOrdering ); capsSelectionChanged(); emit changed(false); @@ -212,6 +215,7 @@ void CubeEffectConfig::save() conf.writeEntry( "InvertKeys", m_ui->invertKeysBox->isChecked() ); conf.writeEntry( "InvertMouse", m_ui->invertMouseBox->isChecked() ); conf.writeEntry( "CapDeformation", m_ui->capDeformationSlider->value() ); + conf.writeEntry( "ZOrdering", m_ui->zOrderingBox->isChecked() ); m_ui->editor->save(); @@ -241,6 +245,7 @@ void CubeEffectConfig::defaults() m_ui->invertKeysBox->setChecked( false ); m_ui->invertMouseBox->setChecked( false ); m_ui->capDeformationSlider->setValue( 0 ); + m_ui->zOrderingBox->setChecked( false ); m_ui->editor->allDefault(); emit changed(true); } diff --git a/effects/cube/cube_config.ui b/effects/cube/cube_config.ui index 1e57a5dc81..ee9a1e4e2b 100644 --- a/effects/cube/cube_config.ui +++ b/effects/cube/cube_config.ui @@ -114,7 +114,7 @@ - + Rotation duration: @@ -127,7 +127,7 @@ - + @@ -155,7 +155,7 @@ - + Qt::Vertical @@ -168,6 +168,13 @@ + + + + Windows hover above cube + + + @@ -517,6 +524,7 @@ otherwise it will remain active tabWidget displayDesktopNameBox reflectionBox + zOrderingBox rotationDurationSpin cubeOpacitySlider cubeOpacitySpin @@ -532,6 +540,7 @@ otherwise it will remain active invertKeysBox invertMouseBox zPositionSlider + capDeformationSlider