changeset 6069:0ab2391bea61

7194902: [macosx] closed/java/awt/Button/DoubleActionEventTest/DoubleActionEventTest failed since jdk8b49 7181403: Invalid MouseEvent conversion with SwingUtilities.convertMouseEvent Reviewed-by: malenkov, alexsch
author serb
date Mon, 13 May 2013 16:41:49 +0400
parents 88d337f3e7fe
children fe542af733bc
files src/macosx/classes/sun/lwawt/LWComponentPeer.java src/share/classes/javax/swing/SwingUtilities.java
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed May 01 21:05:10 2013 +0800
+++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Mon May 13 16:41:49 2013 +0400
@@ -1184,10 +1184,10 @@
     }
 
     protected void sendEventToDelegate(final AWTEvent e) {
+        if (getDelegate() == null || !isShowing() || !isEnabled()) {
+            return;
+        }
         synchronized (getDelegateLock()) {
-            if (getDelegate() == null || !isShowing() || !isEnabled()) {
-                return;
-            }
             AWTEvent delegateEvent = createDelegateEvent(e);
             if (delegateEvent != null) {
                 AWTAccessor.getComponentAccessor()
@@ -1201,7 +1201,12 @@
         }
     }
 
-    protected AWTEvent createDelegateEvent(AWTEvent e) {
+    /**
+     * Changes the target of the AWTEvent from awt component to appropriate
+     * swing delegate.
+     */
+    private AWTEvent createDelegateEvent(final AWTEvent e) {
+        // TODO modifiers should be changed to getModifiers()|getModifiersEx()?
         AWTEvent delegateEvent = null;
         if (e instanceof MouseWheelEvent) {
             MouseWheelEvent me = (MouseWheelEvent) e;
--- a/src/share/classes/javax/swing/SwingUtilities.java	Wed May 01 21:05:10 2013 +0800
+++ b/src/share/classes/javax/swing/SwingUtilities.java	Mon May 13 16:41:49 2013 +0400
@@ -356,7 +356,7 @@
                                       sourceEvent.getYOnScreen(),
                                       sourceEvent.getClickCount(),
                                       sourceEvent.isPopupTrigger(),
-                                      MouseEvent.NOBUTTON );
+                                      sourceEvent.getButton());
         }
         return newEvent;
     }