changeset 5439:e6de02da6870

7141296: [macosx] Mouse Wheel Turn closes combobox popup Reviewed-by: rupashka
author alexsch
date Wed, 30 May 2012 14:58:30 +0400
parents 14f9e9060370
children 8800a98316b2
files src/macosx/classes/com/apple/laf/AquaScrollPaneUI.java src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/com/apple/laf/AquaScrollPaneUI.java	Wed May 30 14:46:49 2012 +0400
+++ b/src/macosx/classes/com/apple/laf/AquaScrollPaneUI.java	Wed May 30 14:58:30 2012 +0400
@@ -60,6 +60,10 @@
             if (wasVisible) {
                 vScrollBar.setVisible(true);
             }
+
+            // Consume the event even when the scrollBar is invisible
+            // see #7124320
+            e.consume();
         }
     }
 }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Wed May 30 14:46:49 2012 +0400
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Wed May 30 14:58:30 2012 +0400
@@ -109,8 +109,14 @@
         final long when = System.currentTimeMillis();
         final int scrollType = MouseWheelEvent.WHEEL_UNIT_SCROLL;
         final int scrollAmount = 1;
+        int wheelRotation = (int) delta;
+        int signum = (int) Math.signum(delta);
+        if (signum * delta < 1) {
+            wheelRotation = signum;
+        }
+        // invert the wheelRotation for the peer
         peer.dispatchMouseWheelEvent(when, x, y, modifiers, scrollType,
-                                     scrollAmount, (int) -delta, -delta, null);
+                                     scrollAmount, -wheelRotation, -delta, null);
     }
 
     /**