7132793: [macosx] setWheelScrollEnabled action reversed
authoralexp
Thu, 24 Jan 2013 15:52:25 +0400
changeset 15327 37781d0e61b4
parent 15326 e0b5489e29a6
child 15328 65d946035fa9
7132793: [macosx] setWheelScrollEnabled action reversed Reviewed-by: serb, art
jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Thu Jan 24 15:26:40 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Thu Jan 24 15:52:25 2013 +0400
@@ -1226,7 +1226,7 @@
         sendEventToDelegate(e);
     }
 
-    private void sendEventToDelegate(final AWTEvent e) {
+    protected void sendEventToDelegate(final AWTEvent e) {
         synchronized (getDelegateLock()) {
             if (getDelegate() == null || !isShowing() || !isEnabled()) {
                 return;
--- a/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java	Thu Jan 24 15:26:40 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java	Thu Jan 24 15:52:25 2013 +0400
@@ -29,6 +29,7 @@
 import javax.swing.event.ChangeListener;
 import javax.swing.event.ChangeEvent;
 import java.awt.*;
+import java.awt.event.MouseWheelEvent;
 import java.awt.peer.ScrollPanePeer;
 import java.util.List;
 
@@ -52,6 +53,21 @@
     }
 
     @Override
+    public void handleEvent(AWTEvent e) {
+        if (e instanceof MouseWheelEvent) {
+            MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
+            //java.awt.ScrollPane consumes the event
+            // in case isWheelScrollingEnabled() is true,
+            // forcibly send the consumed event to the delegate
+            if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
+                sendEventToDelegate(wheelEvent);
+            }
+        } else {
+            super.handleEvent(e);
+        }
+    }
+
+    @Override
     public void stateChanged(final ChangeEvent e) {
         SwingUtilities.invokeLater(new Runnable() {
             @Override