No longer scroll the focus view for mouseWheel events.
authorStefan Vogel <sv@exept.de>
Tue, 24 Feb 2009 19:29:34 +0100
changeset 3641 e466ec0abd6e
parent 3640 7ca6eee17c97
child 3642 fb2553de80b0
No longer scroll the focus view for mouseWheel events. This is compatible with the other mouse events, that interact with the window where the mouse pointer is (you have the mouse already at hand, haven't you?). You can now mousewheel-scroll a non-focused SelectionInListView without the risk of changing the current selection. This is compatible with the beaviour of other applications (e.g. firefox)
ViewScroller.st
--- a/ViewScroller.st	Wed Feb 18 18:56:53 2009 +0100
+++ b/ViewScroller.st	Tue Feb 24 19:29:34 2009 +0100
@@ -455,17 +455,17 @@
 processEvent:anEvent    
     "return true, if the event was eaten"
 
-    |appl evView focusView wg viewToScroll|
+    |appl evView viewToScroll|
 
     anEvent isMouseWheelEvent ifTrue:[
+        scrolledView isNil ifTrue:[
+            ^ false
+        ].
+
         appl := self application.
         appl notNil ifTrue:[    "/ might happen that my application is nil
             evView := anEvent view.
-            wg := evView windowGroup.
-            wg notNil ifTrue:[
-                focusView := evView windowGroup focusView ? evView.
-            ].
-            viewToScroll := focusView ? evView.
+            viewToScroll := anEvent targetView.
 
             "/ because I am catching all scroll events (which is a kludge),
             "/ walk up the hierarchy and see if there is no other scrolled view involved.
@@ -475,18 +475,16 @@
 
             [ viewToScroll ~~ scrolledView
               and:[ viewToScroll ~~ self 
-              and:[ viewToScroll notNil 
-              and:[ viewToScroll isScrollWrapper not
-                    or:[ viewToScroll isVerticalScrollable not ]]]]
+              and:[ viewToScroll notNil
+              and:[ (viewToScroll isScrollWrapper not
+                    or:[ viewToScroll isVerticalScrollable not ]) 
+              and:[ (viewToScroll handlesMouseWheelMotion:anEvent inView:evView) not ]]]]
             ] whileTrue:[
                 viewToScroll := viewToScroll container.
             ].
             viewToScroll isNil ifTrue:[
                 ^ false
             ].
-            scrolledView isNil ifTrue:[
-                ^ false
-            ].
 
             viewToScroll == scrolledView ifTrue:[
                 appl
@@ -671,5 +669,5 @@
 !ViewScroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.39 2008-10-06 20:03:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.40 2009-02-24 18:29:34 stefan Exp $'
 ! !