[Konsole-devel] [PATCH] mouse wheel sends keys when it shouldn't

Robert Knight robertknight at gmail.com
Mon Mar 31 21:19:54 UTC 2008


Hi,

I forgot about the Up/Down arrow keys triggering a scroll to the bottom.
For some reason I was thinking that QScrollBar::maximum()
was the max value plus the page step which is clearly wrong - so 
sliderAtBottom was being set to true when it shouldn't have. 

The canScroll() method isn't needed at all then - the code can just be 
moved to a variable assignment.  I committed that as rv. 792354.
Thanks :)

Regards,
Robert.

On Mon, 2008-03-31 at 15:11 -0500, Matthew Woehlke wrote:
> After http://bugs.kde.org/show_bug.cgi?id=159340 was fixed, I have a 
> problem with keys being sent when trying to scroll up (when there is a 
> scrollback buffer present). It seems that an up-arrow key is sent 
> whenever scrolling up with the mouse wheel would reach the top of the 
> scrollback (which causes the scrollback to jump back to the bottom).
> 
> I took a look at r786780, and while the logic doesn't offhand seem 
> "wrong", it seems like it could be simplified as follows:
> 
> Index: src/TerminalDisplay.cpp
> ===================================================================
> --- src/TerminalDisplay.cpp     (revision 792292)
> +++ src/TerminalDisplay.cpp     (working copy)
> @@ -2125,10 +2125,7 @@
> 
>   bool TerminalDisplay::canScroll() const
>   {
> -       bool sliderAtTop = _scrollBar->value() == 0;
> -       bool sliderAtBottom = _scrollBar->value() + 
> _scrollBar->pageStep() >= _scrollBar->maximum();
> -
> -       return !(sliderAtTop && sliderAtBottom);
> +       return _scrollBar->maximum() > 0;
>   }
>   void TerminalDisplay::wheelEvent( QWheelEvent* ev )
>   {
> 
> ...because the scroll bar is only evey "useful" when maximum() > 0.
> 
> This seems to fix the problem. Can I commit this?
> 




More information about the konsole-devel mailing list