[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegraphics/okular/ui
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2010-07-28 22:33:42
Message-ID: 20100728223342.58BDDAC7A9 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1156337 by aacid:

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


 M  +11 -1     pageview.cpp  


--- trunk/KDE/kdegraphics/okular/ui/pageview.cpp #1156336:1156337
@@ -1507,7 +1507,17 @@
                     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 )
                     {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic