From 39fd589c4de65a8d774df49e9007fb6f39348879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 6 Aug 2008 12:05:30 +0000 Subject: [PATCH] Bring back optional one big cube for multi monitor setup. One big cube is used for desktop changed but not the default for ctrl+f11 mode. BUG: 168404 svn path=/trunk/KDE/kdebase/workspace/; revision=843084 --- effects/cube.cpp | 20 +++++++++++++++----- effects/cube.h | 1 + effects/cube_config.cpp | 12 ++++++++++++ effects/cube_config.ui | 9 ++++++++- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/effects/cube.cpp b/effects/cube.cpp index 94023e29a6..fb21816260 100644 --- a/effects/cube.cpp +++ b/effects/cube.cpp @@ -71,6 +71,7 @@ CubeEffect::CubeEffect() , oldDesktop( 0 ) , activeScreen( 0 ) , animateDesktopChange( false ) + , bigCube( false ) { KConfigGroup conf = effects->effectConfig( "Cube" ); borderActivate = (ElectricBorder)conf.readEntry( "BorderActivate", (int)ElectricNone ); @@ -82,6 +83,7 @@ CubeEffect::CubeEffect() rotationDuration = conf.readEntry( "RotationDuration", 500 ); backgroundColor = conf.readEntry( "BackgroundColor", QColor( Qt::black ) ); animateDesktopChange = conf.readEntry( "AnimateDesktopChange", false ); + bigCube = conf.readEntry( "BigCube", false ); capColor = conf.readEntry( "CapColor", KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); paintCaps = conf.readEntry( "Caps", true ); QString file = conf.readEntry( "Wallpaper", QString("") ); @@ -176,6 +178,8 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) { //kDebug(); QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); + if( effects->numScreens() > 1 && (slide || bigCube ) ) + rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); QRect fullRect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); // background @@ -197,7 +201,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); - if( effects->numScreens() > 1 ) + if( effects->numScreens() > 1 && !slide && !bigCube ) { windowsOnOtherScreens.clear(); // unfortunatelly we have to change the projection matrix in dual screen mode @@ -269,7 +273,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glPopMatrix(); glPushMatrix(); glTranslatef( 0.0, rect.height(), 0.0 ); - if( effects->numScreens() > 1 && rect.width() != fullRect.width() ) + if( effects->numScreens() > 1 && rect.width() != fullRect.width() && !slide && !bigCube ) { // have to change the reflection area in horizontal layout and right screen glTranslatef( -rect.width(), 0.0, 0.0 ); @@ -301,7 +305,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) paintScene( mask, region, data ); glPopMatrix(); - if( effects->numScreens() > 1 ) + if( effects->numScreens() > 1 && !slide && !bigCube ) { glPopMatrix(); // revert change of projection matrix @@ -352,7 +356,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) { effects->paintScreen( mask, region, data ); } - if( effects->numScreens() > 1 ) + if( effects->numScreens() > 1 && !slide && !bigCube ) { foreach( EffectWindow* w, windowsOnOtherScreens ) { @@ -374,9 +378,11 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) void CubeEffect::paintScene( int mask, QRegion region, ScreenPaintData& data ) { QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); + if( effects->numScreens() > 1 && (slide || bigCube ) ) + rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); float xScale = 1.0; float yScale = 1.0; - if( effects->numScreens() > 1 ) + if( effects->numScreens() > 1 && !slide && !bigCube ) { QRect fullRect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); xScale = (float)rect.width()/(float)fullRect.width(); @@ -1483,6 +1489,8 @@ void CubeEffect::setActive( bool active ) double eqn[4] = {0.0, 1.0, 0.0, 0.0}; glPushMatrix(); QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); + if( effects->numScreens() > 1 && bigCube ) + rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); glTranslatef( 0.0, rect.height(), 0.0 ); glClipPlane( GL_CLIP_PLANE0, eqn ); glPopMatrix(); @@ -1505,6 +1513,8 @@ void CubeEffect::mouseChanged( const QPoint& pos, const QPoint& oldpos, Qt::Mous if( stop || slide ) return; QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); + if( effects->numScreens() > 1 && (slide || bigCube ) ) + rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); if( buttons.testFlag( Qt::LeftButton ) ) { bool repaint = false; diff --git a/effects/cube.h b/effects/cube.h index 542d29d6d2..e98f6cc464 100644 --- a/effects/cube.h +++ b/effects/cube.h @@ -106,6 +106,7 @@ class CubeEffect QList windowsOnOtherScreens; int activeScreen; bool animateDesktopChange; + bool bigCube; }; } // namespace diff --git a/effects/cube_config.cpp b/effects/cube_config.cpp index f04c31027f..59667ae274 100644 --- a/effects/cube_config.cpp +++ b/effects/cube_config.cpp @@ -77,6 +77,7 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) : connect(m_ui->reflectionBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->backgroundColorButton, SIGNAL(changed(QColor)), this, SLOT(changed())); connect(m_ui->animateDesktopChangeBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); + connect(m_ui->bigCubeBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged())); connect(m_ui->capsImageBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); @@ -101,6 +102,7 @@ void CubeEffectConfig::load() bool texturedCaps = conf.readEntry( "TexturedCaps", true ); bool caps = conf.readEntry( "Caps", true ); bool animateChange = conf.readEntry( "AnimateDesktopChange", false ); + bool bigCube = conf.readEntry( "BigCube", false ); if( activateBorder == (int)ElectricNone ) activateBorder--; m_ui->screenEdgeCombo->setCurrentIndex( activateBorder ); @@ -148,6 +150,14 @@ void CubeEffectConfig::load() { m_ui->animateDesktopChangeBox->setCheckState( Qt::Unchecked ); } + if( bigCube ) + { + m_ui->bigCubeBox->setCheckState( Qt::Checked ); + } + else + { + m_ui->bigCubeBox->setCheckState( Qt::Unchecked ); + } m_ui->backgroundColorButton->setColor( background ); m_ui->capColorButton->setColor( capColor ); capsSelectionChanged(); @@ -168,6 +178,7 @@ void CubeEffectConfig::save() conf.writeEntry( "CapColor", m_ui->capColorButton->color() ); conf.writeEntry( "TexturedCaps", m_ui->capsImageBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "AnimateDesktopChange", m_ui->animateDesktopChangeBox->checkState() == Qt::Checked ? true : false ); + conf.writeEntry( "BigCube", m_ui->bigCubeBox->checkState() == Qt::Checked ? true : false ); int activateBorder = m_ui->screenEdgeCombo->currentIndex(); if( activateBorder == (int)ELECTRIC_COUNT ) @@ -195,6 +206,7 @@ void CubeEffectConfig::defaults() m_ui->capColorButton->setColor( KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); m_ui->capsImageBox->setCheckState( Qt::Checked ); m_ui->animateDesktopChangeBox->setCheckState( Qt::Unchecked ); + m_ui->bigCubeBox->setCheckState( Qt::Unchecked ); m_ui->editor->allDefault(); emit changed(true); } diff --git a/effects/cube_config.ui b/effects/cube_config.ui index dc9d24dc13..b46fc433d6 100644 --- a/effects/cube_config.ui +++ b/effects/cube_config.ui @@ -6,7 +6,7 @@ 0 0 400 - 433 + 438 @@ -193,6 +193,13 @@ + + + + S&pan cube on all screens + + +