7194902: [macosx] closed/java/awt/Button/DoubleActionEventTest/DoubleActionEventTest failed since jdk8b49
authorserb
Fri, 01 Mar 2013 15:31:22 +0400
changeset 15991 848515979585
parent 15990 057010ebd827
child 15992 e5287fba4c74
7194902: [macosx] closed/java/awt/Button/DoubleActionEventTest/DoubleActionEventTest failed since jdk8b49 7181403: Invalid MouseEvent conversion with SwingUtilities.convertMouseEvent Reviewed-by: malenkov, alexsch
jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
jdk/src/share/classes/javax/swing/SwingUtilities.java
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Fri Mar 01 14:30:52 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Fri Mar 01 15:31:22 2013 +0400
@@ -1227,10 +1227,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()
@@ -1244,7 +1244,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/jdk/src/share/classes/javax/swing/SwingUtilities.java	Fri Mar 01 14:30:52 2013 +0400
+++ b/jdk/src/share/classes/javax/swing/SwingUtilities.java	Fri Mar 01 15:31:22 2013 +0400
@@ -356,7 +356,7 @@
                                       sourceEvent.getYOnScreen(),
                                       sourceEvent.getClickCount(),
                                       sourceEvent.isPopupTrigger(),
-                                      MouseEvent.NOBUTTON );
+                                      sourceEvent.getButton());
         }
         return newEvent;
     }