On Thursday 01 April 2010 11:10:34 Andrea Diamantini wrote:
> On Wednesday 31 March 2010 17:14:59 Johannes Zellner wrote:
> > Hi Andrea,
> > 
> > I made some small changes for smoother scrolling and to get vertical and
> > horizontal scrolling in parallel keypresses.
> > 
> > Cherry pick what you like of it ;-)
> > Its against the scrolling branch.
> > 
> > Thanks,
> > Johannes
> 
> I picked the 3 pixels diffs.
> The part against scrolling doesn't work as it doesn't stop scroll on SHIFT
> press.
> 
> Regards,

Sorry for the bad testing of the patch, I have also attached a slightly 
changed version that can shift start/stop as before, but also does not restart 
the timer each time the speed is adjusted, so it feels little bit smoother.

Cheers,
Johannes
diff --git a/src/webview.cpp b/src/webview.cpp
index 294b7c8..806e192 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -432,38 +432,45 @@ void WebView::keyPressEvent(QKeyEvent *event)
         if( event->key() == Qt::Key_Up )
         {
             _VScrollSpeed -= 1;
-            _scrollTimer->start();
+            if (!_scrollTimer->isActive())
+                _scrollTimer->start();
             return;
         }
         
         if( event->key() == Qt::Key_Down )
         {
             _VScrollSpeed += 1;
-            _scrollTimer->start();
+            if (!_scrollTimer->isActive())
+                _scrollTimer->start();
             return;
         }
         
         if( event->key() == Qt::Key_Right )
         {
             _HScrollSpeed += 1;
-            _scrollTimer->start();
+            if (!_scrollTimer->isActive())
+                _scrollTimer->start();
             return;
         }
         
         if( event->key() == Qt::Key_Left )
         {
             _HScrollSpeed -= 1;
-            _scrollTimer->start();
+            if (!_scrollTimer->isActive())
+                _scrollTimer->start();
             return;
         }
-        
+    }
+
+    // handle scroll start/stop only when shift is pressed alone
+    if ( event->key() == Qt::Key_Shift )
+    {
         if(_scrollTimer->isActive())
         {
             _scrollTimer->stop();
         }
-        else
+        else if(_VScrollSpeed || _HScrollSpeed)
         {
-            if(_VScrollSpeed || _HScrollSpeed)
                 _scrollTimer->start();
         }
     }
@@ -471,7 +478,6 @@ void WebView::keyPressEvent(QKeyEvent *event)
     KWebView::keyPressEvent(event);
 }
 
-
 void WebView::inspect()
 {
     QAction *a = Application::instance()->mainWindow()->actionByName("web_inspector");
_______________________________________________
rekonq mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/rekonq

Reply via email to