diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index 35b0cdb451..2489dd618f 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -36,6 +36,7 @@ along with this program. If not, see . #ifdef KWIN_HAVE_OPENGL_COMPOSITING #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" @@ -71,6 +72,7 @@ KWIN_EFFECT_CONFIG_MULTIPLE( builtins, #ifdef KWIN_HAVE_OPENGL_COMPOSITING 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 ) diff --git a/effects/cube/CMakeLists.txt b/effects/cube/CMakeLists.txt index 9829f3c73f..2fb887cf20 100644 --- a/effects/cube/CMakeLists.txt +++ b/effects/cube/CMakeLists.txt @@ -4,6 +4,7 @@ # Source files set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} cube/cube.cpp + cube/cubeslide.cpp cube/cylinder.cpp cube/sphere.cpp ) @@ -11,6 +12,7 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} # .desktop files install( FILES cube/cube.desktop + cube/cubeslide.desktop cube/cylinder.desktop cube/sphere.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) @@ -30,6 +32,8 @@ install( FILES set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources} cube/cube_config.cpp cube/cube_config.ui + cube/cubeslide_config.cpp + cube/cubeslide_config.ui cube/cylinder_config.cpp cube/cylinder_config.ui cube/sphere_config.cpp @@ -39,6 +43,7 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources # .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 acecd4279c..e173a50dd6 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -70,10 +70,7 @@ CubeEffect::CubeEffect() , start( false ) , stop( false ) , reflectionPainting( false ) - , slide( false ) - , oldDesktop( 0 ) , activeScreen( 0 ) - , animateDesktopChange( false ) , bigCube( false ) , bottomCap( false ) , closeOnMouseRelease( false ) @@ -112,17 +109,14 @@ void CubeEffect::loadConfig( QString config ) reflection = conf.readEntry( "Reflection", true ); rotationDuration = animationTime( conf, "RotationDuration", 500 ); backgroundColor = conf.readEntry( "BackgroundColor", QColor( Qt::black ) ); - animateDesktopChange = conf.readEntry( "AnimateDesktopChange", false ); bigCube = conf.readEntry( "BigCube", false ); // different settings for cylinder and sphere if( config == "Cylinder" ) { - animateDesktopChange = false; bigCube = true; } if( config == "Sphere" ) { - animateDesktopChange = false; bigCube = true; reflection = false; } @@ -136,8 +130,6 @@ void CubeEffect::loadConfig( QString config ) useForTabBox = conf.readEntry( "TabBox", false ); invertKeys = conf.readEntry( "InvertKeys", false ); invertMouse = conf.readEntry( "InvertMouse", false ); - dontSlidePanels = conf.readEntry( "DontSlidePanels", true ); - dontSlideStickyWindows = conf.readEntry( "DontSlideStickyWindows", true ); QString file = conf.readEntry( "Wallpaper", QString("") ); if( wallpaper ) wallpaper->discard(); @@ -197,8 +189,6 @@ void CubeEffect::loadConfig( QString config ) verticalTimeLine.setCurveShape( TimeLine::EaseInOutCurve ); verticalTimeLine.setDuration( rotationDuration ); - slideTimeLine.setCurveShape( TimeLine::EaseInOutCurve ); - slideTimeLine.setDuration( rotationDuration ); // do not connect the shortcut if we use cylinder or sphere KActionCollection* actionCollection = new KActionCollection( this ); @@ -251,15 +241,6 @@ void CubeEffect::prePaintScreen( ScreenPrePaintData& data, int time ) verticalTimeLine.addTime( time ); recompileList = true; } - if( slide && !slideRotations.empty() ) - { - slideTimeLine.addTime( time ); - recompileList = true; - if( dontSlidePanels ) - panels.clear(); - if( dontSlideStickyWindows ) - stickyWindows.clear(); - } } effects->prePaintScreen( data, time ); } @@ -273,8 +254,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) recompileList = false; glPushMatrix(); glNewList( glList, GL_COMPILE ); - if( !slide ) - rotateCube(); + rotateCube(); glEndList(); glPopMatrix(); } @@ -282,15 +262,12 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) // compile List for cube glNewList( glList + 1, GL_COMPILE ); glPushMatrix(); - if( slide ) - paintSlideCube( mask, region, data ); - else - paintCube( mask, region, data ); + paintCube( mask, region, data ); glPopMatrix(); glEndList(); QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && (slide || bigCube ) ) + if( effects->numScreens() > 1 && bigCube ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); QRect fullRect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); @@ -302,8 +279,8 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glClearColor( clearColor[0], clearColor[1], clearColor[2], clearColor[3] ); // wallpaper - if( wallpaper && !slide ) - { + if( wallpaper ) + { wallpaper->bind(); wallpaper->render( region, rect ); wallpaper->unbind(); @@ -313,7 +290,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); - if( effects->numScreens() > 1 && !slide && !bigCube ) + if( effects->numScreens() > 1 && !bigCube ) { windowsOnOtherScreens.clear(); // unfortunatelly we have to change the projection matrix in dual screen mode @@ -377,7 +354,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) if( stop ) zTranslate *= ( 1.0 - timeLine.value() ); // reflection - if( reflection && (!slide) ) + if( reflection ) { // restrict painting the reflections to the current screen PaintClipper::push( QRegion( rect )); @@ -440,7 +417,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glPopMatrix(); glPushMatrix(); - if( effects->numScreens() > 1 && rect.x() != fullRect.x() && !slide && !bigCube ) + if( effects->numScreens() > 1 && rect.x() != fullRect.x() && !bigCube ) { // have to change the reflection area in horizontal layout and right screen glTranslatef( -rect.x(), 0.0, 0.0 ); @@ -472,7 +449,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) } glEnable( GL_CULL_FACE ); // caps - if( paintCaps && ( effects->numberOfDesktops() >= 2 ) && !slide ) + if( paintCaps && ( effects->numberOfDesktops() >= 2 )) { glPushMatrix(); glCallList( glList ); @@ -500,7 +477,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glPopMatrix(); // cap - if( paintCaps && ( effects->numberOfDesktops() >= 2 ) && !slide ) + if( paintCaps && ( effects->numberOfDesktops() >= 2 )) { glPushMatrix(); glCallList( glList ); @@ -516,7 +493,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) } glDisable( GL_CULL_FACE ); - if( effects->numScreens() > 1 && !slide && !bigCube ) + if( effects->numScreens() > 1 && !bigCube ) { glPopMatrix(); // revert change of projection matrix @@ -529,7 +506,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) glPopAttrib(); // desktop name box - inspired from coverswitch - if( displayDesktopName && (!slide) ) + if( displayDesktopName ) { QColor color_frame; QColor color_text; @@ -563,7 +540,7 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) text_font ); glPopAttrib(); } - if( effects->numScreens() > 1 && !slide && !bigCube ) + if( effects->numScreens() > 1 && !bigCube ) { foreach( EffectWindow* w, windowsOnOtherScreens ) { @@ -575,22 +552,6 @@ void CubeEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) effects->paintWindow( w, 0, QRegion( w->x(), w->y(), w->width(), w->height() ), wData ); } } - if( slide && dontSlidePanels ) - { - foreach( EffectWindow* w, panels ) - { - WindowPaintData wData( w ); - effects->paintWindow( w, 0, QRegion( w->x(), w->y(), w->width(), w->height() ), wData ); - } - } - if( slide && dontSlideStickyWindows ) - { - foreach( EffectWindow* w, stickyWindows ) - { - WindowPaintData wData( w ); - effects->paintWindow( w, 0, QRegion( w->x(), w->y(), w->width(), w->height() ), wData ); - } - } } else { @@ -796,75 +757,6 @@ void CubeEffect::paintCube( int mask, QRegion region, ScreenPaintData& data ) painting_desktop = effects->currentDesktop(); } -void CubeEffect::paintSlideCube(int mask, QRegion region, KWin::ScreenPaintData& data) - { - // slide cube only paints to desktops at a time - // first the horizontal rotations followed by vertical rotations - QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); - float point = rect.width()/2*tan(45.0f*M_PI/180.0f); - cube_painting = true; - painting_desktop = frontDesktop; - - ScreenPaintData firstFaceData = data; - ScreenPaintData secondFaceData = data; - RotationData firstFaceRot = RotationData(); - RotationData secondFaceRot = RotationData(); - RotationDirection direction = slideRotations.head(); - int secondDesktop; - switch ( direction ) - { - case Left: - firstFaceRot.axis = RotationData::YAxis; - secondFaceRot.axis = RotationData::YAxis; - secondDesktop = effects->desktopToLeft( frontDesktop, true ); - firstFaceRot.angle = 90.0f*slideTimeLine.value(); - secondFaceRot.angle = -90.0f*(1.0f - slideTimeLine.value()); - break; - case Right: - firstFaceRot.axis = RotationData::YAxis; - secondFaceRot.axis = RotationData::YAxis; - secondDesktop = effects->desktopToRight( frontDesktop, true ); - firstFaceRot.angle = -90.0f*slideTimeLine.value(); - secondFaceRot.angle = 90.0f*(1.0f - slideTimeLine.value()); - break; - case Upwards: - firstFaceRot.axis = RotationData::XAxis; - secondFaceRot.axis = RotationData::XAxis; - secondDesktop = effects->desktopUp( frontDesktop, true); - firstFaceRot.angle = -90.0f*slideTimeLine.value(); - secondFaceRot.angle = 90.0f*(1.0f - slideTimeLine.value()); - point = rect.height()/2*tan(45.0f*M_PI/180.0f); - break; - case Downwards: - firstFaceRot.axis = RotationData::XAxis; - secondFaceRot.axis = RotationData::XAxis; - secondDesktop = effects->desktopDown( frontDesktop, true ); - firstFaceRot.angle = 90.0f*slideTimeLine.value(); - secondFaceRot.angle = -90.0f*(1.0f - slideTimeLine.value()); - point = rect.height()/2*tan(45.0f*M_PI/180.0f); - break; - default: - // totally impossible - return; - } - // front desktop - firstFaceRot.xRotationPoint = rect.width()/2; - firstFaceRot.yRotationPoint = rect.height()/2; - firstFaceRot.zRotationPoint = -point; - firstFaceData.rotation = &firstFaceRot; - effects->paintScreen( mask, region, firstFaceData ); - // second desktop - painting_desktop = secondDesktop; - secondFaceRot.xRotationPoint = rect.width()/2; - secondFaceRot.yRotationPoint = rect.height()/2; - secondFaceRot.zRotationPoint = -point; - secondFaceData.rotation = &secondFaceRot; - effects->paintScreen( mask, region, secondFaceData ); - cube_painting = false; - painting_desktop = effects->currentDesktop(); - } - - void CubeEffect::paintCap( float z, float zTexture ) { QRect rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop()); @@ -1072,8 +964,6 @@ void CubeEffect::postPaintScreen() keyboard_grab = false; effects->destroyInputWindow( input ); windowsOnOtherScreens.clear(); - panels.clear(); - stickyWindows.clear(); effects->setActiveFullScreenEffect( 0 ); @@ -1159,52 +1049,10 @@ void CubeEffect::postPaintScreen() effects->addRepaintFull(); return; // rotation has to end before cube is closed } - if( slide ) - { - if( slideTimeLine.value() == 1.0 ) - { - RotationDirection direction = slideRotations.dequeue(); - switch (direction) - { - case Left: - frontDesktop = effects->desktopToLeft( frontDesktop, true ); - break; - case Right: - frontDesktop = effects->desktopToRight( frontDesktop, true ); - break; - case Upwards: - frontDesktop = effects->desktopUp( frontDesktop, true ); - break; - case Downwards: - frontDesktop = effects->desktopDown( frontDesktop, true ); - break; - } - slideTimeLine.setProgress( 0.0 ); - if( !slideRotations.empty() ) - { - effects->addRepaintFull(); - return; - } - } - else - { - effects->addRepaintFull(); - return; - } - } if( schedule_close ) { schedule_close = false; - if( !slide ) - { - stop = true; - } - else - { - activated = false; - slide = false; - effects->setActiveFullScreenEffect( 0 ); - } + stop = true; effects->addRepaintFull(); } } @@ -1298,15 +1146,6 @@ void CubeEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int } w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); } - if( slide && dontSlidePanels && w->isDock()) - { - panels.insert( w ); - } - if( slide && dontSlideStickyWindows && !w->isDock() && - !w->isDesktop() && w->isOnAllDesktops()) - { - stickyWindows.insert( w ); - } } } effects->prePaintWindow( w, data, time ); @@ -1316,15 +1155,8 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP { if( activated && cube_painting ) { - if( slide && dontSlidePanels && w->isDock() ) - return; - if( slide && dontSlideStickyWindows && - w->isOnAllDesktops() && !w->isDock() && !w->isDesktop() ) - return; //kDebug(1212) << w->caption(); float opacity = cubeOpacity; - if( slide ) - opacity = 1.0f; if( start ) { opacity = 1.0 - (1.0 - opacity)*timeLine.value(); @@ -1343,19 +1175,6 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP if( painting_desktop == effects->currentDesktop() && (!w->isOnDesktop( painting_desktop )) ) opacity = cubeOpacity * (1.0 - timeLine.value()); } - bool slideOpacity = false; - // fade in windows from different desktops in first slide step - if( slide && painting_desktop == oldDesktop && (!w->isOnDesktop( painting_desktop )) ) - { - opacity = timeLine.value(); - slideOpacity = true; - } - // fade out windows from different desktops in last slide step - if( slide && rotations.empty() && painting_desktop == effects->currentDesktop() && (!w->isOnDesktop( painting_desktop )) ) - { - opacity = 1.0 - timeLine.value(); - slideOpacity = true; - } // check for windows belonging to the previous desktop int prev_desktop = painting_desktop -1; if( prev_desktop == 0 ) @@ -1411,16 +1230,13 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP opacity = cubeOpacity * (1.0 - timeLine.value()); } } - if( !slide || (slide && !w->isDesktop()) || slideOpacity ) - { - // HACK set opacity to 0.99 in case of fully opaque to ensure that windows are painted in correct sequence - // bug #173214 - if( opacity > 0.99f ) - opacity = 0.99f; - if( opacityDesktopOnly && !w->isDesktop() ) - opacity = 0.99f; - data.opacity *= opacity; - } + // HACK set opacity to 0.99 in case of fully opaque to ensure that windows are painted in correct sequence + // bug #173214 + if( opacity > 0.99f ) + opacity = 0.99f; + if( opacityDesktopOnly && !w->isDesktop() ) + opacity = 0.99f; + data.opacity *= opacity; if( w->isOnDesktop(painting_desktop) && w->x() < rect.x() ) { @@ -1470,7 +1286,7 @@ void CubeEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowP } data.quads = new_quads; } - if( w->isDesktop() && effects->numScreens() > 1 && paintCaps && !slide ) + if( w->isDesktop() && effects->numScreens() > 1 && paintCaps ) { QRegion paint = QRegion( rect ); for( int i=0; inumScreens(); i++ ) @@ -1802,22 +1618,19 @@ void CubeEffect::setActive( bool active ) effects->startMousePolling(); activated = true; activeScreen = effects->activeScreen(); - if( !slide ) - { - keyboard_grab = effects->grabKeyboard( this ); - input = effects->createInputWindow( this, 0, 0, displayWidth(), displayHeight(), - Qt::OpenHandCursor ); - frontDesktop = effects->currentDesktop(); - zoom = 0.0; - start = true; - } + keyboard_grab = effects->grabKeyboard( this ); + input = effects->createInputWindow( this, 0, 0, displayWidth(), displayHeight(), + Qt::OpenHandCursor ); + frontDesktop = effects->currentDesktop(); + zoom = 0.0; + start = true; effects->setActiveFullScreenEffect( this ); kDebug(1212) << "Cube is activated"; verticalPosition = Normal; verticalRotating = false; manualAngle = 0.0; manualVerticalAngle = 0.0; - if( reflection && !slide ) + if( reflection ) { // clip parts above the reflection area double eqn[4] = {0.0, 1.0, 0.0, 0.0}; @@ -1834,10 +1647,10 @@ void CubeEffect::setActive( bool active ) capListCreated = false; recompileList = true; // create the capList - if( paintCaps && !slide ) + if( paintCaps ) { QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && (slide || bigCube ) ) + 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); @@ -1863,10 +1676,10 @@ void CubeEffect::mouseChanged( const QPoint& pos, const QPoint& oldpos, Qt::Mous return; if( tabBoxMode ) return; - if( stop || slide ) + if( stop ) return; QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && (slide || bigCube ) ) + if( effects->numScreens() > 1 && bigCube ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); if( buttons.testFlag( Qt::LeftButton ) ) { @@ -1973,82 +1786,6 @@ void CubeEffect::windowInputMouseEvent( Window w, QEvent* e ) } } -void CubeEffect::desktopChanged( int old ) - { - if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this ) - return; - if( activated && !slide ) - return; - if( !animateDesktopChange ) - return; - slide = true; - bool activate = true; - if( !slideRotations.empty() ) - { - // last slide still in progress - activate = false; - old = frontDesktop; - RotationDirection direction = slideRotations.dequeue(); - slideRotations.clear(); - slideRotations.enqueue( direction ); - } - oldDesktop = old; - // calculate distance in respect to pager - int x, y; - Qt::Orientation orientation; - effects->calcDesktopLayout( &x, &y, &orientation ); - int x_distance = (( effects->currentDesktop() - 1 ) % x ) - (( old - 1 ) % x ); - if( qAbs( x_distance ) > x/2 ) - { - int sign = -1 * (x_distance/qAbs( x_distance )); - x_distance = sign * ( x - qAbs( x_distance )); - } - if( x_distance > 0 ) - { - for( int i=0; icurrentDesktop() -1 ) / x ) - (( old - 1 ) / x ); - if( qAbs( y_distance ) > y/2 ) - { - int sign = -1 * (y_distance/qAbs( y_distance )); - y_distance = sign * ( y - qAbs( y_distance )); - } - if( y_distance > 0 ) - { - for( int i=0; i rotations; QQueue verticalRotations; - QQueue slideRotations; QColor backgroundColor; QColor capColor; GLTexture* wallpaper; @@ -114,14 +110,9 @@ class CubeEffect bool start; bool stop; bool reflectionPainting; - bool slide; - int oldDesktop; int rotationDuration; QList windowsOnOtherScreens; - QSet panels; - QSet stickyWindows; int activeScreen; - bool animateDesktopChange; bool bigCube; bool bottomCap; bool closeOnMouseRelease; @@ -131,8 +122,6 @@ class CubeEffect bool invertKeys; bool invertMouse; bool tabBoxMode; - bool dontSlidePanels; - bool dontSlideStickyWindows; bool shortcutsRegistered; // GL lists diff --git a/effects/cube/cube_config.cpp b/effects/cube/cube_config.cpp index 643e60ecfb..c5c903e476 100644 --- a/effects/cube/cube_config.cpp +++ b/effects/cube/cube_config.cpp @@ -72,7 +72,6 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) : connect(m_ui->displayDesktopNameBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->reflectionBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->backgroundColorButton, SIGNAL(changed(QColor)), this, SLOT(changed())); - connect(m_ui->animateDesktopChangeBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->bigCubeBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged())); @@ -84,8 +83,6 @@ 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->dontSlidePanelsBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->dontSlideStickyWindowsBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); load(); } @@ -105,7 +102,6 @@ void CubeEffectConfig::load() QColor capColor = conf.readEntry( "CapColor", KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); bool texturedCaps = conf.readEntry( "TexturedCaps", true ); bool caps = conf.readEntry( "Caps", true ); - bool animateChange = conf.readEntry( "AnimateDesktopChange", false ); bool bigCube = conf.readEntry( "BigCube", false ); bool closeOnMouseRelease = conf.readEntry( "CloseOnMouseRelease", false ); bool walkThroughDesktop = conf.readEntry( "TabBox", false ); @@ -113,8 +109,6 @@ void CubeEffectConfig::load() m_ui->wallpaperRequester->setPath( conf.readEntry( "Wallpaper", "" ) ); bool invertKeys = conf.readEntry( "InvertKeys", false ); bool invertMouse = conf.readEntry( "InvertMouse", false ); - bool dontSlidePanels = conf.readEntry( "DontSlidePanels", true ); - bool dontSlideStickyWindows = conf.readEntry( "DontSlideStickyWindows", true ); m_ui->rotationDurationSpin->setValue( duration ); m_ui->cubeOpacitySlider->setValue( opacity ); @@ -152,14 +146,6 @@ void CubeEffectConfig::load() { m_ui->capsImageBox->setCheckState( Qt::Unchecked ); } - if( animateChange ) - { - m_ui->animateDesktopChangeBox->setCheckState( Qt::Checked ); - } - else - { - m_ui->animateDesktopChangeBox->setCheckState( Qt::Unchecked ); - } if( bigCube ) { m_ui->bigCubeBox->setCheckState( Qt::Checked ); @@ -188,8 +174,6 @@ void CubeEffectConfig::load() m_ui->capColorButton->setColor( capColor ); m_ui->invertKeysBox->setChecked( invertKeys ); m_ui->invertMouseBox->setChecked( invertMouse ); - m_ui->dontSlidePanelsBox->setChecked( dontSlidePanels ); - m_ui->dontSlideStickyWindowsBox->setChecked( dontSlideStickyWindows ); capsSelectionChanged(); emit changed(false); @@ -208,7 +192,6 @@ void CubeEffectConfig::save() conf.writeEntry( "Caps", m_ui->cubeCapsBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "CapColor", m_ui->capColorButton->color() ); conf.writeEntry( "TexturedCaps", m_ui->capsImageBox->checkState() == Qt::Checked ? true : false ); - conf.writeEntry( "AnimateDesktopChange", m_ui->animateDesktopChangeBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "BigCube", m_ui->bigCubeBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "CloseOnMouseRelease", m_ui->closeOnMouseReleaseBox->checkState() == Qt::Checked ? true : false ); conf.writeEntry( "Wallpaper", m_ui->wallpaperRequester->url().path() ); @@ -216,8 +199,6 @@ 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( "DontSlidePanels", m_ui->dontSlidePanelsBox->isChecked() ); - conf.writeEntry( "DontSlideStickyWindows", m_ui->dontSlideStickyWindowsBox->isChecked() ); m_ui->editor->save(); @@ -239,7 +220,6 @@ void CubeEffectConfig::defaults() m_ui->cubeCapsBox->setCheckState( Qt::Checked ); m_ui->capColorButton->setColor( KColorScheme( QPalette::Active, KColorScheme::Window ).background().color() ); m_ui->capsImageBox->setCheckState( Qt::Checked ); - m_ui->animateDesktopChangeBox->setCheckState( Qt::Unchecked ); m_ui->bigCubeBox->setCheckState( Qt::Unchecked ); m_ui->closeOnMouseReleaseBox->setCheckState( Qt::Unchecked ); m_ui->wallpaperRequester->setPath( "" ); @@ -247,8 +227,6 @@ void CubeEffectConfig::defaults() m_ui->walkThroughDesktopBox->setCheckState( Qt::Unchecked ); m_ui->invertKeysBox->setChecked( false ); m_ui->invertMouseBox->setChecked( false ); - m_ui->dontSlidePanelsBox->setChecked( true ); - m_ui->dontSlideStickyWindowsBox->setChecked( true ); m_ui->editor->allDefault(); emit changed(true); } diff --git a/effects/cube/cube_config.ui b/effects/cube/cube_config.ui index fd180f0367..4e72d7edc7 100644 --- a/effects/cube/cube_config.ui +++ b/effects/cube/cube_config.ui @@ -271,7 +271,7 @@ Tab 2 - + Caps @@ -314,6 +314,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -430,58 +443,6 @@ otherwise it will remain active - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Animate Desktop Change - - - - - - - - - Display the cube when switching desktops - - - - - - - false - - - Do not animate panels - - - - - - - false - - - Do not animate windows on all desktops - - - @@ -528,9 +489,6 @@ otherwise it will remain active walkThroughDesktopBox invertKeysBox invertMouseBox - animateDesktopChangeBox - dontSlidePanelsBox - dontSlideStickyWindowsBox zPositionSlider @@ -567,37 +525,5 @@ otherwise it will remain active - - animateDesktopChangeBox - toggled(bool) - dontSlidePanelsBox - setEnabled(bool) - - - 147 - 209 - - - 147 - 232 - - - - - animateDesktopChangeBox - toggled(bool) - dontSlideStickyWindowsBox - setEnabled(bool) - - - 53 - 209 - - - 27 - 261 - - - diff --git a/effects/cube/cubeslide.cpp b/effects/cube/cubeslide.cpp new file mode 100644 index 0000000000..dd0d5557b1 --- /dev/null +++ b/effects/cube/cubeslide.cpp @@ -0,0 +1,323 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + + Copyright (C) 2009 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 "cubeslide.h" + +#include +#include + +#include + +#include + +namespace KWin +{ + +KWIN_EFFECT( cubeslide, CubeSlideEffect ) +KWIN_EFFECT_SUPPORTED( cubeslide, CubeSlideEffect::supported() ) + +CubeSlideEffect::CubeSlideEffect() + { + reconfigure( ReconfigureAll ); + } + +CubeSlideEffect::~CubeSlideEffect() + { + } + +bool CubeSlideEffect::supported() + { + return effects->compositingType() == OpenGLCompositing; + } + +void CubeSlideEffect::reconfigure( ReconfigureFlags ) + { + KConfigGroup conf = effects->effectConfig( "CubeSlide" ); + int rotationDuration = animationTime( conf, "RotationDuration", 500 ); + timeLine.setCurveShape( TimeLine::EaseInOutCurve ); + timeLine.setDuration( rotationDuration ); + dontSlidePanels = conf.readEntry( "DontSlidePanels", true ); + dontSlideStickyWindows = conf.readEntry( "DontSlideStickyWindows", true ); + } + +void CubeSlideEffect::prePaintScreen( ScreenPrePaintData& data, int time) + { + if( !slideRotations.empty() ) + { + data.mask |= PAINT_SCREEN_TRANSFORMED | Effect::PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS | PAINT_SCREEN_BACKGROUND_FIRST; + timeLine.addTime( time ); + if( dontSlidePanels ) + panels.clear(); + if( dontSlideStickyWindows ) + stickyWindows.clear(); + } + effects->prePaintScreen( data, time ); + } + +void CubeSlideEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data) + { + if( !slideRotations.empty() ) + { + glPushMatrix(); + glNewList( glList, GL_COMPILE ); + paintSlideCube( mask, region, data ); + glEndList(); + glPopMatrix(); + + glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT ); + glEnable( GL_CULL_FACE ); + glCullFace( GL_BACK ); + glPushMatrix(); + glCallList( glList ); + glPopMatrix(); + glCullFace( GL_FRONT ); + glPushMatrix(); + glCallList( glList ); + glPopMatrix(); + glDisable( GL_CULL_FACE ); + glPopAttrib(); + if( dontSlidePanels ) + { + foreach( EffectWindow* w, panels ) + { + WindowPaintData wData( w ); + effects->paintWindow( w, 0, QRegion( w->x(), w->y(), w->width(), w->height() ), wData ); + } + } + if( dontSlideStickyWindows ) + { + foreach( EffectWindow* w, stickyWindows ) + { + WindowPaintData wData( w ); + effects->paintWindow( w, 0, QRegion( w->x(), w->y(), w->width(), w->height() ), wData ); + } + } + } + else + effects->paintScreen( mask, region, data ); + } + +void CubeSlideEffect::paintSlideCube(int mask, QRegion region, ScreenPaintData& data) + { + // slide cube only paints to desktops at a time + // first the horizontal rotations followed by vertical rotations + QRect rect = effects->clientArea( FullArea, effects->activeScreen(), effects->currentDesktop() ); + float point = rect.width()/2*tan(45.0f*M_PI/180.0f); + cube_painting = true; + painting_desktop = front_desktop; + + ScreenPaintData firstFaceData = data; + ScreenPaintData secondFaceData = data; + RotationData firstFaceRot = RotationData(); + RotationData secondFaceRot = RotationData(); + RotationDirection direction = slideRotations.head(); + int secondDesktop; + switch ( direction ) + { + case Left: + firstFaceRot.axis = RotationData::YAxis; + secondFaceRot.axis = RotationData::YAxis; + secondDesktop = effects->desktopToLeft( front_desktop, true ); + firstFaceRot.angle = 90.0f*timeLine.value(); + secondFaceRot.angle = -90.0f*(1.0f - timeLine.value()); + break; + case Right: + firstFaceRot.axis = RotationData::YAxis; + secondFaceRot.axis = RotationData::YAxis; + secondDesktop = effects->desktopToRight( front_desktop, true ); + firstFaceRot.angle = -90.0f*timeLine.value(); + secondFaceRot.angle = 90.0f*(1.0f - timeLine.value()); + break; + case Upwards: + firstFaceRot.axis = RotationData::XAxis; + secondFaceRot.axis = RotationData::XAxis; + secondDesktop = effects->desktopUp( front_desktop, true); + firstFaceRot.angle = -90.0f*timeLine.value(); + secondFaceRot.angle = 90.0f*(1.0f - timeLine.value()); + point = rect.height()/2*tan(45.0f*M_PI/180.0f); + break; + case Downwards: + firstFaceRot.axis = RotationData::XAxis; + secondFaceRot.axis = RotationData::XAxis; + secondDesktop = effects->desktopDown( front_desktop, true ); + firstFaceRot.angle = 90.0f*timeLine.value(); + secondFaceRot.angle = -90.0f*(1.0f - timeLine.value()); + point = rect.height()/2*tan(45.0f*M_PI/180.0f); + break; + default: + // totally impossible + return; + } + // front desktop + firstFaceRot.xRotationPoint = rect.width()/2; + firstFaceRot.yRotationPoint = rect.height()/2; + firstFaceRot.zRotationPoint = -point; + firstFaceData.rotation = &firstFaceRot; + effects->paintScreen( mask, region, firstFaceData ); + // second desktop + painting_desktop = secondDesktop; + secondFaceRot.xRotationPoint = rect.width()/2; + secondFaceRot.yRotationPoint = rect.height()/2; + secondFaceRot.zRotationPoint = -point; + secondFaceData.rotation = &secondFaceRot; + effects->paintScreen( mask, region, secondFaceData ); + cube_painting = false; + painting_desktop = effects->currentDesktop(); + } + +void CubeSlideEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time) + { + if( !slideRotations.empty() && cube_painting ) + { + if( dontSlidePanels && w->isDock()) + { + panels.insert( w ); + } + if( dontSlideStickyWindows && !w->isDock() && + !w->isDesktop() && w->isOnAllDesktops()) + { + stickyWindows.insert( w ); + } + if( w->isOnDesktop( painting_desktop ) ) + w->enablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); + else + w->disablePainting( EffectWindow::PAINT_DISABLED_BY_DESKTOP ); + } + effects->prePaintWindow( w, data, time ); + } + +void CubeSlideEffect::paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data) + { + if( !slideRotations.empty() && cube_painting ) + { + if( dontSlidePanels && w->isDock() ) + return; + if( dontSlideStickyWindows && + w->isOnAllDesktops() && !w->isDock() && !w->isDesktop() ) + return; + } + effects->paintWindow( w, mask, region, data ); + } + +void CubeSlideEffect::postPaintScreen() + { + effects->postPaintScreen(); + if( !slideRotations.empty() ) + { + if( timeLine.value() == 1.0 ) + { + RotationDirection direction = slideRotations.dequeue(); + switch (direction) + { + case Left: + front_desktop = effects->desktopToLeft( front_desktop, true ); + break; + case Right: + front_desktop = effects->desktopToRight( front_desktop, true ); + break; + case Upwards: + front_desktop = effects->desktopUp( front_desktop, true ); + break; + case Downwards: + front_desktop = effects->desktopDown( front_desktop, true ); + break; + } + timeLine.setProgress( 0.0 ); + if( slideRotations.empty() ) + { + effects->setActiveFullScreenEffect( 0 ); + glDeleteLists( glList, 1 ); + } + } + effects->addRepaintFull(); + } + } + +void CubeSlideEffect::desktopChanged( int old ) + { + if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this ) + return; + bool activate = true; + if( !slideRotations.empty() ) + { + // last slide still in progress + activate = false; + old = front_desktop; + RotationDirection direction = slideRotations.dequeue(); + slideRotations.clear(); + slideRotations.enqueue( direction ); + } + // calculate distance in respect to pager + int x, y; + Qt::Orientation orientation; + effects->calcDesktopLayout( &x, &y, &orientation ); + int x_distance = (( effects->currentDesktop() - 1 ) % x ) - (( old - 1 ) % x ); + if( qAbs( x_distance ) > x/2 ) + { + int sign = -1 * (x_distance/qAbs( x_distance )); + x_distance = sign * ( x - qAbs( x_distance )); + } + if( x_distance > 0 ) + { + for( int i=0; icurrentDesktop() -1 ) / x ) - (( old - 1 ) / x ); + if( qAbs( y_distance ) > y/2 ) + { + int sign = -1 * (y_distance/qAbs( y_distance )); + y_distance = sign * ( y - qAbs( y_distance )); + } + if( y_distance > 0 ) + { + for( int i=0; isetActiveFullScreenEffect( this ); + glList = glGenLists( 1 ); + timeLine.setProgress( 0.0 ); + front_desktop = old; + effects->addRepaintFull(); + } + } + +} // namespace diff --git a/effects/cube/cubeslide.desktop b/effects/cube/cubeslide.desktop new file mode 100644 index 0000000000..83dcedf2b3 --- /dev/null +++ b/effects/cube/cubeslide.desktop @@ -0,0 +1,17 @@ +[Desktop Entry] +Name=Desktop Cube Animation +Icon=preferences-system-windows-effect-cube +Comment=Animate desktop switching with a cube + +Type=Service +X-KDE-ServiceTypes=KWin/Effect +X-KDE-PluginInfo-Author=Martin Gräßlin +X-KDE-PluginInfo-Email=kde@martin-graesslin.com +X-KDE-PluginInfo-Name=kwin4_effect_cubeslide +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/cubeslide.h b/effects/cube/cubeslide.h new file mode 100644 index 0000000000..5f2f5a5b23 --- /dev/null +++ b/effects/cube/cubeslide.h @@ -0,0 +1,68 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + + Copyright (C) 2009 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_CUBESLIDE_H +#define KWIN_CUBESLIDE_H + +#include +#include +#include +#include + +namespace KWin +{ +class CubeSlideEffect + : public Effect + { + public: + CubeSlideEffect(); + ~CubeSlideEffect(); + virtual void reconfigure( ReconfigureFlags ); + virtual void prePaintScreen( ScreenPrePaintData& data, int time ); + virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data ); + virtual void postPaintScreen(); + virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time ); + virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data ); + virtual void desktopChanged( int old ); + + static bool supported(); + private: + enum RotationDirection + { + Left, + Right, + Upwards, + Downwards + }; + void paintSlideCube( int mask, QRegion region, ScreenPaintData& data ); + bool cube_painting; + int front_desktop; + int painting_desktop; + TimeLine timeLine; + QQueue slideRotations; + QSet panels; + QSet stickyWindows; + bool dontSlidePanels; + bool dontSlideStickyWindows; + GLuint glList; + }; +} + +#endif diff --git a/effects/cube/cubeslide_config.cpp b/effects/cube/cubeslide_config.cpp new file mode 100644 index 0000000000..78e6a4180a --- /dev/null +++ b/effects/cube/cubeslide_config.cpp @@ -0,0 +1,94 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + + Copyright (C) 2009 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 "cubeslide_config.h" +#include + +#include +#include +#include + +namespace KWin +{ + +KWIN_EFFECT_CONFIG_FACTORY + +CubeSlideEffectConfigForm::CubeSlideEffectConfigForm(QWidget* parent) : QWidget(parent) +{ + setupUi(this); +} + +CubeSlideEffectConfig::CubeSlideEffectConfig(QWidget* parent, const QVariantList& args) : + KCModule(EffectFactory::componentData(), parent, args) + { + m_ui = new CubeSlideEffectConfigForm(this); + + QVBoxLayout* layout = new QVBoxLayout(this); + + layout->addWidget(m_ui); + + connect(m_ui->rotationDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); + connect(m_ui->dontSlidePanelsBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); + connect(m_ui->dontSlideStickyWindowsBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); + + load(); + } + +void CubeSlideEffectConfig::load() + { + KCModule::load(); + + KConfigGroup conf = EffectsHandler::effectConfig( "CubeSlide" ); + + int duration = conf.readEntry( "RotationDuration", 0 ); + bool dontSlidePanels = conf.readEntry( "DontSlidePanels", true ); + bool dontSlideStickyWindows = conf.readEntry( "DontSlideStickyWindows", true ); + + m_ui->rotationDurationSpin->setValue( duration ); + m_ui->dontSlidePanelsBox->setChecked( dontSlidePanels ); + m_ui->dontSlideStickyWindowsBox->setChecked( dontSlideStickyWindows ); + + emit changed(false); + } + +void CubeSlideEffectConfig::save() + { + KConfigGroup conf = EffectsHandler::effectConfig( "CubeSlide" ); + + conf.writeEntry( "RotationDuration", m_ui->rotationDurationSpin->value() ); + conf.writeEntry( "DontSlidePanels", m_ui->dontSlidePanelsBox->isChecked() ); + conf.writeEntry( "DontSlideStickyWindows", m_ui->dontSlideStickyWindowsBox->isChecked() ); + + conf.sync(); + + emit changed(false); + EffectsHandler::sendReloadMessage( "cubeslide" ); + } + +void CubeSlideEffectConfig::defaults() + { + m_ui->rotationDurationSpin->setValue( 0 ); + m_ui->dontSlidePanelsBox->setChecked( true ); + m_ui->dontSlideStickyWindowsBox->setChecked( true ); + emit changed(true); + } + +} // namespace + +#include "cubeslide_config.moc" diff --git a/effects/cube/cubeslide_config.desktop b/effects/cube/cubeslide_config.desktop new file mode 100644 index 0000000000..3720328ee5 --- /dev/null +++ b/effects/cube/cubeslide_config.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Service +X-KDE-ServiceTypes=KCModule + +X-KDE-Library=kcm_kwin4_effect_builtins +X-KDE-ParentComponents=kwin4_effect_cubeslide +X-KDE-PluginKeyword=cubeslide + +Name=Desktop Cube Animation diff --git a/effects/cube/cubeslide_config.h b/effects/cube/cubeslide_config.h new file mode 100644 index 0000000000..6ebfde7435 --- /dev/null +++ b/effects/cube/cubeslide_config.h @@ -0,0 +1,56 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + + Copyright (C) 2009 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_CUBESLIDE_CONFIG_H +#define KWIN_CUBESLIDE_CONFIG_H + +#include + +#include "ui_cubeslide_config.h" + +class KFileDialog; + +namespace KWin +{ + +class CubeSlideEffectConfigForm : public QWidget, public Ui::CubeSlideEffectConfigForm +{ + Q_OBJECT + public: + explicit CubeSlideEffectConfigForm(QWidget* parent); +}; + +class CubeSlideEffectConfig : public KCModule + { + Q_OBJECT + public: + explicit CubeSlideEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + + public slots: + virtual void save(); + virtual void load(); + virtual void defaults(); + private: + CubeSlideEffectConfigForm* m_ui; + }; + +} // namespace + +#endif diff --git a/effects/cube/cubeslide_config.ui b/effects/cube/cubeslide_config.ui new file mode 100644 index 0000000000..dc3ab67c6a --- /dev/null +++ b/effects/cube/cubeslide_config.ui @@ -0,0 +1,97 @@ + + KWin::CubeSlideEffectConfigForm + + + + 0 + 0 + 342 + 126 + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + Default + + + msec + + + 5000 + + + 10 + + + + + + + Do not animate panels + + + + + + + Do not animate windows on all desktops + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Rotation duration: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + rotationDurationSpin + + + + + tabWidget + groupBox + dontSlideStickyWindowsBox + verticalSpacer + rotationDurationSpin + dontSlidePanelsBox + label + + + rotationDurationSpin + dontSlidePanelsBox + dontSlideStickyWindowsBox + + + + diff --git a/effects/cube/cylinder.cpp b/effects/cube/cylinder.cpp index e5dfe8ca5b..2cfec92a7d 100644 --- a/effects/cube/cylinder.cpp +++ b/effects/cube/cylinder.cpp @@ -82,7 +82,7 @@ bool CylinderEffect::loadData() mShader->setUniform( "winTexture", 0 ); mShader->setUniform( "opacity", cubeOpacity ); QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && (slide || bigCube ) ) + if( effects->numScreens() > 1 && bigCube ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); mShader->setUniform( "width", (float)rect.width() ); mShader->unbind(); diff --git a/effects/cube/sphere.cpp b/effects/cube/sphere.cpp index 2b63ccb1d4..674d69d2a7 100644 --- a/effects/cube/sphere.cpp +++ b/effects/cube/sphere.cpp @@ -82,7 +82,7 @@ bool SphereEffect::loadData() mShader->setUniform( "winTexture", 0 ); mShader->setUniform( "opacity", cubeOpacity ); QRect rect = effects->clientArea( FullScreenArea, activeScreen, effects->currentDesktop()); - if( effects->numScreens() > 1 && (slide || bigCube ) ) + if( effects->numScreens() > 1 && bigCube ) rect = effects->clientArea( FullArea, activeScreen, effects->currentDesktop() ); mShader->setUniform( "width", (float)rect.width() ); mShader->setUniform( "height", (float)rect.height() ); diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 27ff713016..af16574f48 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -181,7 +181,7 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_slide'"); if( !services.isEmpty() ) slide = services.first()->name(); - services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_cube'"); + services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_cubeslide'"); if( !services.isEmpty() ) cube = services.first()->name(); services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_fadedesktop'"); @@ -339,8 +339,7 @@ void KWinCompositingConfig::loadGeneralTab() ui.desktopSwitchingCombo->setCurrentIndex( 0 ); if( effectEnabled( "slide", effectconfig )) ui.desktopSwitchingCombo->setCurrentIndex( 1 ); - KConfigGroup cubeconfig(mKWinConfig, "Effect-Cube"); - if( effectEnabled( "cube", effectconfig ) && cubeconfig.readEntry("AnimateDesktopChange", false)) + if( effectEnabled( "cubeslide", effectconfig )) ui.desktopSwitchingCombo->setCurrentIndex( 2 ); if( effectEnabled( "fadedesktop", effectconfig )) ui.desktopSwitchingCombo->setCurrentIndex( 3 ); @@ -472,34 +471,33 @@ void KWinCompositingConfig::saveGeneralTab() presentwindowsconfig.writeEntry("TabBox", presentWindowSwitching); int desktopSwitcher = ui.desktopSwitchingCombo->currentIndex(); - bool cubeDesktopSwitching = false; switch( desktopSwitcher ) { case 0: // no effect effectconfig.writeEntry("kwin4_effect_slideEnabled", false); + effectconfig.writeEntry("kwin4_effect_cubeslideEnabled", false); effectconfig.writeEntry("kwin4_effect_fadedesktopEnabled", false); break; case 1: // slide effectconfig.writeEntry("kwin4_effect_slideEnabled", true); + effectconfig.writeEntry("kwin4_effect_cubeslideEnabled", false); effectconfig.writeEntry("kwin4_effect_fadedesktopEnabled", false); break; case 2: // cube - cubeDesktopSwitching = true; effectconfig.writeEntry("kwin4_effect_slideEnabled", false); - effectconfig.writeEntry("kwin4_effect_cubeEnabled", true); + effectconfig.writeEntry("kwin4_effect_cubeslideEnabled", true); effectconfig.writeEntry("kwin4_effect_fadedesktopEnabled", false); break; case 3: // fadedesktop effectconfig.writeEntry("kwin4_effect_slideEnabled", false); + effectconfig.writeEntry("kwin4_effect_cubeslideEnabled", false); effectconfig.writeEntry("kwin4_effect_fadedesktopEnabled", true); break; } - KConfigGroup cubeconfig(mKWinConfig, "Effect-Cube"); - cubeconfig.writeEntry("AnimateDesktopChange", cubeDesktopSwitching); } void KWinCompositingConfig::saveEffectsTab()