From 7fc3bbf39ddcec23791d6c82cef3dad97a16a7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 18 Mar 2009 15:01:21 +0000 Subject: [PATCH] Drop the multi screen mode where the cube is scaled on one screen. So there is only the span cube on all screens option. The mode is dropped for the following reasons: * it looks strange * it changes the projection matrix which makes the code ugly * it never worked with cylinder or sphere * it was broken in trunk anyway svn path=/trunk/KDE/kdebase/workspace/; revision=940977 --- effects/cube/cube.cpp | 141 +++-------------------------------- effects/cube/cube.h | 2 - effects/cube/cube_config.cpp | 12 --- effects/cube/cube_config.ui | 12 --- 4 files changed, 10 insertions(+), 157 deletions(-) diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index 7016742708..e52b838408 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -75,7 +75,6 @@ CubeEffect::CubeEffect() , stop( false ) , reflectionPainting( false ) , activeScreen( 0 ) - , bigCube( false ) , bottomCap( false ) , closeOnMouseRelease( false ) , zoom( 0.0 ) @@ -125,7 +124,6 @@ void CubeEffect::loadConfig( QString config ) reflection = conf.readEntry( "Reflection", true ); rotationDuration = animationTime( conf, "RotationDuration", 500 ); backgroundColor = conf.readEntry( "BackgroundColor", QColor( Qt::black ) ); - bigCube = conf.readEntry( "BigCube", false ); capColor = conf.readEntry( "CapColor", KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); paintCaps = conf.readEntry( "Caps", true ); closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false ); @@ -255,7 +253,7 @@ bool CubeEffect::loadShader() cylinderShader->setUniform( "winTexture", 0 ); cylinderShader->setUniform( "opacity", cubeOpacity ); QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) + if( effects->numScreens() > 1 ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); cylinderShader->setUniform( "width", (float)rect.width() ); cylinderShader->unbind(); @@ -272,7 +270,7 @@ bool CubeEffect::loadShader() sphereShader->setUniform( "winTexture", 0 ); sphereShader->setUniform( "opacity", cubeOpacity ); QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) + if( effects->numScreens() > 1 ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); sphereShader->setUniform( "width", (float)rect.width() ); sphereShader->setUniform( "height", (float)rect.height() ); @@ -326,7 +324,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) } QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) + if( effects->numScreens() > 1 ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); QRect fullRect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); @@ -349,61 +347,6 @@ 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 && !bigCube ) - { - windowsOnOtherScreens.clear(); - // unfortunatelly we have to change the projection matrix in dual screen mode - glMatrixMode( GL_PROJECTION ); - glPushMatrix(); - glLoadIdentity(); - float fovy = 60.0f; - float aspect = 1.0f; - float zNear = 0.1f; - float zFar = 100.0f; - float ymax = zNear * tan( fovy * M_PI / 360.0f ); - float ymin = -ymax; - float xmin = ymin * aspect; - float xmax = ymax * aspect; - float xTranslate = 0.0; - float yTranslate = 0.0; - float xminFactor = 1.0; - float xmaxFactor = 1.0; - float yminFactor = 1.0; - float ymaxFactor = 1.0; - if( rect.x() == 0 && rect.width() != fullRect.width() ) - { - // horizontal layout: left screen - xminFactor = (float)rect.width()/(float)fullRect.width(); - xmaxFactor = ((float)fullRect.width()-(float)rect.width()*0.5f)/((float)fullRect.width()*0.5f); - xTranslate = (float)fullRect.width()*0.5f-(float)rect.width()*0.5f; - } - if( rect.x() != 0 && rect.width() != fullRect.width() ) - { - // horizontal layout: right screen - xminFactor = ((float)fullRect.width()-(float)rect.width()*0.5f)/((float)fullRect.width()*0.5f); - xmaxFactor = (float)rect.width()/(float)fullRect.width(); - xTranslate = (float)fullRect.width()*0.5f-(float)rect.width()*0.5f; - } - if( rect.y() == 0 && rect.height() != fullRect.height() ) - { - // vertical layout: top screen - yminFactor = ((float)fullRect.height()-(float)rect.height()*0.5f)/((float)fullRect.height()*0.5f); - ymaxFactor = (float)rect.height()/(float)fullRect.height(); - yTranslate = (float)fullRect.height()*0.5f-(float)rect.height()*0.5f; - } - if( rect.y() != 0 && rect.height() != fullRect.height() ) - { - // vertical layout: bottom screen - yminFactor = (float)rect.height()/(float)fullRect.height(); - ymaxFactor = ((float)fullRect.height()-(float)rect.height()*0.5f)/((float)fullRect.height()*0.5f); - yTranslate = (float)fullRect.height()*0.5f-(float)rect.height()*0.5f; - } - glFrustum( xmin*xminFactor, xmax*xmaxFactor, ymin*yminFactor, ymax*ymaxFactor, zNear, zFar ); - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); - glTranslatef( xTranslate, yTranslate, 0.0 ); - } - // some veriables needed for painting the caps float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f); float point = rect.width()/2*tan(cubeAngle*0.5f*M_PI/180.0f); @@ -502,11 +445,6 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glPopMatrix(); glPushMatrix(); - if( effects->numScreens() > 1 && rect.x() != fullRect.x() && !bigCube ) - { - // have to change the reflection area in horizontal layout and right screen - glTranslatef( -rect.x(), 0.0, 0.0 ); - } glTranslatef( rect.x() + rect.width()*0.5f, 0.0, 0.0 ); float vertices[] = { -rect.width()*0.5f, rect.height(), 0.0, @@ -632,15 +570,6 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) } glDisable( GL_CULL_FACE ); - if( effects->numScreens() > 1 && !bigCube ) - { - glPopMatrix(); - // revert change of projection matrix - glMatrixMode( GL_PROJECTION ); - glPopMatrix(); - glMatrixMode( GL_MODELVIEW ); - } - glDisable( GL_BLEND ); glPopAttrib(); @@ -659,18 +588,6 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) desktopNameFrame.setText( effects->desktopName( frontDesktop ) ); desktopNameFrame.render( region, opacity ); } - if( effects->numScreens() > 1 && !bigCube ) - { - foreach( EffectWindow* w, windowsOnOtherScreens ) - { - WindowPaintData wData( w ); - if( start && !w->isDesktop() && !w->isDock() ) - wData.opacity *= (1.0 - timeLine.value()); - if( stop && !w->isDesktop() && !w->isDock() ) - wData.opacity *= timeLine.value(); - effects->paintWindow( w, 0, QRegion( w->x(), w->y(), w->width(), w->height() ), wData ); - } - } } else { @@ -681,36 +598,8 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) void CubeEffect::rotateCube() { QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) + if( effects->numScreens() > 1 ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); - float xScale = 1.0; - float yScale = 1.0; - if( effects->numScreens() > 1 && !bigCube ) - { - QRect fullRect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); - xScale = (float)rect.width()/(float)fullRect.width(); - yScale = (float)rect.height()/(float)fullRect.height(); - if( start ) - { - xScale = xScale + (1.0 - xScale) * (1.0 - timeLine.value()); - yScale = yScale + (1.0 - yScale) * (1.0 - timeLine.value()); - if( rect.x() > 0 ) - glTranslatef( -rect.x()*(1.0 - timeLine.value()), 0.0, 0.0 ); - if( rect.y() > 0 ) - glTranslatef( 0.0, -rect.y()*(1.0 - timeLine.value()), 0.0 ); - } - if( stop ) - { - xScale = xScale + (1.0 - xScale) * timeLine.value(); - yScale = yScale + (1.0 - yScale) * timeLine.value(); - if( rect.x() > 0 ) - glTranslatef( -rect.x()*timeLine.value(), 0.0, 0.0 ); - if( rect.y() > 0 ) - glTranslatef( 0.0, -rect.y()*timeLine.value(), 0.0 ); - } - glScalef( xScale, yScale, 1.0 ); - rect = fullRect; - } float internalCubeAngle = 360.0f / effects->numberOfDesktops(); float zTranslate = zPosition + zoom; @@ -840,7 +729,7 @@ void CubeEffect::rotateCube() void CubeEffect::paintCube( int mask, QRegion region, ScreenPaintData& data ) { QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) + if( effects->numScreens() > 1 ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); float internalCubeAngle = 360.0f / effects->numberOfDesktops(); cube_painting = true; @@ -910,7 +799,7 @@ void CubeEffect::paintCap() void CubeEffect::paintCubeCap() { QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) + if( effects->numScreens() > 1 ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f); float z = rect.width()/2*tan(cubeAngle*0.5f*M_PI/180.0f); @@ -1026,7 +915,7 @@ void CubeEffect::paintCubeCap() void CubeEffect::paintCylinderCap() { QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) + if( effects->numScreens() > 1 ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f); @@ -1066,7 +955,7 @@ void CubeEffect::paintCylinderCap() void CubeEffect::paintSphereCap() { QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) + if( effects->numScreens() > 1 ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); float cubeAngle = (float)((float)(effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f); float zTexture = rect.width()/2*tan(45.0f*M_PI/180.0f); @@ -1177,7 +1066,6 @@ void CubeEffect::postPaintScreen() effects->ungrabKeyboard(); keyboard_grab = false; effects->destroyInputWindow( input ); - windowsOnOtherScreens.clear(); effects->setActiveFullScreenEffect( 0 ); @@ -1293,15 +1181,6 @@ void CubeEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int else data.quads = data.quads.makeGrid( 250 ); } - if( ( w->isDesktop() || w->isDock() ) && w->screen() != activeScreen && w->isOnDesktop( effects->currentDesktop() ) ) - { - windowsOnOtherScreens.append( w ); - } - if( (start || stop) && w->screen() != activeScreen && w->isOnDesktop( effects->currentDesktop() ) - && !w->isDesktop() && !w->isDock() ) - { - windowsOnOtherScreens.append( w ); - } if( w->isOnDesktop( painting_desktop )) { QRect rect = effects->clientArea( FullArea, activeScreen, painting_desktop ); @@ -2025,7 +1904,7 @@ 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 ) + if( effects->numScreens() > 1 ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); glTranslatef( 0.0, rect.height(), 0.0 ); glClipPlane( GL_CLIP_PLANE0, eqn ); @@ -2065,7 +1944,7 @@ void CubeEffect::mouseChanged( const QPoint& pos, const QPoint& oldpos, Qt::Mous if( stop ) return; QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) + if( effects->numScreens() > 1 ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); if( buttons.testFlag( Qt::LeftButton ) ) { diff --git a/effects/cube/cube.h b/effects/cube/cube.h index 7acdb0cc82..d1ca512ea5 100644 --- a/effects/cube/cube.h +++ b/effects/cube/cube.h @@ -128,9 +128,7 @@ class CubeEffect bool stop; bool reflectionPainting; int rotationDuration; - QList windowsOnOtherScreens; int activeScreen; - bool bigCube; bool bottomCap; bool closeOnMouseRelease; float zoom; diff --git a/effects/cube/cube_config.cpp b/effects/cube/cube_config.cpp index d74d5b4007..bf8cdbeda5 100644 --- a/effects/cube/cube_config.cpp +++ b/effects/cube/cube_config.cpp @@ -82,7 +82,6 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) : 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())); - 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())); @@ -114,7 +113,6 @@ void CubeEffectConfig::load() QColor capColor = conf.readEntry( "CapColor", KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); bool texturedCaps = conf.readEntry( "TexturedCaps", true ); bool caps = conf.readEntry( "Caps", true ); - bool bigCube = conf.readEntry( "BigCube", false ); bool closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false ); bool walkThroughDesktop = conf.readEntry( "TabBox", false ); m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 100 ) ); @@ -160,14 +158,6 @@ void CubeEffectConfig::load() { m_ui->capsImageBox->setCheckState( Qt::Unchecked ); } - if( bigCube ) - { - m_ui->bigCubeBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->bigCubeBox->setCheckState( Qt::Unchecked ); - } if( closeOnMouseRelease ) { m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Checked ); @@ -207,7 +197,6 @@ void CubeEffectConfig::save() conf.writeEntry( "Caps", m_ui->cubeCapsBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "CapColor", m_ui->capColorButton->color() ); conf.writeEntry( "TexturedCaps", m_ui->capsImageBox->checkState() == Qt::Checked ? true : false ); - conf.writeEntry( "BigCube", m_ui->bigCubeBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "CloseOnMouseRelease", m_ui->closeOnMouseReleaseBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "Wallpaper", m_ui->wallpaperRequester->url().path() ); conf.writeEntry( "ZPosition", m_ui->zPositionSlider->value() ); @@ -237,7 +226,6 @@ void CubeEffectConfig::defaults() m_ui->cubeCapsBox->setCheckState( Qt::Checked ); m_ui->capColorButton->setColor( KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); m_ui->capsImageBox->setCheckState( Qt::Checked ); - m_ui->bigCubeBox->setCheckState( Qt::Unchecked ); m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked ); m_ui->wallpaperRequester->setPath( "" ); m_ui->zPositionSlider->setValue( 100 ); diff --git a/effects/cube/cube_config.ui b/effects/cube/cube_config.ui index ee9a1e4e2b..a2747e586f 100644 --- a/effects/cube/cube_config.ui +++ b/effects/cube/cube_config.ui @@ -407,17 +407,6 @@ Additional Options - - - - If enabled span the cube across all screens on a multiscreen setup, otherwise -the cube will only be displayed on a single screen - - - Span cube on all screens in multi screen setup - - - @@ -534,7 +523,6 @@ otherwise it will remain active cubeCapsBox capColorButton capsImageBox - bigCubeBox closeOnMouseReleaseBox walkThroughDesktopBox invertKeysBox