From 4fa09b63b490cd85b483a2b9f50455ea7df05cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 14 Feb 2009 09:29:01 +0000 Subject: [PATCH] Sphere and Cylinder become part of Cube effect. That is much more convenient than having an own effect for each (only loading the shader is actually required). Btw caps of cylinder and sphere are working correctly again. svn path=/trunk/KDE/kdebase/workspace/; revision=925809 --- effects/configs_builtins.cpp | 4 - effects/cube/CMakeLists.txt | 11 - effects/cube/cube.cpp | 424 ++++++++++++++++---- effects/cube/cube.h | 31 +- effects/cube/cube_config.cpp | 22 +- effects/cube/cube_config.ui | 42 ++ effects/cube/cylinder.cpp | 215 ---------- effects/cube/cylinder.desktop | 126 ------ effects/cube/cylinder.h | 53 --- effects/cube/cylinder_config.cpp | 246 ------------ effects/cube/cylinder_config.desktop | 66 ---- effects/cube/cylinder_config.h | 60 --- effects/cube/cylinder_config.ui | 517 ------------------------- effects/cube/data/cylinder.frag | 10 + effects/cube/sphere.cpp | 209 ---------- effects/cube/sphere.desktop | 122 ------ effects/cube/sphere.h | 54 --- effects/cube/sphere_config.cpp | 242 ------------ effects/cube/sphere_config.desktop | 62 --- effects/cube/sphere_config.h | 60 --- effects/cube/sphere_config.ui | 560 --------------------------- kcmkwin/kwincompositing/main.cpp | 28 +- 22 files changed, 453 insertions(+), 2711 deletions(-) delete mode 100644 effects/cube/cylinder.cpp delete mode 100644 effects/cube/cylinder.desktop delete mode 100644 effects/cube/cylinder.h delete mode 100644 effects/cube/cylinder_config.cpp delete mode 100644 effects/cube/cylinder_config.desktop delete mode 100644 effects/cube/cylinder_config.h delete mode 100644 effects/cube/cylinder_config.ui delete mode 100644 effects/cube/sphere.cpp delete mode 100644 effects/cube/sphere.desktop delete mode 100644 effects/cube/sphere.h delete mode 100644 effects/cube/sphere_config.cpp delete mode 100644 effects/cube/sphere_config.desktop delete mode 100644 effects/cube/sphere_config.h delete mode 100644 effects/cube/sphere_config.ui diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index 2489dd618f..ee57035e17 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -37,8 +37,6 @@ along with this program. If not, see . #include "coverswitch/coverswitch_config.h" #include "cube/cube_config.h" #include "cube/cubeslide_config.h" -#include "cube/cylinder_config.h" -#include "cube/sphere_config.h" #include "flipswitch/flipswitch_config.h" #include "invert/invert_config.h" #include "lookingglass/lookingglass_config.h" @@ -73,8 +71,6 @@ KWIN_EFFECT_CONFIG_MULTIPLE( builtins, KWIN_EFFECT_CONFIG_SINGLE( coverswitch, CoverSwitchEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( cube, CubeEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( cubeslide, CubeSlideEffectConfig ) - KWIN_EFFECT_CONFIG_SINGLE( cylinder, CylinderEffectConfig ) - KWIN_EFFECT_CONFIG_SINGLE( sphere, SphereEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( flipswitch, FlipSwitchEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( invert, InvertEffectConfig ) KWIN_EFFECT_CONFIG_SINGLE( lookingglass, LookingGlassEffectConfig ) diff --git a/effects/cube/CMakeLists.txt b/effects/cube/CMakeLists.txt index 2fb887cf20..aca1963470 100644 --- a/effects/cube/CMakeLists.txt +++ b/effects/cube/CMakeLists.txt @@ -5,16 +5,12 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} cube/cube.cpp cube/cubeslide.cpp - cube/cylinder.cpp - cube/sphere.cpp ) # .desktop files install( FILES cube/cube.desktop cube/cubeslide.desktop - cube/cylinder.desktop - cube/sphere.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) # Data files @@ -34,16 +30,9 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources cube/cube_config.ui cube/cubeslide_config.cpp cube/cubeslide_config.ui - cube/cylinder_config.cpp - cube/cylinder_config.ui - cube/sphere_config.cpp - cube/sphere_config.ui ) # .desktop files install( FILES cube/cube_config.desktop - cube/cubeslide_config.desktop - cube/cylinder_config.desktop - cube/sphere_config.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index c1ceb5218c..93ade8ab9c 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -51,6 +51,8 @@ CubeEffect::CubeEffect() , keyboard_grab( false ) , schedule_close( false ) , borderActivate( ElectricNone ) + , borderActivateCylinder( ElectricNone ) + , borderActivateSphere( ElectricNone ) , frontDesktop( 0 ) , cubeOpacity( 1.0 ) , opacityDesktopOnly( true ) @@ -80,6 +82,10 @@ CubeEffect::CubeEffect() , useForTabBox( false ) , tabBoxMode( false ) , shortcutsRegistered( false ) + , mode( Cube ) + , useShaders( false ) + , cylinderShader( 0 ) + , sphereShader( 0 ) , capListCreated( false ) , recompileList( true ) , glList( 0 ) @@ -100,9 +106,12 @@ void CubeEffect::reconfigure( ReconfigureFlags ) void CubeEffect::loadConfig( QString config ) { KConfigGroup conf = effects->effectConfig( config ); - effects->unreserveElectricBorder( borderActivate ); borderActivate = (ElectricBorder)conf.readEntry( "BorderActivate", (int)ElectricNone ); + borderActivateCylinder = (ElectricBorder)conf.readEntry( "BorderActivateCylinder", (int)ElectricNone ); + borderActivateSphere = (ElectricBorder)conf.readEntry( "BorderActivateSphere", (int)ElectricNone ); effects->reserveElectricBorder( borderActivate ); + effects->reserveElectricBorder( borderActivateCylinder ); + effects->reserveElectricBorder( borderActivateSphere ); cubeOpacity = (float)conf.readEntry( "Opacity", 80 )/100.0f; opacityDesktopOnly = conf.readEntry( "OpacityDesktopOnly", false ); @@ -111,16 +120,6 @@ void CubeEffect::loadConfig( QString config ) rotationDuration = animationTime( conf, "RotationDuration", 500 ); backgroundColor = conf.readEntry( "BackgroundColor", QColor( Qt::black ) ); bigCube = conf.readEntry( "BigCube", false ); - // different settings for cylinder and sphere - if( config == "Cylinder" ) - { - bigCube = true; - } - if( config == "Sphere" ) - { - bigCube = true; - reflection = false; - } capColor = conf.readEntry( "CapColor", KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); paintCaps = conf.readEntry( "Caps", true ); closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false ); @@ -131,6 +130,7 @@ void CubeEffect::loadConfig( QString config ) useForTabBox = conf.readEntry( "TabBox", false ); invertKeys = conf.readEntry( "InvertKeys", false ); invertMouse = conf.readEntry( "InvertMouse", false ); + capDeformationFactor = conf.readEntry( "CapDeformation", 0 )/100.0f; QString file = conf.readEntry( "Wallpaper", QString("") ); if( wallpaper ) wallpaper->discard(); @@ -192,29 +192,21 @@ void CubeEffect::loadConfig( QString config ) verticalTimeLine.setDuration( rotationDuration ); // do not connect the shortcut if we use cylinder or sphere - KActionCollection* actionCollection = new KActionCollection( this ); - if( config == "Cube" && !shortcutsRegistered ) + if( !shortcutsRegistered ) { - KAction* a = static_cast< KAction* >( actionCollection->addAction( "Cube" )); - a->setText( i18n("Desktop Cube" )); - a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 )); - connect( a, SIGNAL( triggered( bool )), this, SLOT( toggle())); - shortcutsRegistered = true; - } - if( config == "Cylinder" && !shortcutsRegistered ) - { - KAction* a = static_cast< KAction* >( actionCollection->addAction( "Cylinder" )); - a->setText( i18n("Desktop Cylinder" )); - a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 )); - connect( a, SIGNAL( triggered( bool )), this, SLOT( toggle())); - shortcutsRegistered = true; - } - if( config == "Sphere" && !shortcutsRegistered ) - { - KAction* a = static_cast< KAction* >( actionCollection->addAction( "Sphere" )); - a->setText( i18n("Desktop Sphere" )); - a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F11 )); - connect( a, SIGNAL( triggered( bool )), this, SLOT( toggle())); + KActionCollection* actionCollection = new KActionCollection( this ); + KAction* cubeAction = static_cast< KAction* >( actionCollection->addAction( "Cube" )); + cubeAction->setText( i18n("Desktop Cube" )); + cubeAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 )); + KAction* cylinderAction = static_cast< KAction* >( actionCollection->addAction( "Cylinder" )); + cylinderAction->setText( i18n("Desktop Cylinder" )); + cylinderAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 )); + KAction* sphereAction = static_cast< KAction* >( actionCollection->addAction( "Sphere" )); + sphereAction->setText( i18n("Desktop Sphere" )); + sphereAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F11 )); + connect( cubeAction, SIGNAL( triggered( bool )), this, SLOT( toggleCube())); + connect( cylinderAction, SIGNAL( triggered( bool )), this, SLOT( toggleCylinder())); + connect( sphereAction, SIGNAL( triggered( bool )), this, SLOT( toggleSphere())); shortcutsRegistered = true; } } @@ -222,8 +214,64 @@ void CubeEffect::loadConfig( QString config ) CubeEffect::~CubeEffect() { effects->unreserveElectricBorder( borderActivate ); + effects->unreserveElectricBorder( borderActivateCylinder ); + effects->unreserveElectricBorder( borderActivateSphere ); delete wallpaper; delete capTexture; + delete cylinderShader; + delete sphereShader; + } + +bool CubeEffect::loadShader() + { + if( !(GLShader::fragmentShaderSupported() && + (effects->compositingType() == OpenGLCompositing))) + return false; + QString fragmentshader = KGlobal::dirs()->findResource( "data", "kwin/cylinder.frag" ); + QString cylinderVertexshader = KGlobal::dirs()->findResource( "data", "kwin/cylinder.vert" ); + QString sphereVertexshader = KGlobal::dirs()->findResource( "data", "kwin/sphere.vert" ); + if( fragmentshader.isEmpty() || cylinderVertexshader.isEmpty() || sphereVertexshader.isEmpty() ) + { + kError(1212) << "Couldn't locate shader files" << endl; + return false; + } + + cylinderShader = new GLShader(cylinderVertexshader, fragmentshader); + if( !cylinderShader->isValid() ) + { + kError(1212) << "The cylinder shader failed to load!" << endl; + return false; + } + else + { + cylinderShader->bind(); + cylinderShader->setUniform( "winTexture", 0 ); + cylinderShader->setUniform( "opacity", cubeOpacity ); + QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); + if( effects->numScreens() > 1 && bigCube ) + rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); + cylinderShader->setUniform( "width", (float)rect.width() ); + cylinderShader->unbind(); + } + sphereShader = new GLShader( sphereVertexshader, fragmentshader ); + if( !sphereShader->isValid() ) + { + kError(1212) << "The sphere shader failed to load!" << endl; + return false; + } + else + { + sphereShader->bind(); + sphereShader->setUniform( "winTexture", 0 ); + sphereShader->setUniform( "opacity", cubeOpacity ); + QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); + if( effects->numScreens() > 1 && bigCube ) + rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); + sphereShader->setUniform( "width", (float)rect.width() ); + sphereShader->setUniform( "height", (float)rect.height() ); + sphereShader->unbind(); + } + return true; } void CubeEffect::prePaintScreen( ScreenPrePaintData& data, int time ) @@ -355,7 +403,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) if( stop ) zTranslate *= ( 1.0 - timeLine.value() ); // reflection - if( reflection ) + if( reflection && mode != Sphere ) { // restrict painting the reflections to the current screen PaintClipper::push( QRegion( rect )); @@ -387,11 +435,23 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) // cube glCullFace( GL_FRONT ); + if( mode == Cylinder ) + { + cylinderShader->bind(); + cylinderShader->setUniform( "front", 1.0f ); + cylinderShader->unbind(); + } glPushMatrix(); glCallList( glList ); glCallList( glList + 1 ); glPopMatrix(); glCullFace( GL_BACK ); + if( mode == Cylinder ) + { + cylinderShader->bind(); + cylinderShader->setUniform( "front", -1.0f ); + cylinderShader->unbind(); + } glPushMatrix(); glCallList( glList ); glCallList( glList + 1 ); @@ -458,7 +518,14 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glRotatef( (1-frontDesktop)*360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0 ); glTranslatef( 0.0, rect.height(), 0.0 ); glCullFace( GL_BACK ); + if( mode == Sphere ) + { + glPushMatrix(); + glScalef( 1.0, -1.0, 1.0 ); + } glCallList( glList + 2 ); + if( mode == Sphere ) + glPopMatrix(); glTranslatef( 0.0, -rect.height(), 0.0 ); glCullFace( GL_FRONT ); glCallList( glList + 2 ); @@ -467,11 +534,35 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) // cube glCullFace( GL_BACK ); + if( mode == Cylinder ) + { + cylinderShader->bind(); + cylinderShader->setUniform( "front", -1.0f ); + cylinderShader->unbind(); + } + if( mode == Sphere ) + { + sphereShader->bind(); + sphereShader->setUniform( "front", -1.0f ); + sphereShader->unbind(); + } glPushMatrix(); glCallList( glList ); glCallList( glList + 1 ); glPopMatrix(); glCullFace( GL_FRONT ); + if( mode == Cylinder ) + { + cylinderShader->bind(); + cylinderShader->setUniform( "front", 1.0f ); + cylinderShader->unbind(); + } + if( mode == Sphere ) + { + sphereShader->bind(); + sphereShader->setUniform( "front", 1.0f ); + sphereShader->unbind(); + } glPushMatrix(); glCallList( glList ); glCallList( glList + 1 ); @@ -486,7 +577,14 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glRotatef( (1-frontDesktop)*360.0f / effects->numberOfDesktops(), 0.0, 1.0, 0.0 ); glTranslatef( 0.0, rect.height(), 0.0 ); glCullFace( GL_FRONT ); + if( mode == Sphere ) + { + glPushMatrix(); + glScalef( 1.0, -1.0, 1.0 ); + } glCallList( glList + 2 ); + if( mode == Sphere ) + glPopMatrix(); glTranslatef( 0.0, -rect.height(), 0.0 ); glCullFace( GL_BACK ); glCallList( glList + 2 ); @@ -758,48 +856,47 @@ void CubeEffect::paintCube( int mask, QRegion region, ScreenPaintData& data ) painting_desktop = effects->currentDesktop(); } -void CubeEffect::paintCap( float z, float zTexture ) +void CubeEffect::paintCap() { - QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop()); if( ( !paintCaps ) || effects->numberOfDesktops() <= 2 ) return; - float opacity = cubeOpacity; - if( start ) - opacity = 1.0 - (1.0 - opacity)*timeLine.value(); - if( stop ) - opacity = 1.0 - (1.0 - opacity)*( 1.0 - timeLine.value() ); - glColor4f( capColor.redF(), capColor.greenF(), capColor.blueF(), opacity ); - float angle = 360.0f/effects->numberOfDesktops(); - glPushMatrix(); - float zTranslate = zPosition + zoom; - if( start ) - zTranslate *= timeLine.value(); - if( stop ) - zTranslate *= ( 1.0 - timeLine.value() ); - glTranslatef( rect.width()/2, 0.0, -z-zTranslate ); - glRotatef( (1-frontDesktop)*angle, 0.0, 1.0, 0.0 ); if( !capListCreated ) { capListCreated = true; glNewList( glList + 2, GL_COMPILE ); - if( texturedCaps && effects->numberOfDesktops() > 3 && capTexture ) + glColor4f( capColor.redF(), capColor.greenF(), capColor.blueF(), cubeOpacity ); + glPushMatrix(); + switch( mode ) { - paintCapStep( z, zTexture, true ); + case Cube: + paintCubeCap(); + break; + case Cylinder: + paintCylinderCap(); + break; + case Sphere: + paintSphereCap(); + break; + default: + // impossible + break; } - else - paintCapStep( z, zTexture, false ); + glPopMatrix(); glEndList(); } - else - glCallList( glList + 2 ); - glPopMatrix(); } -void CubeEffect::paintCapStep( float z, float zTexture, bool texture ) +void CubeEffect::paintCubeCap() { - QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop()); + QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); + if( effects->numScreens() > 1 && bigCube ) + 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); + float zTexture = rect.width()/2*tan(45.0f*M_PI/180.0f); float angle = 360.0f/effects->numberOfDesktops(); + bool texture = texturedCaps && effects->numberOfDesktops() > 3 && capTexture; if( texture ) capTexture->bind(); for( int i=0; inumberOfDesktops(); i++ ) @@ -906,6 +1003,117 @@ void CubeEffect::paintCapStep( float z, float zTexture, bool texture ) } } +void CubeEffect::paintCylinderCap() + { + QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); + if( effects->numScreens() > 1 && bigCube ) + 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); + glPushMatrix(); + paintCubeCap(); + glPopMatrix(); + + float radian = (cubeAngle*0.5)*M_PI/180; + // height of the triangle compound of one side of the cube and the two bisecting lines + float midpoint = rect.width()*0.5*tan(radian); + // radius of the circle + float radius = (rect.width()*0.5)/cos(radian); + + // paint round part of the cap + glPushMatrix(); + glTranslatef( -rect.width()*0.5, 0.0, z ); + float triangleWidth = 40.0; + + for( int i=0; inumberOfDesktops(); i++ ) + { + glPushMatrix(); + glTranslatef( rect.width()/2, 0.0, -z ); + glRotatef( i*(360.0f/effects->numberOfDesktops()), 0.0, 1.0, 0.0 ); + glTranslatef( -rect.width()/2, 0.0, z ); + glBegin( GL_TRIANGLE_STRIP ); + for( int j=0; j see comments + float distance = rect.width()*0.5 - (j*triangleWidth); + if( (j*triangleWidth) > rect.width()*0.5 ) + { + distance = (j*triangleWidth) - rect.width()*0.5; + } + // distance in correct format + float angle = acos( distance/radius ); + float h = radius; + // if distance == 0 -> angle=90 -> tan(90) singularity + if( distance != 0.0 ) + h = tan( angle ) * distance; + zValue = h - midpoint; + glVertex3f( (j+1)*triangleWidth, 0.0, 0.0 ); + glVertex3f( j*triangleWidth, 0.0, zValue ); + } + glEnd(); + glPopMatrix(); + } + glPopMatrix(); + } + +void CubeEffect::paintSphereCap() + { + QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); + if( effects->numScreens() > 1 && bigCube ) + 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); + float radius = (rect.width()*0.5)/cos(cubeAngle*0.5*M_PI/180.0); + float angle = acos( (rect.height()*0.5)/radius )*180.0/M_PI; + angle /= 30; + bool texture = texturedCaps && effects->numberOfDesktops() > 3 && capTexture; + if( texture ) + capTexture->bind(); + glPushMatrix(); + glTranslatef( 0.0, -rect.height()*0.5, 0.0 ); + glBegin( GL_QUADS ); + for( int i=0; i<30; i++ ) + { + float topAngle = angle*i*M_PI/180.0; + float bottomAngle = angle*(i+1)*M_PI/180.0; + float yTop = rect.height() - radius * cos( topAngle ); + yTop -= (yTop-rect.height()*0.5)*capDeformationFactor; + float yBottom = rect.height() -radius * cos( bottomAngle ); + yBottom -= (yBottom-rect.height()*0.5)*capDeformationFactor; + for( int j=0; j<36; j++ ) + { + float x = radius * sin( topAngle ) * sin( (90.0+j*10.0)*M_PI/180.0 ); + float z = radius * sin( topAngle ) * cos( (90.0+j*10.0)*M_PI/180.0 ); + if( texture ) + glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 ); + glVertex3f( x, yTop, z ); + x = radius * sin( bottomAngle ) * sin( (90.0+j*10.0)*M_PI/180.00 ); + z = radius * sin( bottomAngle ) * cos( (90.0+j*10.0)*M_PI/180.0 ); + if( texture ) + glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 ); + glVertex3f( x, yBottom, z ); + x = radius * sin( bottomAngle ) * sin( (90.0+(j+1)*10.0)*M_PI/180.0 ); + z = radius * sin( bottomAngle ) * cos( (90.0+(j+1)*10.0)*M_PI/180.0 ); + if( texture ) + glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 ); + glVertex3f( x, yBottom, z ); + x = radius * sin( topAngle ) * sin( (90.0+(j+1)*10.0)*M_PI/180.0 ); + z = radius * sin( topAngle ) * cos( (90.0+(j+1)*10.0)*M_PI/180.0 ); + if( texture ) + glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 ); + glVertex3f( x, yTop, z ); + } + } + glEnd(); + glPopMatrix(); + if( texture ) + { + capTexture->unbind(); + } + } + void CubeEffect::postPaintScreen() { effects->postPaintScreen(); @@ -1065,6 +1273,8 @@ void CubeEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int { if( cube_painting ) { + if( mode == Cylinder || mode == Sphere ) + data.quads = data.quads.makeGrid( 40 ); if( ( w->isDesktop() || w->isDock() ) && w->screen() != activeScreen && w->isOnDesktop( effects->currentDesktop() ) ) { windowsOnOtherScreens.append( w ); @@ -1156,6 +1366,25 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP { if( activated && cube_painting ) { + if( mode == Cylinder ) + { + cylinderShader->bind(); + cylinderShader->setUniform( "windowWidth", (float)w->width() ); + cylinderShader->setUniform( "windowHeight", (float)w->height() ); + cylinderShader->setUniform( "xCoord", (float)w->x() ); + cylinderShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f ); + data.shader = cylinderShader; + } + if( mode == Sphere ) + { + sphereShader->bind(); + sphereShader->setUniform( "windowWidth", (float)w->width() ); + sphereShader->setUniform( "windowHeight", (float)w->height() ); + sphereShader->setUniform( "xCoord", (float)w->x() ); + sphereShader->setUniform( "yCoord", (float)w->y() ); + sphereShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f ); + data.shader = sphereShader; + } //kDebug(1212) << w->caption(); float opacity = cubeOpacity; if( start ) @@ -1319,26 +1548,82 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP } } effects->paintWindow( w, mask, region, data ); + if( activated && cube_painting ) + { + if( mode == Cylinder ) + cylinderShader->unbind(); + if( mode == Sphere ) + sphereShader->unbind(); + } } bool CubeEffect::borderActivated( ElectricBorder border ) { - if( border != borderActivate ) + if( border != borderActivate && border != borderActivateCylinder && border != borderActivateSphere ) return false; if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this ) - return true; + return false; kDebug(1212) << "border activated"; - toggle(); + if( border == borderActivate ) + { + if( !activated || ( activated && mode == Cube ) ) + toggleCube(); + else + return false; + } + if( border == borderActivateCylinder ) + { + if( !activated || ( activated && mode == Cylinder ) ) + toggleCylinder(); + else + return false; + } + if( border == borderActivateSphere ) + { + if( !activated || ( activated && mode == Sphere ) ) + toggleSphere(); + else + return false; + } return true; } -void CubeEffect::toggle() +void CubeEffect::toggleCube() + { + kDebug(1212) << "toggle cube"; + toggle( Cube ); + } + +void CubeEffect::toggleCylinder() + { + kDebug(1212) << "toggle cylinder"; + if( !useShaders ) + useShaders = loadShader(); + if( useShaders ) + toggle( Cylinder ); + else + kError( 1212 ) << "Sorry shaders are not available - cannot activate Cylinder"; + } + +void CubeEffect::toggleSphere() + { + kDebug(1212) << "toggle sphere"; + if( !useShaders ) + useShaders = loadShader(); + if( useShaders ) + toggle( Sphere ); + else + kError( 1212 ) << "Sorry shaders are not available - cannot activate Sphere"; + } + +void CubeEffect::toggle( CubeMode newMode ) { if( ( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this ) || effects->numberOfDesktops() < 2 ) return; if( !activated ) { + mode = newMode; setActive( true ); } else @@ -1653,16 +1938,7 @@ void CubeEffect::setActive( bool active ) recompileList = true; // create the capList if( paintCaps ) - { - QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) - rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); - 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); - float zTexture = rect.width()/2*tan(45.0f*M_PI/180.0f); - paintCap( point, zTexture ); - } - + paintCap(); effects->addRepaintFull(); } else diff --git a/effects/cube/cube.h b/effects/cube/cube.h index 1f4a62c2ca..240d1bebb2 100644 --- a/effects/cube/cube.h +++ b/effects/cube/cube.h @@ -53,9 +53,11 @@ class CubeEffect virtual void tabBoxClosed(); static bool supported(); - protected slots: - void toggle(); - protected: + private slots: + void toggleCube(); + void toggleCylinder(); + void toggleSphere(); + private: enum RotationDirection { Left, @@ -69,9 +71,19 @@ class CubeEffect Normal, Down }; - virtual void paintCube( int mask, QRegion region, ScreenPaintData& data ); - virtual void paintCap( float z, float zTexture ); - virtual void paintCapStep( float z, float zTexture, bool texture ); + enum CubeMode + { + Cube, + Cylinder, + Sphere + }; + void toggle( CubeMode newMode = Cube ); + void paintCube( int mask, QRegion region, ScreenPaintData& data ); + void paintCap(); + void paintCubeCap(); + void paintCylinderCap(); + void paintSphereCap(); + bool loadShader(); void loadConfig( QString config ); void rotateCube(); void rotateToDesktop( int desktop ); @@ -82,6 +94,8 @@ class CubeEffect bool keyboard_grab; bool schedule_close; ElectricBorder borderActivate; + ElectricBorder borderActivateCylinder; + ElectricBorder borderActivateSphere; int painting_desktop; Window input; int frontDesktop; @@ -124,6 +138,11 @@ class CubeEffect bool invertMouse; bool tabBoxMode; bool shortcutsRegistered; + CubeMode mode; + bool useShaders; + GLShader* cylinderShader; + GLShader* sphereShader; + float capDeformationFactor; // GL lists bool capListCreated; diff --git a/effects/cube/cube_config.cpp b/effects/cube/cube_config.cpp index 88a726a70c..aa12894a98 100644 --- a/effects/cube/cube_config.cpp +++ b/effects/cube/cube_config.cpp @@ -58,10 +58,18 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) : m_actionCollection->setConfigGroup( "Cube" ); m_actionCollection->setConfigGlobal(true); - KAction* a = (KAction*) m_actionCollection->addAction( "Cube" ); - a->setText( i18n("Desktop Cube" )); - a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 )); + KAction* cubeAction = (KAction*) m_actionCollection->addAction( "Cube" ); + cubeAction->setText( i18n("Desktop Cube" )); + cubeAction->setProperty("isConfigurationAction", true); + cubeAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F11 )); + KAction* cylinderAction = (KAction*) m_actionCollection->addAction( "Cylinder" ); + cylinderAction->setText( i18n("Desktop Cylinder" )); + cylinderAction->setProperty("isConfigurationAction", true); + cylinderAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 )); + KAction* sphereAction = (KAction*) m_actionCollection->addAction( "Sphere" ); + sphereAction->setText( i18n("Desktop Sphere" )); + sphereAction->setProperty("isConfigurationAction", true); + sphereAction->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F11 )); m_ui->editor->addCollection(m_actionCollection); @@ -85,6 +93,7 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) : connect(m_ui->walkThroughDesktopBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); 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())); load(); } @@ -111,7 +120,8 @@ void CubeEffectConfig::load() m_ui->wallpaperRequester->setPath( conf.readEntry( "Wallpaper", "" ) ); bool invertKeys = conf.readEntry( "InvertKeys", false ); bool invertMouse = conf.readEntry( "InvertMouse", false ); - + m_ui->capDeformationSlider->setValue( conf.readEntry( "CapDeformation", 0 ) ); + m_ui->rotationDurationSpin->setValue( duration ); m_ui->cubeOpacitySlider->setValue( opacity ); m_ui->cubeOpacitySpin->setValue( opacity ); @@ -201,6 +211,7 @@ void CubeEffectConfig::save() conf.writeEntry( "TabBox", m_ui->walkThroughDesktopBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "InvertKeys", m_ui->invertKeysBox->isChecked() ); conf.writeEntry( "InvertMouse", m_ui->invertMouseBox->isChecked() ); + conf.writeEntry( "CapDeformation", m_ui->capDeformationSlider->value() ); m_ui->editor->save(); @@ -229,6 +240,7 @@ void CubeEffectConfig::defaults() m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked ); m_ui->invertKeysBox->setChecked( false ); m_ui->invertMouseBox->setChecked( false ); + m_ui->capDeformationSlider->setValue( 0 ); m_ui->editor->allDefault(); emit changed(true); } diff --git a/effects/cube/cube_config.ui b/effects/cube/cube_config.ui index d1b5918143..1e57a5dc81 100644 --- a/effects/cube/cube_config.ui +++ b/effects/cube/cube_config.ui @@ -446,6 +446,48 @@ otherwise it will remain active + + + + Sphere Cap Deformation + + + + + + 100 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + + + + Sphere + + + + + + + Plane + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + diff --git a/effects/cube/cylinder.cpp b/effects/cube/cylinder.cpp deleted file mode 100644 index 2cfec92a7d..0000000000 --- a/effects/cube/cylinder.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2008 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ -#include "cube.h" -#include "cylinder.h" - -#include -#include - -#include - -#include - -namespace KWin -{ - -KWIN_EFFECT( cylinder, CylinderEffect ) -KWIN_EFFECT_SUPPORTED( cylinder, CylinderEffect::supported() ) - -CylinderEffect::CylinderEffect() - : CubeEffect() - , mInited( false ) - , mValid( true ) - , mShader( 0 ) - { - shortcutsRegistered = false; - reconfigure( ReconfigureAll ); - } - -CylinderEffect::~CylinderEffect() - { - delete mShader; - } - -void CylinderEffect::reconfigure( ReconfigureFlags ) - { - loadConfig( "Cylinder" ); - } - -bool CylinderEffect::supported() - { - return GLShader::fragmentShaderSupported() && - (effects->compositingType() == OpenGLCompositing); - } - -bool CylinderEffect::loadData() - { - mInited = true; - QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.frag"); - QString vertexshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.vert"); - if(fragmentshader.isEmpty() || vertexshader.isEmpty()) - { - kError(1212) << "Couldn't locate shader files" << endl; - return false; - } - - mShader = new GLShader(vertexshader, fragmentshader); - if(!mShader->isValid()) - { - kError(1212) << "The shader failed to load!" << endl; - return false; - } - else - { - mShader->bind(); - mShader->setUniform( "winTexture", 0 ); - mShader->setUniform( "opacity", cubeOpacity ); - QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) - rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); - mShader->setUniform( "width", (float)rect.width() ); - mShader->unbind(); - } - return true; - } - -void CylinderEffect::paintCube( int mask, QRegion region, ScreenPaintData& data ) - { - glPushMatrix(); - QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop()); - - float cubeAngle = (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f; - float radian = (cubeAngle*0.5)*M_PI/180; - // height of the triangle compound of one side of the cube and the two bisecting lines - float midpoint = rect.width()*0.5*tan(radian); - // radius of the circle - float radius = (rect.width()*0.5)/cos(radian); - glTranslatef( 0.0, 0.0, midpoint - radius ); - CubeEffect::paintCube( mask, region, data ); - glPopMatrix(); - } - -void CylinderEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) - { - if( activated ) - { - if( cube_painting ) - { - if( w->isOnDesktop( painting_desktop )) - { - data.quads = data.quads.makeGrid( 40 ); - QRect rect = effects->clientArea( FullArea, activeScreen, painting_desktop ); - if( w->x() < rect.width()/2 && w->x() + w->width() > rect.width()/ 2 ) - data.quads = data.quads.splitAtX( rect.width()/2 - w->x() ); - w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); - } - else - { - w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); - } - } - } - effects->prePaintWindow( w, data, time ); - } - -void CylinderEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ) - { - if( activated && cube_painting ) - { - if( mValid && !mInited ) - mValid = loadData(); - bool useShader = mValid; - if( useShader ) - { - mShader->bind(); - mShader->setUniform( "windowWidth", (float)w->width() ); - mShader->setUniform( "windowHeight", (float)w->height() ); - mShader->setUniform( "xCoord", (float)w->x() ); - mShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f ); - data.shader = mShader; - } - CubeEffect::paintWindow( w, mask, region, data ); - if( useShader ) - { - mShader->unbind(); - } - } - else - effects->paintWindow( w, mask, region, data ); - } - -void CylinderEffect::paintCap( float z, float zTexture ) - { - if( ( !paintCaps ) || effects->numberOfDesktops() <= 2 ) - return; - CubeEffect::paintCap( z, zTexture ); - QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); - - float cubeAngle = (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f; - float radian = (cubeAngle*0.5)*M_PI/180; - // height of the triangle compound of one side of the cube and the two bisecting lines - float midpoint = rect.width()*0.5*tan(radian); - // radius of the circle - float radius = (rect.width()*0.5)/cos(radian); - - // paint round part of the cap - glPushMatrix(); - float zTranslate = zPosition + zoom; - if( start ) - zTranslate *= timeLine.value(); - if( stop ) - zTranslate *= ( 1.0 - timeLine.value() ); - glTranslatef( 0.0, 0.0, -zTranslate ); - float triangleWidth = 40.0; - - for( int i=0; inumberOfDesktops(); i++ ) - { - glPushMatrix(); - glTranslatef( rect.width()/2, 0.0, -z ); - glRotatef( i*(360.0f/effects->numberOfDesktops()), 0.0, 1.0, 0.0 ); - glTranslatef( -rect.width()/2, 0.0, z ); - glBegin( GL_TRIANGLE_STRIP ); - for( int j=0; j see comments - float distance = rect.width()*0.5 - (j*triangleWidth); - if( (j*triangleWidth) > rect.width()*0.5 ) - { - distance = (j*triangleWidth) - rect.width()*0.5; - } - // distance in correct format - float angle = acos( distance/radius ); - float h = radius; - // if distance == 0 -> angle=90 -> tan(90) singularity - if( distance != 0.0 ) - h = tan( angle ) * distance; - zValue = h - midpoint; - glVertex3f( j*triangleWidth, 0.0, zValue ); - glVertex3f( (j+1)*triangleWidth, 0.0, 0.0 ); - } - glEnd(); - glPopMatrix(); - } - glPopMatrix(); - } - -} // namespace diff --git a/effects/cube/cylinder.desktop b/effects/cube/cylinder.desktop deleted file mode 100644 index 5a9b3ac2df..0000000000 --- a/effects/cube/cylinder.desktop +++ /dev/null @@ -1,126 +0,0 @@ -[Desktop Entry] -Name=Desktop Cylinder -Name[ar]=أسطوانة سطح المكتب -Name[be@latin]=Rabočy cylinder -Name[bg]=Цилиндричен работен плот -Name[bn]=ডেস্কটপ সিলিন্ডার -Name[bn_IN]=ডেস্কটপ সিলিন্ডার -Name[ca]=Cilindre d'escriptori -Name[ca@valencia]=Cilindre d'escriptori -Name[csb]=Cylinder pùltu -Name[da]=Desktop-cylinder -Name[de]=Arbeitsflächen-Zylinder -Name[el]=Κύλινδρος επιφάνειας εργασίας -Name[es]=Cilindro de escritorio -Name[et]=Töölauasilinder -Name[eu]=Mahaigain-zilindroa -Name[fi]=Työpöytäsylinteri -Name[fr]=Bureau en cylindre -Name[fy]=Buroblêdsilinder -Name[gl]=Escritorio cilíndrico -Name[gu]=ડેસ્કટોપ સિલિન્ડર -Name[he]=שולחן עבודה בצילינדר -Name[hi]=डेस्कटॉप बेलन -Name[is]=Skjáborðssúla -Name[it]=Cilindro desktop -Name[ja]=デスクトップシリンダー -Name[kk]=Үстел цилиндірі -Name[km]=ស៊ីឡាំង​ផ្ទៃតុ -Name[kn]=ಗಣಕತೆರೆ ಹೊರಳು (ಸಿಲಿಂಡರ್) -Name[ko]=데스크톱 실린더 -Name[ku]=Sermase ya Gundorkî -Name[lt]=Darbastalio cilindras -Name[lv]=Darbvirsmas cilindrs -Name[mk]=Работен цилиндар -Name[ml]=പണിയിടം ഗോളസ്തംഭം -Name[mr]=डेस्कटॉप सिलींडर -Name[nb]=Skrivebordssylinder -Name[nds]=Zylinner-Schriefdisch -Name[nl]=Bureaubladcilinder -Name[nn]=Skrivebordsylinder -Name[pa]=ਡੈਸਕਟਾਪ ਸਿਲੰਡਰ -Name[pl]=Cylinder pulpitu -Name[pt]=Cilindro de Ecrãs -Name[pt_BR]=Cilindro da área de trabalho -Name[ro]=Cilindru de birou -Name[sk]=Plocha valec -Name[sl]=Valj z namizji -Name[sr]=Ваљак површи -Name[sr@latin]=Valjak površi -Name[sv]=Skrivbordscylinder -Name[ta]=மேல்மேசை உருளி -Name[te]=డెస్‍క్ టాప్ సిలెండర్ -Name[th]=พื้นที่ทำงานทรงกระบอก -Name[tr]=Masaüstü Silindiri -Name[uk]=Циліндр стільниць -Name[wa]=Cilinde di scribannes -Name[x-test]=xxDesktop Cylinderxx -Name[zh_CN]=桌面圆柱 -Name[zh_TW]=桌面圓柱 -Icon=preferences-system-windows-effect-cylinder -Comment=Display each virtual desktop on the side of a cylinder -Comment[ar]=تعرض كل سطح مكتب افتراضي على جانب من جوانب الأسطوانة -Comment[be@latin]=Pakazvaje virtualnyja rabočyja stały na baku cylindra -Comment[bg]=Всеки виртуален работен плот се показва като част от цилиндър -Comment[bn]=প্রত্যেকটি ভার্চুয়াল ডেস্কটপ একটি সিলিণ্ডার-এর ধারে দেখাও -Comment[bn_IN]=প্রত্যেকটি ভার্চুয়াল ডেস্কটপ একটি সিলিণ্ডার-এর ধারে দেখাও -Comment[ca]=Visualitza cada escriptori virtual a la cara d'un cilindre -Comment[ca@valencia]=Visualitza cada escriptori virtual a la cara d'un cilindre -Comment[da]=Vis hver virtuel desktop på en side af en cylinder -Comment[de]=Zeigt jede virtuelle Arbeitsfläche auf einer Zylinderseite an. -Comment[el]=Εμφάνιση κάθε εικονικής επιφάνειας εργασίας στην πλευρά ενός κυλίνδρου -Comment[es]=Mostrar cada escritorio virtual en un lado de un cilindro -Comment[et]=Virtuaalsete töölaudade asetamine silindrile -Comment[eu]=Erakutsi laneko area bakoitza zilindroaren alde batean -Comment[fr]=Affiche chaque bureau virtuel sur la face d'un cylindre -Comment[fy]=Elts firtueel buroblêd op in side fan in silinder sjen litte -Comment[gl]=Mostra cada escritorios virtual a un lado dun cilindro -Comment[gu]=સિલિન્ડરની બાજુઓ પર વર્ચ્યુઅલ ડેસ્કટોપ બતાવે છે -Comment[he]=הצג כל שולחן עבודה וירטואלי בצד של צילינדר -Comment[hi]=बेलन के हर बाजू पर आभासी डेस्कटॉप दिखाएँ -Comment[is]=Sýnir hvert sýndarskjáborð á sinni hlið súlu -Comment[it]=Mostra ogni desktop virtuale sul lato di un cilindro -Comment[ja]=仮想デスクトップをシリンダーの側面に表示します -Comment[kk]=Әрбір виртуалды үстелді цилиндрдің бүйірінде көрсету -Comment[km]=បង្ហាញ​ផ្ទៃតុ​និម្មិត​នីមួយៗ​នៅ​លើ​ស៊ីឡាំង -Comment[kn]=ಪ್ರತಿ ವಾಸ್ತವಪ್ರಾಯ (ವರ್ಚುಯಲ್) ಗಣಕತೆರೆಗಯನ್ನೂ ಹೊರಳು (ಸಿಲಿಂಡರ್) ನ ಬದಿಗಳ ಮೇಲೆ ತೋರಿಸು -Comment[ko]=실린더의 각각 면에 가상 데스크톱을 표시합니다 -Comment[ku]=Her sermase ya farazî di rexê gundor de nîşan bide -Comment[lt]=Rodo kiekvieną virtualų darbastalį ant cilindro šono -Comment[lv]=Rāda visas virtuālās darbvirsmas uz cilindra malas -Comment[mk]=Ги прикажува виртуелните работни површини на страниците на цилиндар -Comment[ml]=ഓരോ വര്‍ച്ചുവല്‍ പണിയിടവും ഓരോ ഗോളസ്തംഭത്തിന്റെ വശത്തായ് കാണിക്കുക -Comment[mr]=सिलींडरच्या बाजूला प्रत्येक आभासी डेस्कटॉप दर्शवा -Comment[nb]=Avbild virtuelle skrivebord på en sylinder -Comment[nds]=Elkeen Schriefdisch op en Zylinnersiet wiesen -Comment[nl]=Toont elk virtueel bureaublad als zijde van een cilinder -Comment[pa]=ਸਿਲੰਡਰ ਦੀ ਸਾਈਡ ਉੱਤੇ ਹਰੇਕ ਵੁਰਚੁਅਲ ਡੈਸਕਟਾਪ ਵੇਖੋ -Comment[pl]=Pokazanie każdego wirtualnego pulpitu na innej ścianie cylindra -Comment[pt]=Mostrar cada ecrã virtual como uma face de um cilindro -Comment[pt_BR]=Mostra cada área de trabalho virtual em um lado de um cilindro -Comment[ro]=Afișează fiecare birou virtual pe fața unui cilindru -Comment[sk]=Zobrazí virtuálne plochy na stranách valca -Comment[sl]=Vsako navidezno namizje prikaže na plašču valja -Comment[sr]=Пресликава виртуелне површи на омотач цилиндра -Comment[sr@latin]=Preslikava virtuelne površi na omotač cilindra -Comment[sv]=Visar varje virtuellt skrivbord på sidan av en cylinder -Comment[th]=แสดงแต่ละพื้นที่ทำงานเสมือนบนด้านข้างของทรงกระบอก -Comment[tr]=Sanal masaüstlerini bir silindirin yanı olarak göster -Comment[uk]=Показувати всі стільниці на поверхні циліндра -Comment[wa]=Håyene tchaeke forveyou scribanne sol costé d' on cilinde -Comment[x-test]=xxDisplay each virtual desktop on the side of a cylinderxx -Comment[zh_CN]=在一排圆柱体中显示各虚拟桌面 -Comment[zh_TW]=將虛擬桌面顯示在圓柱的邊邊 - -Type=Service -X-KDE-ServiceTypes=KWin/Effect -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=ubuntu@martin-graesslin.com -X-KDE-PluginInfo-Name=kwin4_effect_cylinder -X-KDE-PluginInfo-Version=0.1.0 -X-KDE-PluginInfo-Category=Window Management -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=false -X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 diff --git a/effects/cube/cylinder.h b/effects/cube/cylinder.h deleted file mode 100644 index bb37a53338..0000000000 --- a/effects/cube/cylinder.h +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2008 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -#ifndef KWIN_CYLINDER_H -#define KWIN_CYLINDER_H - -#include -#include - -namespace KWin -{ - -class CylinderEffect - : public CubeEffect - { - public: - CylinderEffect(); - ~CylinderEffect(); - virtual void reconfigure( ReconfigureFlags ); - virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ); - virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ); - - static bool supported(); - protected: - virtual void paintCube( int mask, QRegion region, ScreenPaintData& data ); - virtual void paintCap( float z, float zTexture ); - private: - bool loadData(); - bool mInited; - bool mValid; - GLShader* mShader; - }; - -} // namespace - -#endif diff --git a/effects/cube/cylinder_config.cpp b/effects/cube/cylinder_config.cpp deleted file mode 100644 index 7f617576fa..0000000000 --- a/effects/cube/cylinder_config.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2008 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ -#include "cylinder_config.h" -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace KWin -{ - -KWIN_EFFECT_CONFIG_FACTORY - -CylinderEffectConfigForm::CylinderEffectConfigForm(QWidget* parent) : QWidget(parent) -{ - setupUi(this); -} - -CylinderEffectConfig::CylinderEffectConfig(QWidget* parent, const QVariantList& args) : - KCModule(EffectFactory::componentData(), parent, args) - { - m_ui = new CylinderEffectConfigForm(this); - - QVBoxLayout* layout = new QVBoxLayout(this); - - layout->addWidget(m_ui, 0, 0); - - m_ui->tabWidget->setTabText( 0, i18nc("@title:tab Basic Settings", "Basic") ); - m_ui->tabWidget->setTabText( 1, i18nc("@title:tab Advanced Settings", "Advanced") ); - - // Shortcut config. The shortcut belongs to the component "kwin"! - m_actionCollection = new KActionCollection( this, KComponentData("kwin") ); - - m_actionCollection->setConfigGroup( "Cylinder" ); - m_actionCollection->setConfigGlobal(true); - - KAction* a = (KAction*) m_actionCollection->addAction( "Cylinder" ); - a->setText( i18n("Desktop Cylinder" )); - a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 )); - - m_ui->editor->addCollection(m_actionCollection); - - 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())); - 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())); - connect(m_ui->capColorButton, SIGNAL(changed(QColor)), this, SLOT(changed())); - connect(m_ui->wallpaperRequester, SIGNAL(textChanged(QString)), this, SLOT(changed())); - connect(m_ui->closeOnMouseReleaseBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->zPositionSlider, SIGNAL(valueChanged(int)), this, SLOT(changed())); - connect(m_ui->walkThroughDesktopBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->invertKeysBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->invertMouseBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - - - load(); - } - -void CylinderEffectConfig::load() - { - KCModule::load(); - - KConfigGroup conf = EffectsHandler::effectConfig( "Cylinder" ); - - 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 ) ); - 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 closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false ); - bool walkThroughDesktop = conf.readEntry( "TabBox", false ); - m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 100 ) ); - m_ui->wallpaperRequester->setPath( conf.readEntry( "Wallpaper", "" ) ); - bool invertKeys = conf.readEntry( "InvertKeys", false ); - bool invertMouse = conf.readEntry( "InvertMouse", false ); - - - 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 ); - } - else - { - m_ui->displayDesktopNameBox->setCheckState( Qt::Unchecked ); - } - if( reflection ) - { - m_ui->reflectionBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->reflectionBox->setCheckState( Qt::Unchecked ); - } - if( caps ) - { - m_ui->cubeCapsBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->cubeCapsBox->setCheckState( Qt::Unchecked ); - } - if( texturedCaps ) - { - m_ui->capsImageBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->capsImageBox->setCheckState( Qt::Unchecked ); - } - if( closeOnMouseRelease ) - { - m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked ); - } - if( walkThroughDesktop ) - { - m_ui->walkThroughDesktopBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked ); - } - m_ui->backgroundColorButton->setColor( background ); - m_ui->capColorButton->setColor( capColor ); - m_ui->invertKeysBox->setChecked( invertKeys ); - m_ui->invertMouseBox->setChecked( invertMouse ); - - capsSelectionChanged(); - - emit changed(false); - } - -void CylinderEffectConfig::save() - { - KConfigGroup conf = EffectsHandler::effectConfig( "Cylinder" ); - - conf.writeEntry( "RotationDuration", m_ui->rotationDurationSpin->value() ); - 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() ); - conf.writeEntry( "TexturedCaps", m_ui->capsImageBox->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() ); - conf.writeEntry( "TabBox", m_ui->walkThroughDesktopBox->checkState() == Qt::Checked ? true : false ); - conf.writeEntry( "InvertKeys", m_ui->invertKeysBox->isChecked() ); - conf.writeEntry( "InvertMouse", m_ui->invertMouseBox->isChecked() ); - - - m_ui->editor->save(); - - conf.sync(); - - emit changed(false); - EffectsHandler::sendReloadMessage( "cylinder" ); - } - -void CylinderEffectConfig::defaults() - { - m_ui->rotationDurationSpin->setValue( 0 ); - m_ui->displayDesktopNameBox->setCheckState( Qt::Checked ); - 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() ); - m_ui->capsImageBox->setCheckState( Qt::Checked ); - m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked ); - m_ui->wallpaperRequester->setPath( "" ); - m_ui->zPositionSlider->setValue( 100 ); - m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked ); - m_ui->invertKeysBox->setChecked( false ); - m_ui->invertMouseBox->setChecked( false ); - m_ui->editor->allDefault(); - emit changed(true); - } - -void CylinderEffectConfig::capsSelectionChanged() - { - if( m_ui->cubeCapsBox->checkState() == Qt::Checked ) - { - // activate cap color - m_ui->capColorButton->setEnabled( true ); - m_ui->capColorLabel->setEnabled( true ); - m_ui->capsImageBox->setEnabled( true ); - } - else - { - // deactivate cap color - m_ui->capColorButton->setEnabled( false ); - m_ui->capColorLabel->setEnabled( false ); - m_ui->capsImageBox->setEnabled( false ); - } - } - -} // namespace - -#include "cylinder_config.moc" diff --git a/effects/cube/cylinder_config.desktop b/effects/cube/cylinder_config.desktop deleted file mode 100644 index 667976a704..0000000000 --- a/effects/cube/cylinder_config.desktop +++ /dev/null @@ -1,66 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KCModule - -X-KDE-Library=kcm_kwin4_effect_builtins -X-KDE-ParentComponents=kwin4_effect_cylinder -X-KDE-PluginKeyword=cylinder - -Name=Desktop Cylinder -Name[ar]=أسطوانة سطح المكتب -Name[be@latin]=Rabočy cylinder -Name[bg]=Цилиндричен работен плот -Name[bn]=ডেস্কটপ সিলিন্ডার -Name[bn_IN]=ডেস্কটপ সিলিন্ডার -Name[ca]=Cilindre d'escriptori -Name[ca@valencia]=Cilindre d'escriptori -Name[csb]=Cylinder pùltu -Name[da]=Desktop-cylinder -Name[de]=Arbeitsflächen-Zylinder -Name[el]=Κύλινδρος επιφάνειας εργασίας -Name[es]=Cilindro de escritorio -Name[et]=Töölauasilinder -Name[eu]=Mahaigain-zilindroa -Name[fi]=Työpöytäsylinteri -Name[fr]=Bureau en cylindre -Name[fy]=Buroblêdsilinder -Name[gl]=Escritorio cilíndrico -Name[gu]=ડેસ્કટોપ સિલિન્ડર -Name[he]=שולחן עבודה בצילינדר -Name[hi]=डेस्कटॉप बेलन -Name[is]=Skjáborðssúla -Name[it]=Cilindro desktop -Name[ja]=デスクトップシリンダー -Name[kk]=Үстел цилиндірі -Name[km]=ស៊ីឡាំង​ផ្ទៃតុ -Name[kn]=ಗಣಕತೆರೆ ಹೊರಳು (ಸಿಲಿಂಡರ್) -Name[ko]=데스크톱 실린더 -Name[ku]=Sermase ya Gundorkî -Name[lt]=Darbastalio cilindras -Name[lv]=Darbvirsmas cilindrs -Name[mk]=Работен цилиндар -Name[ml]=പണിയിടം ഗോളസ്തംഭം -Name[mr]=डेस्कटॉप सिलींडर -Name[nb]=Skrivebordssylinder -Name[nds]=Zylinner-Schriefdisch -Name[nl]=Bureaubladcilinder -Name[nn]=Skrivebordsylinder -Name[pa]=ਡੈਸਕਟਾਪ ਸਿਲੰਡਰ -Name[pl]=Cylinder pulpitu -Name[pt]=Cilindro de Ecrãs -Name[pt_BR]=Cilindro da área de trabalho -Name[ro]=Cilindru de birou -Name[sk]=Plocha valec -Name[sl]=Valj z namizji -Name[sr]=Ваљак површи -Name[sr@latin]=Valjak površi -Name[sv]=Skrivbordscylinder -Name[ta]=மேல்மேசை உருளி -Name[te]=డెస్‍క్ టాప్ సిలెండర్ -Name[th]=พื้นที่ทำงานทรงกระบอก -Name[tr]=Masaüstü Silindiri -Name[uk]=Циліндр стільниць -Name[wa]=Cilinde di scribannes -Name[x-test]=xxDesktop Cylinderxx -Name[zh_CN]=桌面圆柱 -Name[zh_TW]=桌面圓柱 diff --git a/effects/cube/cylinder_config.h b/effects/cube/cylinder_config.h deleted file mode 100644 index e1765cb0a9..0000000000 --- a/effects/cube/cylinder_config.h +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2008 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -#ifndef KWIN_CYLINDER_CONFIG_H -#define KWIN_CYLINDER_CONFIG_H - -#include - -#include "ui_cylinder_config.h" - -class KFileDialog; - -namespace KWin -{ - -class CylinderEffectConfigForm : public QWidget, public Ui::CylinderEffectConfigForm -{ - Q_OBJECT - public: - explicit CylinderEffectConfigForm(QWidget* parent); -}; - -class CylinderEffectConfig : public KCModule - { - Q_OBJECT - public: - explicit CylinderEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); - - public slots: - virtual void save(); - virtual void load(); - virtual void defaults(); - - private slots: - void capsSelectionChanged(); - private: - CylinderEffectConfigForm* m_ui; - KActionCollection* m_actionCollection; - }; - -} // namespace - -#endif diff --git a/effects/cube/cylinder_config.ui b/effects/cube/cylinder_config.ui deleted file mode 100644 index c92ad63ea8..0000000000 --- a/effects/cube/cylinder_config.ui +++ /dev/null @@ -1,517 +0,0 @@ - - KWin::CylinderEffectConfigForm - - - - 0 - 0 - 729 - 542 - - - - - - - 0 - - - - Tab 1 - - - - - - Background - - - - - - Background color: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - backgroundColorButton - - - - - - - - 0 - 0 - - - - - - - - Wallpaper: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - wallpaperRequester - - - - - - - - 0 - 0 - - - - - - - - - - - Activation - - - - - - - 0 - 200 - - - - - - - - - - - Appearance - - - - - - Display desktop name - - - - - - - Reflection - - - - - - - Rotation duration: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - rotationDurationSpin - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - Default - - - msec - - - 5000 - - - 10 - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - - - Opacity - - - - - - - 200 - 0 - - - - 100 - - - 1 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 10 - - - - - - - - 75 - 0 - - - - % - - - 100 - - - 100 - - - - - - - Transparent - - - - - - - Opaque - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Do not change opacity of windows - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Tab 2 - - - - - - Caps - - - - - - Show caps - - - - - - - Cap color: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - capColorButton - - - - - - - - 0 - 0 - - - - - - - - Display image on caps - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Zoom - - - - - - Near - - - - - - - Far - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Define how far away the object should appear - - - 3000 - - - 10 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 100 - - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - Additional Options - - - - - - If enabled the effect will be deactivated after rotating the cylinder with the mouse, -otherwise it will remain active. - - - Close after mouse dragging - - - - - - - Use this effect for walking through the desktops - - - - - - - Invert cursor keys - - - - - - - Invert mouse - - - - - - - - - - - - - - - KColorButton - QPushButton -
kcolorbutton.h
-
- - KUrlRequester - QFrame -
kurlrequester.h
- 1 -
- - KWin::GlobalShortcutsEditor - QWidget -
kwineffects.h
- 1 -
-
- - tabWidget - displayDesktopNameBox - reflectionBox - rotationDurationSpin - cubeOpacitySlider - cubeOpacitySpin - desktopOpacityOnlyBox - backgroundColorButton - wallpaperRequester - cubeCapsBox - capColorButton - capsImageBox - closeOnMouseReleaseBox - walkThroughDesktopBox - invertMouseBox - invertKeysBox - zPositionSlider - - - - - cubeOpacitySpin - valueChanged(int) - cubeOpacitySlider - setValue(int) - - - 524 - 96 - - - 433 - 97 - - - - - cubeOpacitySlider - valueChanged(int) - cubeOpacitySpin - setValue(int) - - - 331 - 97 - - - 524 - 96 - - - - -
diff --git a/effects/cube/data/cylinder.frag b/effects/cube/data/cylinder.frag index efe47f9b1c..d467c64141 100644 --- a/effects/cube/data/cylinder.frag +++ b/effects/cube/data/cylinder.frag @@ -2,6 +2,7 @@ uniform sampler2D winTexture; uniform float windowWidth; uniform float windowHeight; uniform float opacity; +uniform float front; vec2 pix2tex(vec2 pix) { @@ -10,5 +11,14 @@ vec2 pix2tex(vec2 pix) void main() { + if( front > 0.0 && gl_FrontFacing ) + discard; + if( front < 0.0 && !gl_FrontFacing ) + discard; + // remove the shadow decoration quads + if( gl_TexCoord[0].x < 0.0 || gl_TexCoord[0].x > windowWidth || + gl_TexCoord[0].y < 0.0 || gl_TexCoord[0].y > windowHeight ) + discard; gl_FragColor.rgba = texture2D(winTexture, pix2tex(gl_TexCoord[0].xy)).rgba; + gl_FragColor.a = gl_FragColor.a * opacity; } diff --git a/effects/cube/sphere.cpp b/effects/cube/sphere.cpp deleted file mode 100644 index 674d69d2a7..0000000000 --- a/effects/cube/sphere.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2008 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ -#include "cube.h" -#include "sphere.h" - -#include -#include - -#include - -#include - -namespace KWin -{ - -KWIN_EFFECT( sphere, SphereEffect ) -KWIN_EFFECT_SUPPORTED( sphere, SphereEffect::supported() ) - -SphereEffect::SphereEffect() - : CubeEffect() - , mInited( false ) - , mValid( true ) - , mShader( 0 ) - { - shortcutsRegistered = false; - reconfigure( ReconfigureAll ); - } - -SphereEffect::~SphereEffect() - { - delete mShader; - } - -void SphereEffect::reconfigure( ReconfigureFlags ) - { - loadConfig( "Sphere" ); - } - -bool SphereEffect::supported() - { - return GLShader::fragmentShaderSupported() && - (effects->compositingType() == OpenGLCompositing); - } - -bool SphereEffect::loadData() - { - mInited = true; - QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.frag"); - QString vertexshader = KGlobal::dirs()->findResource("data", "kwin/sphere.vert"); - if( fragmentshader.isEmpty() || vertexshader.isEmpty() ) - { - kError(1212) << "Couldn't locate shader files" << endl; - return false; - } - - mShader = new GLShader( vertexshader, fragmentshader ); - if( !mShader->isValid() ) - { - kError(1212) << "The shader failed to load!" << endl; - return false; - } - else - { - mShader->bind(); - mShader->setUniform( "winTexture", 0 ); - mShader->setUniform( "opacity", cubeOpacity ); - QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && bigCube ) - rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); - mShader->setUniform( "width", (float)rect.width() ); - mShader->setUniform( "height", (float)rect.height() ); - mShader->unbind(); - } - return true; - } - -void SphereEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ) - { - if( activated ) - { - if( cube_painting ) - { - if( w->isOnDesktop( painting_desktop )) - { - data.quads = data.quads.makeGrid( 40 ); - QRect rect = effects->clientArea( FullArea, activeScreen, painting_desktop ); - if( w->x() < rect.width()/2 && w->x() + w->width() > rect.width()/ 2 ) - data.quads = data.quads.splitAtX( rect.width()/2 - w->x() ); - w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); - } - else - { - w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); - } - } - } - effects->prePaintWindow( w, data, time ); - } - -void SphereEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ) - { - if( activated && cube_painting ) - { - if( mValid && !mInited ) - mValid = loadData(); - bool useShader = mValid; - if( useShader ) - { - mShader->bind(); - mShader->setUniform( "windowWidth", (float)w->width() ); - mShader->setUniform( "windowHeight", (float)w->height() ); - mShader->setUniform( "xCoord", (float)w->x() ); - mShader->setUniform( "yCoord", (float)w->y() ); - mShader->setUniform( "cubeAngle", (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f ); - data.shader = mShader; - } - CubeEffect::paintWindow( w, mask, region, data ); - if( useShader ) - { - mShader->unbind(); - } - } - else - effects->paintWindow( w, mask, region, data ); - } - -void SphereEffect::paintCap( float z, float zTexture ) - { - if( bottomCap ) - { - glPushMatrix(); - glScalef( 1.0, -1.0, 1.0 ); - } - CubeEffect::paintCap( z, zTexture ); - if( bottomCap ) - glPopMatrix(); - } - -void SphereEffect::paintCapStep( float z, float zTexture, bool texture ) - { - QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); - float cubeAngle = (effects->numberOfDesktops() - 2 )/(float)effects->numberOfDesktops() * 180.0f; - float radius = (rect.width()*0.5)/cos(cubeAngle*0.5*M_PI/180.0); - float angle = acos( (rect.height()*0.5)/radius )*180.0/M_PI; - angle /= 30; - if( texture ) - capTexture->bind(); - glPushMatrix(); - glTranslatef( 0.0, -rect.height()*0.5, 0.0 ); - glBegin( GL_QUADS ); - for( int i=0; i<30; i++ ) - { - float topAngle = angle*i*M_PI/180.0; - float bottomAngle = angle*(i+1)*M_PI/180.0; - float yTop = rect.height() - radius * cos( topAngle ); - yTop -= (yTop-rect.height()*0.5)*capDeformationFactor; - float yBottom = rect.height() -radius * cos( bottomAngle ); - yBottom -= (yBottom-rect.height()*0.5)*capDeformationFactor; - for( int j=0; j<36; j++ ) - { - float x = radius * sin( topAngle ) * sin( (90.0+j*10.0)*M_PI/180.0 ); - float z = radius * sin( topAngle ) * cos( (90.0+j*10.0)*M_PI/180.0 ); - if( texture ) - glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 ); - glVertex3f( x, yTop, z ); - x = radius * sin( bottomAngle ) * sin( (90.0+j*10.0)*M_PI/180.00 ); - z = radius * sin( bottomAngle ) * cos( (90.0+j*10.0)*M_PI/180.0 ); - if( texture ) - glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 ); - glVertex3f( x, yBottom, z ); - x = radius * sin( bottomAngle ) * sin( (90.0+(j+1)*10.0)*M_PI/180.0 ); - z = radius * sin( bottomAngle ) * cos( (90.0+(j+1)*10.0)*M_PI/180.0 ); - if( texture ) - glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 ); - glVertex3f( x, yBottom, z ); - x = radius * sin( topAngle ) * sin( (90.0+(j+1)*10.0)*M_PI/180.0 ); - z = radius * sin( topAngle ) * cos( (90.0+(j+1)*10.0)*M_PI/180.0 ); - if( texture ) - glTexCoord2f( x/(rect.width())+0.5, 0.5 - z/zTexture * 0.5 ); - glVertex3f( x, yTop, z ); - } - } - glEnd(); - glPopMatrix(); - if( texture ) - { - capTexture->unbind(); - } - } - - -} // namespace diff --git a/effects/cube/sphere.desktop b/effects/cube/sphere.desktop deleted file mode 100644 index d4e6ba8369..0000000000 --- a/effects/cube/sphere.desktop +++ /dev/null @@ -1,122 +0,0 @@ -[Desktop Entry] -Name=Desktop Sphere -Name[ar]=دائرة سطح المكتب -Name[be@latin]=Rabočaja kula -Name[bg]=Сферичен работен плот -Name[ca]=Esfera d'escriptori -Name[ca@valencia]=Esfera d'escriptori -Name[csb]=Sfera pùltu -Name[da]=Desktop-sfære -Name[de]=Arbeitsflächen-Kugel -Name[el]=Σφαίρα επιφάνειας εργασίας -Name[es]=Escritorio esfera -Name[et]=Töölauasfäär -Name[eu]=Mahaigaina esfera gisa -Name[fr]=Bureau en sphère -Name[fy]=Buroblêdbol -Name[ga]=Sféar Deisce -Name[gl]=Escritorio en esfera -Name[gu]=ડેસ્કટોપ ગોળો -Name[he]=שולחן עבודה בספירה -Name[hi]=डेस्कटॉप गोला -Name[is]=Skjáborðshvolf -Name[it]=Sfera Desktop -Name[ja]=デスクトップ球形 -Name[kk]=Үстел сферасы -Name[km]=ស៊្វែរ​ផ្ទៃតុ -Name[kn]=ಗಣಕತೆರೆ ಗೋಲ -Name[ko]=데스크톱 구 -Name[ku]=Sermaseyê Erdgilor -Name[lt]=Darbastalio sfera -Name[lv]=Darbvirsmas sfēra -Name[mk]=Работна сфера -Name[ml]=പണിയറഗോളം -Name[nb]=Skrivebordskule -Name[nds]=Schriefdischkugel -Name[nl]=Bureaubladbol -Name[nn]=Skrivebordskule -Name[pa]=ਡੈਸਕਟਾਪ ਗੋਲਾ -Name[pl]=Sfera pulpitu -Name[pt]=Esfera de Ecrãs -Name[pt_BR]=Esfera da área de trabalho -Name[ro]=Sferă de birou -Name[sk]=Plocha guľa -Name[sl]=Krogla z namizji -Name[sr]=Сфера површи -Name[sr@latin]=Sfera površi -Name[sv]=Skrivbordsklot -Name[ta]=திரைமேசை உருண்டை -Name[te]=డెస్క్ టాప్ గొళం -Name[tg]=Сфераи мизи корӣ -Name[tr]=Masaüstü Küresi -Name[uk]=Стільнична сфера -Name[x-test]=xxDesktop Spherexx -Name[zh_CN]=桌面球体 -Name[zh_TW]=桌面球體 -Icon=preferences-system-windows-effect-sphere -Comment=Display each virtual desktop on the side of a sphere -Comment[ar]=تعرض كل سطح مكتب افتراضي على جانب من جوانب الدائرة -Comment[be@latin]=Pakazvaje virtualnyja rabočyja stały na baku kuli. -Comment[bg]=Всеки виртуален работен плот се показва като част от сфера -Comment[bn]=প্রত্যেকটি ভার্চুয়াল ডেস্কটপ একটি গোলক-এর ধারে দেখাও -Comment[bn_IN]=প্রত্যেকটি ভার্চুয়াল ডেস্কটপ একটি গোলক-এর ধারে দেখাও -Comment[ca]=Visualitza cada escriptori virtual als costats d'una esfera -Comment[ca@valencia]=Visualitza cada escriptori virtual als costats d'una esfera -Comment[csb]=Wëszkrzëniô wirtualny pùlt na starnie sferë -Comment[da]=Vis hver virtuel desktop på en siden af en sfære -Comment[de]=Zeigt die virtuellen Arbeitsflächen auf einer Kugel an. -Comment[el]=Εμφάνιση κάθε εικονικής επιφάνειας εργασίας στην επιφάνεια μιας σφαίρας -Comment[es]=Muestra cada escritorio virtual como una esfera -Comment[et]=Virtuaalsete töölaudade asetamine kõrvuti sfäärile -Comment[eu]=Bistaratu laneko area bakoitza esfera baten alde batean -Comment[fr]=Affiche chaque bureau virtuel sur une sphère -Comment[fy]=Elts firtueel buroblêd op in side fan in bol sjen litte -Comment[ga]=Taispeáin gach deasc fíorúil ar thaobh de sféar -Comment[gl]=Mostra os escritorios virtuais na superficie dunha esfera -Comment[gu]=ગોળાની બાજુ પર દરેક વર્ચ્યુઅલ ડેસ્કટોપ બતાવો -Comment[he]=הצג כל שולחן עבודה וירטואלי בחלק אחר של ספירה -Comment[hi]=किसी गोले के किनारे पर प्रत्येक आभासी डेस्कटॉप को दिखाएं -Comment[is]=Sýnir hvert sýndarskjáborð á sinni hlið súlu -Comment[it]=Mostra ogni desktop virtuale sul lato di una sfera -Comment[ja]=仮想デスクトップを球の側面に表示します -Comment[kk]=Әрбір виртуалды үстелді сфераның бетінде көрсету -Comment[km]=ផ្គូផ្គង​ផ្ទៃតុ​និម្មិត​នៅ​លើ​ស៊្វែរ -Comment[kn]=ವಾಸ್ತವಪ್ರಾಯ ಗಣಕತೆರೆಗಳನ್ನು ಗೋಲವೊಂದರ ಬದಿಗಳ ಮೇಲೇ ತೋರುವಂತೆ ಮಾಡು -Comment[ko]=구의 각각 면에 가상 데스크톱을 표시합니다 -Comment[ku]=Her sermase ya farazî di rexê erdgilor de nîşan bide -Comment[lv]=Rāda visas virtuālās darbvirsmas uz sfēras malas -Comment[mk]=Ги прикажува виртуелните работни површини на страниците на сфера -Comment[ml]=ഓരോ വര്‍ച്ചുവല്‍ പണിയിടവും ഒരു ഗോളത്തിന്റെ വശത്തായ് കാണിക്കുക -Comment[nb]=Vis hvert virtuelt skrivebord på siden av en kule -Comment[nds]=Elkeen Schriefdisch op de Siet vun en Kugel wiesen -Comment[nl]=Toont elk virtueel bureaublad op een zijde van een bol -Comment[pa]=ਗੋਲ਼ੇ ਦੇ ਪਾਸੇ ਹਰੇਕ ਵੁਰਚੁਅਲ ਡੈਸਕਟਾਪ ਵੇਖੋ -Comment[pl]=Pokazanie każdego wirtualnego pulpitu na innej stronie sfery -Comment[pt]=Mostrar cada ecrã virtual como uma face de uma esfera -Comment[pt_BR]=Mostrar cada área de trabalho virtual como um lado de uma esfera -Comment[ro]=Afișează fiecare birou virtual pe suprafața unei sfere -Comment[sk]=Zobrazí virtuálne plochy na stranách gule -Comment[sl]=Vsako navidezno namizje prikaže na krogli -Comment[sr]=Пресликава виртуелне површи на сферу -Comment[sr@latin]=Preslikava virtuelne površi na sferu -Comment[sv]=Visa varje virtuellt skrivbord på sidan av ett klot -Comment[ta]=உருண்டையின் பக்கத்தில் திரைமேசையின் பிரதியொரு தோற்றத்தையும் காட்டுக -Comment[th]=แสดงแต่ละพื้นที่ทำงานเสมือนบนทรงกลม -Comment[tr]=Her bir sanal masaüstünü bir kürenin yanı olarak göster -Comment[uk]=Показувати всі стільниці на поверхні сфери -Comment[x-test]=xxDisplay each virtual desktop on the side of a spherexx -Comment[zh_CN]=在一排球体中显示各虚拟桌面 -Comment[zh_TW]=將每個虛擬桌面顯示在球體上 - -Type=Service -X-KDE-ServiceTypes=KWin/Effect -X-KDE-PluginInfo-Author=Martin Gräßlin -X-KDE-PluginInfo-Email=ubuntu@martin-graesslin.com -X-KDE-PluginInfo-Name=kwin4_effect_sphere -X-KDE-PluginInfo-Version=0.1.0 -X-KDE-PluginInfo-Category=Window Management -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=false -X-KDE-Library=kwin4_effect_builtins -X-KDE-Ordering=50 diff --git a/effects/cube/sphere.h b/effects/cube/sphere.h deleted file mode 100644 index a4b2d5eeb6..0000000000 --- a/effects/cube/sphere.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2008 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -#ifndef KWIN_SPHERE_H -#define KWIN_SPHERE_H - -#include -#include - -namespace KWin -{ - -class SphereEffect - : public CubeEffect - { - public: - SphereEffect(); - ~SphereEffect(); - virtual void reconfigure( ReconfigureFlags ); - virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ); - virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ); - - static bool supported(); - protected: - virtual void paintCap( float z, float zTexture ); - virtual void paintCapStep( float z, float zTexture, bool texture ); - private: - bool loadData(); - bool mInited; - bool mValid; - GLShader* mShader; - float capDeformationFactor; - }; - -} // namespace - -#endif diff --git a/effects/cube/sphere_config.cpp b/effects/cube/sphere_config.cpp deleted file mode 100644 index 9f4f56a348..0000000000 --- a/effects/cube/sphere_config.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2008 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ -#include "sphere_config.h" -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace KWin -{ - -KWIN_EFFECT_CONFIG_FACTORY - -SphereEffectConfigForm::SphereEffectConfigForm(QWidget* parent) : QWidget(parent) -{ - setupUi(this); -} - -SphereEffectConfig::SphereEffectConfig(QWidget* parent, const QVariantList& args) : - KCModule(EffectFactory::componentData(), parent, args) - { - m_ui = new SphereEffectConfigForm(this); - - QVBoxLayout* layout = new QVBoxLayout(this); - - layout->addWidget(m_ui); - - m_ui->tabWidget->setTabText( 0, i18nc("@title:tab Basic Settings", "Basic") ); - m_ui->tabWidget->setTabText( 1, i18nc("@title:tab Advanced Settings", "Advanced") ); - - // Shortcut config. The shortcut belongs to the component "kwin"! - m_actionCollection = new KActionCollection( this, KComponentData("kwin") ); - - m_actionCollection->setConfigGroup( "Sphere" ); - m_actionCollection->setConfigGlobal(true); - - KAction* a = (KAction*) m_actionCollection->addAction( "Sphere" ); - a->setText( i18n("Desktop Sphere" )); - a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F11 )); - - m_ui->editor->addCollection(m_actionCollection); - - 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())); - connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged())); - connect(m_ui->capsImageBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->capColorButton, SIGNAL(changed(QColor)), this, SLOT(changed())); - connect(m_ui->wallpaperRequester, SIGNAL(textChanged(QString)), this, SLOT(changed())); - connect(m_ui->closeOnMouseReleaseBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->zPositionSlider, SIGNAL(valueChanged(int)), this, SLOT(changed())); - connect(m_ui->capDeformationSlider, SIGNAL(valueChanged(int)), this, SLOT(changed())); - connect(m_ui->walkThroughDesktopBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->invertKeysBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->invertMouseBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - - load(); - } - -void SphereEffectConfig::load() - { - KCModule::load(); - - KConfigGroup conf = EffectsHandler::effectConfig( "Sphere" ); - - 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() ); - bool texturedCaps = conf.readEntry( "TexturedCaps", true ); - bool caps = conf.readEntry( "Caps", true ); - bool closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false ); - bool walkThroughDesktop = conf.readEntry( "TabBox", false ); - m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 450 ) ); - m_ui->capDeformationSlider->setValue( conf.readEntry( "CapDeformation", 0 ) ); - m_ui->wallpaperRequester->setPath( conf.readEntry( "Wallpaper", "" ) ); - bool invertKeys = conf.readEntry( "InvertKeys", false ); - bool invertMouse = conf.readEntry( "InvertMouse", false ); - - 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 ); - } - else - { - m_ui->displayDesktopNameBox->setCheckState( Qt::Unchecked ); - } - if( caps ) - { - m_ui->cubeCapsBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->cubeCapsBox->setCheckState( Qt::Unchecked ); - } - if( texturedCaps ) - { - m_ui->capsImageBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->capsImageBox->setCheckState( Qt::Unchecked ); - } - if( closeOnMouseRelease ) - { - m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked ); - } - if( walkThroughDesktop ) - { - m_ui->walkThroughDesktopBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked ); - } - m_ui->backgroundColorButton->setColor( background ); - m_ui->capColorButton->setColor( capColor ); - m_ui->invertKeysBox->setChecked( invertKeys ); - m_ui->invertMouseBox->setChecked( invertMouse ); - capsSelectionChanged(); - - emit changed(false); - } - -void SphereEffectConfig::save() - { - KConfigGroup conf = EffectsHandler::effectConfig( "Sphere" ); - - 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() ); - conf.writeEntry( "TexturedCaps", m_ui->capsImageBox->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() ); - conf.writeEntry( "CapDeformation", m_ui->capDeformationSlider->value() ); - conf.writeEntry( "TabBox", m_ui->walkThroughDesktopBox->checkState() == Qt::Checked ? true : false ); - conf.writeEntry( "InvertKeys", m_ui->invertKeysBox->isChecked() ); - conf.writeEntry( "InvertMouse", m_ui->invertMouseBox->isChecked() ); - - m_ui->editor->save(); - - conf.sync(); - - emit changed(false); - EffectsHandler::sendReloadMessage( "sphere" ); - } - -void SphereEffectConfig::defaults() - { - m_ui->rotationDurationSpin->setValue( 0 ); - 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() ); - m_ui->capsImageBox->setCheckState( Qt::Checked ); - m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked ); - m_ui->wallpaperRequester->setPath( "" ); - m_ui->zPositionSlider->setValue( 450 ); - m_ui->capDeformationSlider->setValue( 0 ); - m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked ); - m_ui->invertKeysBox->setChecked( false ); - m_ui->invertMouseBox->setChecked( false ); - m_ui->editor->allDefault(); - emit changed(true); - } - -void SphereEffectConfig::capsSelectionChanged() - { - if( m_ui->cubeCapsBox->checkState() == Qt::Checked ) - { - // activate cap color - m_ui->capColorButton->setEnabled( true ); - m_ui->capColorLabel->setEnabled( true ); - m_ui->capsImageBox->setEnabled( true ); - m_ui->capDeformationGroupBox->setEnabled( true ); - m_ui->capDeformationSlider->setEnabled( true ); - m_ui->capDeformationSphereLabel->setEnabled( true ); - m_ui->capDeformationPlaneLabel->setEnabled( true ); - } - else - { - // deactivate cap color - m_ui->capColorButton->setEnabled( false ); - m_ui->capColorLabel->setEnabled( false ); - m_ui->capsImageBox->setEnabled( false ); - m_ui->capDeformationGroupBox->setEnabled( false ); - m_ui->capDeformationSlider->setEnabled( false ); - m_ui->capDeformationSphereLabel->setEnabled( false ); - m_ui->capDeformationPlaneLabel->setEnabled( false ); - } - } - -} // namespace - -#include "sphere_config.moc" diff --git a/effects/cube/sphere_config.desktop b/effects/cube/sphere_config.desktop deleted file mode 100644 index c389a39ac0..0000000000 --- a/effects/cube/sphere_config.desktop +++ /dev/null @@ -1,62 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KCModule - -X-KDE-Library=kcm_kwin4_effect_builtins -X-KDE-ParentComponents=kwin4_effect_sphere -X-KDE-PluginKeyword=sphere - -Name=Desktop Sphere -Name[ar]=دائرة سطح المكتب -Name[be@latin]=Rabočaja kula -Name[bg]=Сферичен работен плот -Name[ca]=Esfera d'escriptori -Name[ca@valencia]=Esfera d'escriptori -Name[csb]=Sfera pùltu -Name[da]=Desktop-sfære -Name[de]=Arbeitsflächen-Kugel -Name[el]=Σφαίρα επιφάνειας εργασίας -Name[es]=Escritorio esfera -Name[et]=Töölauasfäär -Name[eu]=Mahaigaina esfera gisa -Name[fr]=Bureau en sphère -Name[fy]=Buroblêdbol -Name[ga]=Sféar Deisce -Name[gl]=Escritorio en esfera -Name[gu]=ડેસ્કટોપ ગોળો -Name[he]=שולחן עבודה בספירה -Name[hi]=डेस्कटॉप गोला -Name[is]=Skjáborðshvolf -Name[it]=Sfera Desktop -Name[ja]=デスクトップ球形 -Name[kk]=Үстел сферасы -Name[km]=ស៊្វែរ​ផ្ទៃតុ -Name[kn]=ಗಣಕತೆರೆ ಗೋಲ -Name[ko]=데스크톱 구 -Name[ku]=Sermaseyê Erdgilor -Name[lt]=Darbastalio sfera -Name[lv]=Darbvirsmas sfēra -Name[mk]=Работна сфера -Name[ml]=പണിയറഗോളം -Name[nb]=Skrivebordskule -Name[nds]=Schriefdischkugel -Name[nl]=Bureaubladbol -Name[nn]=Skrivebordskule -Name[pa]=ਡੈਸਕਟਾਪ ਗੋਲਾ -Name[pl]=Sfera pulpitu -Name[pt]=Esfera de Ecrãs -Name[pt_BR]=Esfera da área de trabalho -Name[ro]=Sferă de birou -Name[sk]=Plocha guľa -Name[sl]=Krogla z namizji -Name[sr]=Сфера површи -Name[sr@latin]=Sfera površi -Name[sv]=Skrivbordsklot -Name[ta]=திரைமேசை உருண்டை -Name[te]=డెస్క్ టాప్ గొళం -Name[tg]=Сфераи мизи корӣ -Name[tr]=Masaüstü Küresi -Name[uk]=Стільнична сфера -Name[x-test]=xxDesktop Spherexx -Name[zh_CN]=桌面球体 -Name[zh_TW]=桌面球體 diff --git a/effects/cube/sphere_config.h b/effects/cube/sphere_config.h deleted file mode 100644 index 3d32cd35d0..0000000000 --- a/effects/cube/sphere_config.h +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - - Copyright (C) 2008 Martin Gräßlin - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*********************************************************************/ - -#ifndef KWIN_SPHERE_CONFIG_H -#define KWIN_SPHERE_CONFIG_H - -#include - -#include "ui_sphere_config.h" - -class KFileDialog; - -namespace KWin -{ - -class SphereEffectConfigForm : public QWidget, public Ui::SphereEffectConfigForm -{ - Q_OBJECT - public: - explicit SphereEffectConfigForm(QWidget* parent); -}; - -class SphereEffectConfig : public KCModule - { - Q_OBJECT - public: - explicit SphereEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); - - public slots: - virtual void save(); - virtual void load(); - virtual void defaults(); - - private slots: - void capsSelectionChanged(); - private: - SphereEffectConfigForm* m_ui; - KActionCollection* m_actionCollection; - }; - -} // namespace - -#endif diff --git a/effects/cube/sphere_config.ui b/effects/cube/sphere_config.ui deleted file mode 100644 index d0f6bf5c64..0000000000 --- a/effects/cube/sphere_config.ui +++ /dev/null @@ -1,560 +0,0 @@ - - KWin::SphereEffectConfigForm - - - - 0 - 0 - 700 - 542 - - - - - - - 0 - - - - Tab 1 - - - - - - Background - - - - - - Background color: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - backgroundColorButton - - - - - - - - 0 - 0 - - - - - - - - Wallpaper: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - wallpaperRequester - - - - - - - - 0 - 0 - - - - - - - - - - - Activation - - - - - - - 0 - 200 - - - - - - - - - - - Appearance - - - - - - Display desktop name - - - - - - - Reflection - - - - - - - Rotation duration: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - rotationDurationSpin - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - Default - - - msec - - - 5000 - - - 10 - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - - - Opacity - - - - - - - 200 - 0 - - - - 100 - - - 1 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 10 - - - - - - - - 75 - 0 - - - - % - - - 100 - - - 100 - - - - - - - Transparent - - - - - - - Opaque - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Do not change opacity of windows - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Tab 2 - - - - - - Caps - - - - - - Show caps - - - - - - - Cap color: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - capColorButton - - - - - - - - 0 - 0 - - - - - - - - Display image on caps - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Zoom - - - - - - Near - - - - - - - Far - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Define how far away the object should appear - - - 3000 - - - 10 - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 100 - - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - Additional Options - - - - - - If enabled the effect will be deactivated after rotating the sphere with the mouse, -otherwise it will remain active - - - Close after mouse dragging - - - - - - - Use this effect for walking through the desktops - - - - - - - Invert cursor keys - - - - - - - Invert mouse - - - - - - - - - - Cap Deformation - - - - - - 100 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 25 - - - - - - - Sphere - - - - - - - Plane - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - KColorButton - QPushButton -
kcolorbutton.h
-
- - KUrlRequester - QFrame -
kurlrequester.h
- 1 -
- - KWin::GlobalShortcutsEditor - QWidget -
kwineffects.h
- 1 -
-
- - tabWidget - displayDesktopNameBox - reflectionBox - rotationDurationSpin - cubeOpacitySlider - cubeOpacitySpin - desktopOpacityOnlyBox - backgroundColorButton - wallpaperRequester - cubeCapsBox - capColorButton - capsImageBox - closeOnMouseReleaseBox - walkThroughDesktopBox - invertMouseBox - invertKeysBox - capDeformationSlider - zPositionSlider - - - - - cubeOpacitySpin - valueChanged(int) - cubeOpacitySlider - setValue(int) - - - 524 - 96 - - - 433 - 97 - - - - - cubeOpacitySlider - valueChanged(int) - cubeOpacitySpin - setValue(int) - - - 331 - 97 - - - 524 - 96 - - - - -
diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 6b2fa1b0bd..e715a96e17 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -682,13 +682,11 @@ void KWinCompositingConfig::setupElectricBorders() addItemToEdgesMonitor( services.first()->name()); services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_cube'"); if( !services.isEmpty() ) - addItemToEdgesMonitor( services.first()->name()); - services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_cylinder'"); - if( !services.isEmpty() ) - addItemToEdgesMonitor( services.first()->name()); - services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_sphere'"); - if( !services.isEmpty() ) - addItemToEdgesMonitor( services.first()->name()); + { + addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "Cube") ); + addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "Cylinder") ); + addItemToEdgesMonitor( services.first()->name() + " - " + i18n( "Sphere") ); + } } void KWinCompositingConfig::addItemToEdgesMonitor(const QString& item) @@ -727,13 +725,9 @@ void KWinCompositingConfig::loadElectricBorders() KConfigGroup cubeconfig(mKWinConfig, "Effect-Cube"); changeElectricBorder( (ElectricBorder)cubeconfig.readEntry( "BorderActivate", int( ElectricNone )), (int)Cube ); - // Desktop Cylinder - KConfigGroup cylinderconfig(mKWinConfig, "Effect-Cylinder"); - changeElectricBorder( (ElectricBorder)cylinderconfig.readEntry( "BorderActivate", + changeElectricBorder( (ElectricBorder)cubeconfig.readEntry( "BorderActivateCylinder", int( ElectricNone )), (int)Cylinder ); - // Desktop Grid - KConfigGroup sphereconfig(mKWinConfig, "Effect-Sphere"); - changeElectricBorder( (ElectricBorder)sphereconfig.readEntry( "BorderActivate", + changeElectricBorder( (ElectricBorder)cubeconfig.readEntry( "BorderActivateSphere", int( ElectricNone )), (int)Sphere ); } @@ -803,12 +797,8 @@ void KWinCompositingConfig::saveElectricBorders() KConfigGroup cubeconfig(mKWinConfig, "Effect-Cube"); cubeconfig.writeEntry( "BorderActivate", (int)checkEffectHasElectricBorder( (int)Cube )); - - KConfigGroup cylinderconfig(mKWinConfig, "Effect-Cylinder"); - cylinderconfig.writeEntry( "BorderActivate", (int)checkEffectHasElectricBorder( (int)Cylinder )); - - KConfigGroup sphereconfig(mKWinConfig, "Effect-Sphere"); - sphereconfig.writeEntry( "BorderActivate", (int)checkEffectHasElectricBorder( (int)Sphere )); + cubeconfig.writeEntry( "BorderActivateCylinder", (int)checkEffectHasElectricBorder( (int)Cylinder )); + cubeconfig.writeEntry( "BorderActivateSphere", (int)checkEffectHasElectricBorder( (int)Sphere )); } } // namespace