ViewScroller.st
changeset 3498 51d4abb4b298
parent 3493 4e0d00920e24
child 3508 006d6b82735e
--- a/ViewScroller.st	Wed Jul 23 14:13:59 2008 +0200
+++ b/ViewScroller.st	Thu Jul 24 14:43:30 2008 +0200
@@ -440,8 +440,10 @@
 
 !ViewScroller methodsFor:'event handling'!
 
-processEvent:anEvent
-    |appl evView focusView wg|
+processEvent:anEvent    
+    "return true, if the event was eaten"
+
+    |appl evView focusView wg viewToScroll|
 
     anEvent isMouseWheelEvent ifTrue:[
         appl := self application.
@@ -451,8 +453,29 @@
             wg notNil ifTrue:[
                 focusView := evView windowGroup focusView ? evView.
             ].
-            focusView := focusView ? evView.
-            focusView == scrolledView ifTrue:[
+            viewToScroll := focusView ? evView.
+
+            "/ 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.
+            "/ if not, handle the scroll.
+            "/ BETTER SOLUTION:
+            "/  unhandled mouseWheel events should be forwarded to the container
+
+            [ viewToScroll ~~ scrolledView
+              and:[ viewToScroll ~~ self 
+              and:[ viewToScroll notNil 
+              and:[ viewToScroll isScrollWrapper not ]]]
+            ] whileTrue:[
+                viewToScroll := viewToScroll container.
+            ].
+            viewToScroll isNil ifTrue:[
+                ^ false
+            ].
+            scrolledView isNil ifTrue:[
+                ^ false
+            ].
+
+            viewToScroll == scrolledView ifTrue:[
                 appl
                     enqueueMessage:#mouseWheelMotion:x:y:amount:deltaTime:
                     for:self
@@ -626,11 +649,13 @@
 verticalScrollStep
     "return the amount by which to step-scroll vertically"
 
-    ^ verticalScrollStep ? (self height // 2)
+    verticalScrollStep notNil ifTrue:[ ^ verticalScrollStep].
+    ^ (device verticalPixelPerMillimeter * 20) asInteger
+"/    ^ (self height // 3)
 ! !
 
 !ViewScroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.35 2008-07-22 14:18:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.36 2008-07-24 12:43:30 cg Exp $'
 ! !