don't start at 0 degrees every time the mouse is pressed, but base the angle on the time. this allows one to press the keyboard, let go and press it again without it jumping.

svn path=/trunk/KDE/kdebase/workspace/; revision=797314
remotes/origin/Plasma/5.0
Aaron J. Seigo 18 years ago
parent b4dd43913a
commit 2726b01a2b
  1. 8
      effects/trackmouse.cpp

@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "trackmouse.h"
#include <QTime>
#include <kwinconfig.h>
#include <kglobal.h>
@ -55,8 +57,10 @@ TrackMouseEffect::~TrackMouseEffect()
void TrackMouseEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{
if( active )
angle = ( angle + time / 10 ) % 360;
if( active ) {
QTime t = QTime::currentTime();
angle = ((t.second() % 4) * 90.0) + (t.msec() / 1000.0 * 90.0);
}
effects->prePaintScreen( data, time );
}

Loading…
Cancel
Save