Commit dd28e15a authored by Lucas Murray's avatar Lucas Murray
Browse files

Allow desktop effects to access the new DesktopLayout class. Replaced

all code that used calcDesktopLayout() so the function could be removed.
Minor changes to the DesktopLayout class itself.

svn path=/trunk/KDE/kdebase/workspace/; revision=925930
parent 4681129e
...@@ -59,20 +59,21 @@ void DesktopLayout::setNETDesktopLayout( Qt::Orientation orientation, int width, ...@@ -59,20 +59,21 @@ void DesktopLayout::setNETDesktopLayout( Qt::Orientation orientation, int width,
height = ( m_count + width - 1 ) / width; height = ( m_count + width - 1 ) / width;
// Set private variables // Set private variables
m_gridSize = QSize( width, height );
delete[] m_grid; delete[] m_grid;
m_grid = new int[width * height]; m_gridSize = QSize( width, height );
int size = width * height;
m_grid = new int[size];
// Populate grid // Populate grid
int desktop = 1; int desktop = 1;
if( orientation == Qt::Horizontal ) if( orientation == Qt::Horizontal )
for( int y = 0; y < height; y++ ) for( int y = 0; y < height; y++ )
for( int x = 0; x < width; x++ ) for( int x = 0; x < width; x++ )
m_grid[y * height + x] = (desktop <= m_count ? desktop++ : 0); m_grid[y * width + x] = (desktop <= m_count ? desktop++ : 0);
else else
for( int x = 0; x < width; x++ ) for( int x = 0; x < width; x++ )
for( int y = 0; y < height; y++ ) for( int y = 0; y < height; y++ )
m_grid[y * height + x] = (desktop <= m_count ? desktop++ : 0); m_grid[y * width + x] = (desktop <= m_count ? desktop++ : 0);
} }
QPoint DesktopLayout::desktopGridCoords( int id ) const QPoint DesktopLayout::desktopGridCoords( int id ) const
......
...@@ -46,6 +46,10 @@ class DesktopLayout ...@@ -46,6 +46,10 @@ class DesktopLayout
*/ */
void setNumberOfDesktops( int count ); void setNumberOfDesktops( int count );
/**
* @returns The size of desktop layout in grid units.
*/
QSize gridSize() const;
/** /**
* @returns The width of desktop layout in grid units. * @returns The width of desktop layout in grid units.
*/ */
...@@ -146,6 +150,11 @@ inline int DesktopLayout::numberOfDesktops() const ...@@ -146,6 +150,11 @@ inline int DesktopLayout::numberOfDesktops() const
return m_count; return m_count;
} }
inline QSize DesktopLayout::gridSize() const
{
return m_gridSize;
}
inline int DesktopLayout::gridWidth() const inline int DesktopLayout::gridWidth() const
{ {
return m_gridSize.width(); return m_gridSize.width();
...@@ -180,7 +189,7 @@ inline void DesktopLayout::setCurrentDesktop( int current ) ...@@ -180,7 +189,7 @@ inline void DesktopLayout::setCurrentDesktop( int current )
inline int DesktopLayout::desktopAtCoords( QPoint coords ) const inline int DesktopLayout::desktopAtCoords( QPoint coords ) const
{ {
return m_grid[coords.y() * m_gridSize.height() + coords.x()]; return m_grid[coords.y() * m_gridSize.width() + coords.x()];
} }
inline bool DesktopLayout::isDynamic() const inline bool DesktopLayout::isDynamic() const
......
...@@ -446,39 +446,89 @@ void EffectsHandlerImpl::setCurrentDesktop( int desktop ) ...@@ -446,39 +446,89 @@ void EffectsHandlerImpl::setCurrentDesktop( int desktop )
Workspace::self()->setCurrentDesktop( desktop ); Workspace::self()->setCurrentDesktop( desktop );
} }
QString EffectsHandlerImpl::desktopName( int desktop ) const QSize EffectsHandlerImpl::desktopGridSize() const
{ {
return Workspace::self()->desktopName( desktop ); return Workspace::self()->getDesktopLayout()->gridSize();
} }
void EffectsHandlerImpl::calcDesktopLayout(int* x, int* y, Qt::Orientation* orientation) const int EffectsHandlerImpl::desktopGridWidth() const
{ {
Workspace::self()->calcDesktopLayout( x, y, orientation ); return Workspace::self()->getDesktopLayout()->gridWidth();
} }
bool EffectsHandlerImpl::optionRollOverDesktops() const int EffectsHandlerImpl::desktopGridHeight() const
{ {
return options->rollOverDesktops; return Workspace::self()->getDesktopLayout()->gridHeight();
} }
int EffectsHandlerImpl::desktopToLeft( int desktop, bool wrap ) const int EffectsHandlerImpl::workspaceWidth() const
{
return Workspace::self()->getDesktopLayout()->width();
}
int EffectsHandlerImpl::workspaceHeight() const
{
return Workspace::self()->getDesktopLayout()->height();
}
int EffectsHandlerImpl::desktopAtCoords( QPoint coords ) const
{
return Workspace::self()->getDesktopLayout()->desktopAtCoords( coords );
}
QPoint EffectsHandlerImpl::desktopGridCoords( int id ) const
{
return Workspace::self()->getDesktopLayout()->desktopGridCoords( id );
}
QPoint EffectsHandlerImpl::desktopCoords( int id ) const
{
return Workspace::self()->getDesktopLayout()->desktopCoords( id );
}
int EffectsHandlerImpl::desktopAbove( int desktop, bool wrap ) const
{ {
return Workspace::self()->desktopToLeft( desktop, wrap ); return Workspace::self()->getDesktopLayout()->desktopAbove( desktop, wrap );
} }
int EffectsHandlerImpl::desktopToRight( int desktop, bool wrap ) const int EffectsHandlerImpl::desktopToRight( int desktop, bool wrap ) const
{ {
return Workspace::self()->desktopToRight( desktop, wrap ); return Workspace::self()->getDesktopLayout()->desktopToRight( desktop, wrap );
} }
int EffectsHandlerImpl::desktopUp( int desktop, bool wrap ) const int EffectsHandlerImpl::desktopBelow( int desktop, bool wrap ) const
{ {
return Workspace::self()->desktopUp( desktop, wrap ); return Workspace::self()->getDesktopLayout()->desktopBelow( desktop, wrap );
} }
int EffectsHandlerImpl::desktopDown( int desktop, bool wrap ) const int EffectsHandlerImpl::desktopToLeft( int desktop, bool wrap ) const
{
return Workspace::self()->getDesktopLayout()->desktopToLeft( desktop, wrap );
}
bool EffectsHandlerImpl::desktopLayoutIsDynamic() const
{
return Workspace::self()->getDesktopLayout()->isDynamic();
}
int EffectsHandlerImpl::addDesktop( QPoint coords )
{
return Workspace::self()->getDesktopLayout()->addDesktop( coords );
}
void EffectsHandlerImpl::deleteDesktop( int id )
{ {
return Workspace::self()->desktopDown( desktop, wrap ); Workspace::self()->getDesktopLayout()->deleteDesktop( id );
}
QString EffectsHandlerImpl::desktopName( int desktop ) const
{
return Workspace::self()->desktopName( desktop );
}
bool EffectsHandlerImpl::optionRollOverDesktops() const
{
return options->rollOverDesktops;
} }
double EffectsHandlerImpl::animationTimeFactor() const double EffectsHandlerImpl::animationTimeFactor() const
......
...@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "kwineffects.h" #include "kwineffects.h"
#include "desktoplayout.h"
#include "scene.h" #include "scene.h"
#include <QStack> #include <QStack>
...@@ -59,7 +60,24 @@ class EffectsHandlerImpl : public EffectsHandler ...@@ -59,7 +60,24 @@ class EffectsHandlerImpl : public EffectsHandler
virtual int currentDesktop() const; virtual int currentDesktop() const;
virtual int numberOfDesktops() const; virtual int numberOfDesktops() const;
virtual void setCurrentDesktop( int desktop ); virtual void setCurrentDesktop( int desktop );
virtual QSize desktopGridSize() const;
virtual int desktopGridWidth() const;
virtual int desktopGridHeight() const;
virtual int workspaceWidth() const;
virtual int workspaceHeight() const;
virtual int desktopAtCoords( QPoint coords ) const;
virtual QPoint desktopGridCoords( int id ) const;
virtual QPoint desktopCoords( int id ) const;
virtual int desktopAbove( int desktop = 0, bool wrap = true ) const;
virtual int desktopToRight( int desktop = 0, bool wrap = true ) const;
virtual int desktopBelow( int desktop = 0, bool wrap = true ) const;
virtual int desktopToLeft( int desktop = 0, bool wrap = true ) const;
virtual bool desktopLayoutIsDynamic() const;
virtual int addDesktop( QPoint coords );
virtual void deleteDesktop( int id );
virtual QString desktopName( int desktop ) const; virtual QString desktopName( int desktop ) const;
virtual bool optionRollOverDesktops() const;
virtual int displayWidth() const; virtual int displayWidth() const;
virtual int displayHeight() const; virtual int displayHeight() const;
virtual QPoint cursorPos() const; virtual QPoint cursorPos() const;
...@@ -98,12 +116,6 @@ class EffectsHandlerImpl : public EffectsHandler ...@@ -98,12 +116,6 @@ class EffectsHandlerImpl : public EffectsHandler
virtual QRect clientArea( clientAreaOption, int screen, int desktop ) const; virtual QRect clientArea( clientAreaOption, int screen, int desktop ) const;
virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const; virtual QRect clientArea( clientAreaOption, const EffectWindow* c ) const;
virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const; virtual QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
virtual void calcDesktopLayout(int* x, int* y, Qt::Orientation* orientation) const;
virtual bool optionRollOverDesktops() const;
virtual int desktopToLeft( int desktop, bool wrap ) const;
virtual int desktopToRight( int desktop, bool wrap ) const;
virtual int desktopUp( int desktop, bool wrap ) const;
virtual int desktopDown( int desktop, bool wrap ) const;
virtual double animationTimeFactor() const; virtual double animationTimeFactor() const;
virtual WindowQuadType newWindowQuadType(); virtual WindowQuadType newWindowQuadType();
......
...@@ -148,7 +148,7 @@ void CubeSlideEffect::paintSlideCube(int mask, QRegion region, ScreenPaintData& ...@@ -148,7 +148,7 @@ void CubeSlideEffect::paintSlideCube(int mask, QRegion region, ScreenPaintData&
case Upwards: case Upwards:
firstFaceRot.axis = RotationData::XAxis; firstFaceRot.axis = RotationData::XAxis;
secondFaceRot.axis = RotationData::XAxis; secondFaceRot.axis = RotationData::XAxis;
secondDesktop = effects->desktopUp( front_desktop, true); secondDesktop = effects->desktopAbove( front_desktop, true);
firstFaceRot.angle = -90.0f*timeLine.value(); firstFaceRot.angle = -90.0f*timeLine.value();
secondFaceRot.angle = 90.0f*(1.0f - timeLine.value()); secondFaceRot.angle = 90.0f*(1.0f - timeLine.value());
point = rect.height()/2*tan(45.0f*M_PI/180.0f); point = rect.height()/2*tan(45.0f*M_PI/180.0f);
...@@ -156,7 +156,7 @@ void CubeSlideEffect::paintSlideCube(int mask, QRegion region, ScreenPaintData& ...@@ -156,7 +156,7 @@ void CubeSlideEffect::paintSlideCube(int mask, QRegion region, ScreenPaintData&
case Downwards: case Downwards:
firstFaceRot.axis = RotationData::XAxis; firstFaceRot.axis = RotationData::XAxis;
secondFaceRot.axis = RotationData::XAxis; secondFaceRot.axis = RotationData::XAxis;
secondDesktop = effects->desktopDown( front_desktop, true ); secondDesktop = effects->desktopBelow( front_desktop, true );
firstFaceRot.angle = 90.0f*timeLine.value(); firstFaceRot.angle = 90.0f*timeLine.value();
secondFaceRot.angle = -90.0f*(1.0f - timeLine.value()); secondFaceRot.angle = -90.0f*(1.0f - timeLine.value());
point = rect.height()/2*tan(45.0f*M_PI/180.0f); point = rect.height()/2*tan(45.0f*M_PI/180.0f);
...@@ -233,10 +233,10 @@ void CubeSlideEffect::postPaintScreen() ...@@ -233,10 +233,10 @@ void CubeSlideEffect::postPaintScreen()
front_desktop = effects->desktopToRight( front_desktop, true ); front_desktop = effects->desktopToRight( front_desktop, true );
break; break;
case Upwards: case Upwards:
front_desktop = effects->desktopUp( front_desktop, true ); front_desktop = effects->desktopAbove( front_desktop, true );
break; break;
case Downwards: case Downwards:
front_desktop = effects->desktopDown( front_desktop, true ); front_desktop = effects->desktopBelow( front_desktop, true );
break; break;
} }
timeLine.setProgress( 0.0 ); timeLine.setProgress( 0.0 );
...@@ -265,47 +265,43 @@ void CubeSlideEffect::desktopChanged( int old ) ...@@ -265,47 +265,43 @@ void CubeSlideEffect::desktopChanged( int old )
slideRotations.enqueue( direction ); slideRotations.enqueue( direction );
} }
// calculate distance in respect to pager // calculate distance in respect to pager
int x, y; QPoint diff = effects->desktopGridCoords( effects->currentDesktop() ) - effects->desktopGridCoords( old );
Qt::Orientation orientation; if( qAbs( diff.x() ) > effects->desktopGridWidth()/2 )
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 )); int sign = -1 * (diff.x()/qAbs( diff.x() ));
x_distance = sign * ( x - qAbs( x_distance )); diff.setX( sign * ( effects->desktopGridWidth() - qAbs( diff.x() )));
} }
if( x_distance > 0 ) if( diff.x() > 0 )
{ {
for( int i=0; i<x_distance; i++ ) for( int i=0; i<diff.x(); i++ )
{ {
slideRotations.enqueue( Right ); slideRotations.enqueue( Right );
} }
} }
else if( x_distance < 0 ) else if( diff.x() < 0 )
{ {
x_distance *= -1; diff.setX( -diff.x() );
for( int i=0; i<x_distance; i++ ) for( int i=0; i<diff.x(); i++ )
{ {
slideRotations.enqueue( Left ); slideRotations.enqueue( Left );
} }
} }
int y_distance = (( effects->currentDesktop() -1 ) / x ) - (( old - 1 ) / x ); if( qAbs( diff.y() ) > effects->desktopGridHeight()/2 )
if( qAbs( y_distance ) > y/2 )
{ {
int sign = -1 * (y_distance/qAbs( y_distance )); int sign = -1 * (diff.y()/qAbs( diff.y() ));
y_distance = sign * ( y - qAbs( y_distance )); diff.setY( sign * ( effects->desktopGridHeight() - qAbs( diff.y() )));
} }
if( y_distance > 0 ) if( diff.y() > 0 )
{ {
for( int i=0; i<y_distance; i++ ) for( int i=0; i<diff.y(); i++ )
{ {
slideRotations.enqueue( Downwards ); slideRotations.enqueue( Downwards );
} }
} }
if( y_distance < 0 ) if( diff.y() < 0 )
{ {
y_distance *= -1; diff.setY( -diff.y() );
for( int i=0; i<y_distance; i++ ) for( int i=0; i<diff.y(); i++ )
{ {
slideRotations.enqueue( Upwards ); slideRotations.enqueue( Upwards );
} }
......
...@@ -37,6 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -37,6 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin namespace KWin
{ {
// WARNING, TODO: This effect relies on the desktop layout being EWMH-compliant.
KWIN_EFFECT( desktopgrid, DesktopGridEffect ) KWIN_EFFECT( desktopgrid, DesktopGridEffect )
DesktopGridEffect::DesktopGridEffect() DesktopGridEffect::DesktopGridEffect()
...@@ -755,7 +757,8 @@ void DesktopGridEffect::setup() ...@@ -755,7 +757,8 @@ void DesktopGridEffect::setup()
{ {
default: default:
case LayoutPager: case LayoutPager:
effects->calcDesktopLayout( &gridSize.rwidth(), &gridSize.rheight(), &orientation ); orientation = Qt::Horizontal;
gridSize = effects->desktopGridSize();
break; break;
case LayoutAutomatic: case LayoutAutomatic:
y = sqrt( numDesktops ) + 0.5; y = sqrt( numDesktops ) + 0.5;
...@@ -767,7 +770,7 @@ void DesktopGridEffect::setup() ...@@ -767,7 +770,7 @@ void DesktopGridEffect::setup()
gridSize.setHeight( y ); gridSize.setHeight( y );
break; break;
case LayoutCustom: case LayoutCustom:
effects->calcDesktopLayout( &gridSize.rwidth(), &gridSize.rheight(), &orientation ); orientation = Qt::Horizontal;
gridSize.setWidth( ceil( effects->numberOfDesktops() / double( customLayoutRows ))); gridSize.setWidth( ceil( effects->numberOfDesktops() / double( customLayoutRows )));
gridSize.setHeight( customLayoutRows ); gridSize.setHeight( customLayoutRows );
break; break;
......
...@@ -162,26 +162,8 @@ void HighlightWindowEffect::propertyNotify( EffectWindow* w, long a ) ...@@ -162,26 +162,8 @@ void HighlightWindowEffect::propertyNotify( EffectWindow* w, long a )
thumbRect = m_highlightedWindow->geometry(); thumbRect = m_highlightedWindow->geometry();
// Determine position of desktop relative to the current one // Determine position of desktop relative to the current one
QSize grid; QPoint direction = effects->desktopGridCoords( m_highlightedWindow->desktop() ) -
Qt::Orientation orientation; effects->desktopGridCoords( effects->currentDesktop() );
effects->calcDesktopLayout( &grid.rwidth(), &grid.rheight(), &orientation );
QPoint currentDesktop;
QPoint targetDesktop;
if( orientation == Qt::Horizontal )
{
currentDesktop.setX(( effects->currentDesktop() - 1 ) % grid.width() + 1 );
currentDesktop.setY(( effects->currentDesktop() - 1 ) / grid.width() + 1 );
targetDesktop.setX(( m_highlightedWindow->desktop() - 1 ) % grid.width() + 1 );
targetDesktop.setY(( m_highlightedWindow->desktop() - 1 ) / grid.width() + 1 );
}
else
{
currentDesktop.setX(( effects->currentDesktop() - 1 ) / grid.height() + 1 );
currentDesktop.setY(( effects->currentDesktop() - 1 ) % grid.height() + 1 );
targetDesktop.setX(( m_highlightedWindow->desktop() - 1 ) / grid.height() + 1 );
targetDesktop.setY(( m_highlightedWindow->desktop() - 1 ) % grid.height() + 1 );
}
QPoint direction = targetDesktop - currentDesktop;
// Draw a line from the center of the current desktop to the center of the target desktop. // Draw a line from the center of the current desktop to the center of the target desktop.
QPointF desktopLine( 0, 0, direction.x() * screenArea.width(), direction.y() * screenArea.height() ); QPointF desktopLine( 0, 0, direction.x() * screenArea.width(), direction.y() * screenArea.height() );
......
...@@ -92,17 +92,14 @@ void SlideEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) ...@@ -92,17 +92,14 @@ void SlideEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
of it, the destination is computed from the current desktop. Positions of desktops of it, the destination is computed from the current desktop. Positions of desktops
are done using their topleft corner. are done using their topleft corner.
*/ */
QPoint destPos = desktopRect( effects->currentDesktop(), false ).topLeft(); QPoint destPos = desktopRect( effects->currentDesktop() ).topLeft();
QPoint diffPos = destPos - slide_start_pos; QPoint diffPos = destPos - slide_start_pos;
int w = 0; int w = 0;
int h = 0; int h = 0;
if( effects->optionRollOverDesktops()) if( effects->optionRollOverDesktops())
{ {
int x, y; w = effects->workspaceWidth();
Qt::Orientation orientation; h = effects->workspaceHeight();
effects->calcDesktopLayout( &x, &y, &orientation );
w = x * displayWidth();
h = y * displayHeight();
// wrap around if shorter // wrap around if shorter
if( diffPos.x() > 0 && diffPos.x() > w / 2 ) if( diffPos.x() > 0 && diffPos.x() > w / 2 )
diffPos.setX( diffPos.x() - w ); diffPos.setX( diffPos.x() - w );
...@@ -128,7 +125,7 @@ void SlideEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) ...@@ -128,7 +125,7 @@ void SlideEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
desktop <= effects->numberOfDesktops(); desktop <= effects->numberOfDesktops();
++desktop ) ++desktop )
{ {
QRect rect = desktopRect( desktop, false ); QRect rect = desktopRect( desktop );
if( currentRegion.contains( rect )) // part of the desktop needs painting if( currentRegion.contains( rect )) // part of the desktop needs painting
{ {
painting_desktop = desktop; painting_desktop = desktop;
...@@ -176,27 +173,10 @@ void SlideEffect::postPaintScreen() ...@@ -176,27 +173,10 @@ void SlideEffect::postPaintScreen()
} }
// Gives a position of the given desktop when all desktops are arranged in a grid // Gives a position of the given desktop when all desktops are arranged in a grid
QRect SlideEffect::desktopRect( int desktop, bool scaled ) const QRect SlideEffect::desktopRect( int desktop ) const
{ {
int x, y; QRect rect( 0, 0, displayWidth(), displayHeight() );
Qt::Orientation orientation; rect.translate( effects->desktopCoords( desktop ));
effects->calcDesktopLayout( &x, &y, &orientation );
--desktop; // make it start with 0
QRect rect;
if( orientation == Qt::Horizontal )
rect = QRect(( desktop % x ) * displayWidth(), ( desktop / x ) * displayHeight(),
displayWidth(), displayHeight());
else
rect = QRect(( desktop / y ) * displayWidth(), ( desktop % y ) * displayHeight(),
displayWidth(), displayHeight());
if( !scaled )
return rect;
QRect current = desktopRect( effects->currentDesktop(), false );
double progress = mTimeLine.value();
rect = QRect( qRound( interpolate( rect.x() - current.x(), rect.x() / double( x ), progress )),
qRound( interpolate( rect.y() - current.y(), rect.y() / double( y ), progress )),
qRound( interpolate( rect.width(), displayWidth() / double( x ), progress )),
qRound( interpolate( rect.height(), displayHeight() / double( y ), progress )));
return rect; return rect;
} }
...@@ -207,16 +187,13 @@ void SlideEffect::desktopChanged( int old ) ...@@ -207,16 +187,13 @@ void SlideEffect::desktopChanged( int old )
if( slide ) // old slide still in progress if( slide ) // old slide still in progress
{ {
QPoint diffPos = desktopRect( old, false ).topLeft() - slide_start_pos; QPoint diffPos = desktopRect( old ).topLeft() - slide_start_pos;
int w = 0; int w = 0;
int h = 0; int h = 0;
if( effects->optionRollOverDesktops()) if( effects->optionRollOverDesktops())
{ {
int x, y; w = effects->workspaceWidth();
Qt::Orientation orientation; h = effects->workspaceHeight();
effects->calcDesktopLayout( &x, &y, &orientation );
w = x * displayWidth();
h = y * displayHeight();
// wrap around if shorter // wrap around if shorter
if( diffPos.x() > 0 && diffPos.x() > w / 2 ) if( diffPos.x() > 0 && diffPos.x() > w / 2 )
diffPos.setX( diffPos.x() - w ); diffPos.setX( diffPos.x() - w );
...@@ -236,7 +213,7 @@ void SlideEffect::desktopChanged( int old ) ...@@ -236,7 +213,7 @@ void SlideEffect::desktopChanged( int old )
currentRegion |= ( currentRegion & QRect( w, 0, w, h )).translated( -w, 0 ); currentRegion |= ( currentRegion & QRect( w, 0, w, h )).translated( -w, 0 );
currentRegion |= ( currentRegion & QRect( 0, h, w, h )).translated( 0, -h ); currentRegion |= ( currentRegion & QRect( 0, h, w, h )).translated( 0, -h );
} }
QRect rect = desktopRect( effects->currentDesktop(), false ); QRect rect = desktopRect( effects->currentDesktop() );
if( currentRegion.contains( rect )) if( currentRegion.contains( rect ))
{ // current position is in new current desktop (e.g. quickly changing back), { // current position is in new current desktop (e.g. quickly changing back),
// don't do full progress // don't do full progress
...@@ -265,7 +242,7 @@ void SlideEffect::desktopChanged( int old ) ...@@ -265,7 +242,7 @@ void SlideEffect::desktopChanged( int old )
if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this ) if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
return; return;
mTimeLine.setProgress(0);