From dbd40778f231396890b2b45ddcd89fa52afd9d38 Mon Sep 17 00:00:00 2001 From: alexp Date: Thu, 24 Jan 2013 15:52:25 +0400 Subject: [PATCH] 7132793: [macosx] setWheelScrollEnabled action reversed Reviewed-by: serb, art --- .../classes/sun/lwawt/LWComponentPeer.java | 2 +- .../classes/sun/lwawt/LWScrollPanePeer.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/src/macosx/classes/sun/lwawt/LWComponentPeer.java index 55b4665a7..aa9b798c6 100644 --- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -1226,7 +1226,7 @@ public abstract class LWComponentPeer sendEventToDelegate(e); } - private void sendEventToDelegate(final AWTEvent e) { + protected void sendEventToDelegate(final AWTEvent e) { synchronized (getDelegateLock()) { if (getDelegate() == null || !isShowing() || !isEnabled()) { return; diff --git a/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java b/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java index 1e386f257..723a9dd8d 100644 --- a/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java +++ b/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java @@ -29,6 +29,7 @@ import javax.swing.*; 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; @@ -51,6 +52,21 @@ final class LWScrollPanePeer extends LWContainerPeer return sp; } + @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() { -- GitLab