7141296: [macosx] Mouse Wheel Turn closes combobox popup
authoralexsch
Wed, 30 May 2012 14:58:30 +0400
changeset 12824 76a5b3724145
parent 12823 8db577a5c434
child 12825 8dda01ae38f4
7141296: [macosx] Mouse Wheel Turn closes combobox popup Reviewed-by: rupashka
jdk/src/macosx/classes/com/apple/laf/AquaScrollPaneUI.java
jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
--- a/jdk/src/macosx/classes/com/apple/laf/AquaScrollPaneUI.java	Wed May 30 14:46:49 2012 +0400
+++ b/jdk/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/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Wed May 30 14:46:49 2012 +0400
+++ b/jdk/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);
     }
 
     /**