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

Matthew Woehlke mw_triad at users.sourceforge.net
Mon Mar 31 20:11:26 UTC 2008


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?

-- 
Matthew
I think I want my tombstone to read:
<name>
Process created <date of birth>
Signal 15 received <date of death>




More information about the konsole-devel mailing list