forwardport aacid * r1156334 okular/branches/KDE/4.5/kdegraphics/okular/ui/pageview.cpp:

Fix mouse scrolling when wrapping sometimes sending you where you did not want
Patch by Mathieu Lornac

svn path=/trunk/KDE/kdegraphics/okular/; revision=1156337
This commit is contained in:
Albert Astals Cid 2010-07-28 22:33:42 +00:00
parent d0b9699732
commit 47801bc4ab

View file

@ -1507,7 +1507,17 @@ void PageView::mouseMoveEvent( QMouseEvent * e )
QPoint delta = d->mouseGrabPos - mousePos;
// wrap mouse from top to bottom
QRect mouseContainer = KGlobalSettings::desktopGeometry( this );
const QRect mouseContainer = KGlobalSettings::desktopGeometry( this );
// If the delta is huge it probably means we just wrapped in that direction
const QPoint absDelta(abs(delta.x()), abs(delta.y()));
if ( absDelta.y() > mouseContainer.height() / 2 )
{
delta.setY(mouseContainer.height() - absDelta.y());
}
if ( absDelta.x() > mouseContainer.width() / 2 )
{
delta.setX(mouseContainer.width() - absDelta.x());
}
if ( mousePos.y() <= mouseContainer.top() + 4 &&
verticalScrollBar()->value() < verticalScrollBar()->maximum() - 10 )
{