- limit the number of left/right rotations. Cube will not rotate endless if cursor keys are being pressed

- fix vertical mouse movement

svn path=/trunk/KDE/kdebase/workspace/; revision=848624
This commit is contained in:
Martin Gräßlin 2008-08-18 09:39:48 +00:00
parent a09f473662
commit d5be0f8da5

View file

@ -1341,7 +1341,8 @@ void CubeEffect::grabbedKeyboardEvent( QKeyEvent* e )
} }
else else
{ {
rotations.enqueue( Left ); if( rotations.count() < effects->numberOfDesktops() )
rotations.enqueue( Left );
} }
break; break;
case Qt::Key_Right: case Qt::Key_Right:
@ -1354,7 +1355,8 @@ void CubeEffect::grabbedKeyboardEvent( QKeyEvent* e )
} }
else else
{ {
rotations.enqueue( Right ); if( rotations.count() < effects->numberOfDesktops() )
rotations.enqueue( Right );
} }
break; break;
case Qt::Key_Up: case Qt::Key_Up:
@ -1551,7 +1553,7 @@ void CubeEffect::mouseChanged( const QPoint& pos, const QPoint& oldpos, Qt::Mous
if( !verticalRotating ) if( !verticalRotating )
{ {
// display height corresponds to 180* // display height corresponds to 180*
int deltaY = oldpos.y() - pos.y(); int deltaY = pos.y() - oldpos.y();
float deltaVerticalDegrees = (float)deltaY/rect.height()*180.0f; float deltaVerticalDegrees = (float)deltaY/rect.height()*180.0f;
manualVerticalAngle -= deltaVerticalDegrees; manualVerticalAngle -= deltaVerticalDegrees;
if( deltaVerticalDegrees != 0.0 ) if( deltaVerticalDegrees != 0.0 )