Bug 161412

Summary: Using mousewheel to scroll does not work over scrollbar
Product: [Applications] kate Reporter: Alex Ruddick <alexrudd0>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: christoph, dpalacio, herve, job, mail, mpictor
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alex Ruddick 2008-04-29 21:31:49 UTC
Version:            (using KDE 4.0.3)
Installed from:    Ubuntu Packages

When I use the mousewheel over the text area in Kate or Kwrite, everything works normally.  The text scrolls, and the scrollbar moves down to match it.  However, if I move the cursor over the scrollbar, it stops working.  The scrollbar will go down, but the text remains exactly the same.

Expected behaviour:  When using mousewheel over scrollbar, both scrollbar and text scroll exactly as if it were over the text area.

Observed behaviour:  When using mousewheel over scrollbar, only the scrollbar moves.  The text area remains exactly the same.  Clicking on the text does not trigger a refresh.  If I mousewheel-scroll over the text area, the scrollbar will jump back to the old/correct position.
Comment 1 Thomas Friedrichsmeier 2008-05-12 22:19:22 UTC
*** Bug 161880 has been marked as a duplicate of this bug. ***
Comment 2 George Kiagiadakis 2008-05-27 21:17:05 UTC
I can confirm this with kate 4.0.74 installed from debian experimental packages.
Comment 3 George Kiagiadakis 2008-07-19 14:19:50 UTC
Hello,
I took some time this morning and tried to fix this bug...
There are two ways to fix this actually. My first thought was to override whellEvent on the scrollbar and send the event to the view, something like this (tested with kwrite and works, patch is against kdelibs r834504):

Index: kate/view/kateviewhelpers.cpp
===================================================================
--- kate/view/kateviewhelpers.cpp       (revision 834504)
+++ kate/view/kateviewhelpers.cpp       (working copy)
@@ -188,6 +188,11 @@
   }
 }
 
+void KateScrollBar::wheelEvent(QWheelEvent *e)
+{
+  QCoreApplication::sendEvent(m_viewInternal, e);
+}
+
 void KateScrollBar::marksChanged()
 {
   recomputeMarksPositions();
Index: kate/view/kateviewhelpers.h
===================================================================
--- kate/view/kateviewhelpers.h (revision 834504)
+++ kate/view/kateviewhelpers.h (working copy)
@@ -73,6 +73,7 @@
     virtual void resizeEvent(QResizeEvent *);
     virtual void styleChange(QStyle &oldStyle);
     virtual void sliderChange ( SliderChange change );
+    virtual void wheelEvent(QWheelEvent *e);
 
   protected Q_SLOTS:
     void sliderMaybeMoved(int value);


...but then I found a commented-out hack that works too if uncommented. It seems to have been commented out in r473347 (more than two years ago) for some reason. Just uncommenting this works too and seems to be the right thing to do, unless it causes some regression or other trouble. The decision is yours... :)

Index: kate/view/kateviewinternal.cpp
===================================================================
--- kate/view/kateviewinternal.cpp      (revision 834504)
+++ kate/view/kateviewinternal.cpp      (working copy)
@@ -144,7 +144,7 @@
   connect(m_lineScroll, SIGNAL(sliderMMBMoved(int)), SLOT(scrollLines(int)));
 
   // catch wheel events, completing the hijack
-  //m_lineScroll->installEventFilter(this);
+  m_lineScroll->installEventFilter(this);
 
   //
   // scrollbar for columns
Comment 4 Anders Lund 2008-07-19 15:12:26 UTC
*** Bug 164360 has been marked as a duplicate of this bug. ***
Comment 5 Bram Schoenmakers 2008-09-07 12:00:24 UTC

*** This bug has been marked as a duplicate of bug 158466 ***
Comment 6 Christoph Cullmann 2008-09-07 15:14:09 UTC
SVN commit 858143 by cullmann:

fix scrolling with wheel on scrollbar
BUG: 161412


 M  +5 -0      kateviewhelpers.cpp  
 M  +1 -0      kateviewhelpers.h  


--- trunk/KDE/kdelibs/kate/view/kateviewhelpers.cpp #858142:858143
@@ -196,6 +196,11 @@
   }
 }
 
+void KateScrollBar::wheelEvent(QWheelEvent *e)
+{
+  QCoreApplication::sendEvent(m_viewInternal, e);
+}
+
 void KateScrollBar::marksChanged()
 {
   recomputeMarksPositions();
--- trunk/KDE/kdelibs/kate/view/kateviewhelpers.h #858142:858143
@@ -74,6 +74,7 @@
     virtual void resizeEvent(QResizeEvent *);
     virtual void styleChange(QStyle &oldStyle);
     virtual void sliderChange ( SliderChange change );
+    virtual void wheelEvent(QWheelEvent *e);
 
   protected Q_SLOTS:
     void sliderMaybeMoved(int value);
Comment 7 Hervé Fache 2008-11-25 11:57:30 UTC
I still have this bug in KDE 4.1.3/Kate 3.1.3
Comment 8 David Palacio 2008-11-29 01:05:27 UTC
>I still have this bug in KDE 4.1.3/Kate 3.1.3
I second that
Comment 9 George Kiagiadakis 2008-11-29 10:25:33 UTC
It works fine in trunk. It was simply not backported to the 4.1 branch.
Comment 10 Dario Andres 2009-02-22 19:53:38 UTC
*** Bug 185197 has been marked as a duplicate of this bug. ***