changeset 7340:c3d3d9df08e7

Merge
author asaha
date Mon, 14 Apr 2014 10:54:06 -0700
parents 2f5004e2254f 91bfea07f665
children 04882f9a073e 473400607e72
files src/windows/classes/sun/awt/windows/WToolkit.java
diffstat 2 files changed, 30 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/awt/Toolkit.java	Wed Apr 09 09:44:12 2014 -0700
+++ b/src/share/classes/java/awt/Toolkit.java	Mon Apr 14 10:54:06 2014 -0700
@@ -2559,26 +2559,30 @@
         public void firePropertyChange(final PropertyChangeEvent evt) {
             Object oldValue = evt.getOldValue();
             Object newValue = evt.getNewValue();
+            String propertyName = evt.getPropertyName();
             if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
                 return;
             }
+            Runnable updater = new Runnable() {
+                public void run() {
+                    PropertyChangeSupport pcs = (PropertyChangeSupport)
+                        AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
+                    if (null != pcs) {
+                        pcs.firePropertyChange(evt);
+                    }
+                }
+            };
+            final AppContext currentAppContext = AppContext.getAppContext();
             for (AppContext appContext : AppContext.getAppContexts()) {
                 if (null == appContext || appContext.isDisposed()) {
                     continue;
                 }
-                final PeerEvent e = new PeerEvent(source,
-                        new Runnable() {
-                            @Override
-                            public void run() {
-                                PropertyChangeSupport pcs = (PropertyChangeSupport)
-                                        AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
-                                if (null != pcs) {
-                                    pcs.firePropertyChange(evt);
-                                }
-                            }
-                        },
-                        PeerEvent.ULTIMATE_PRIORITY_EVENT);
-                SunToolkit.postEvent(appContext, e);
+                if (currentAppContext == appContext) {
+                    updater.run();
+                } else {
+                    final PeerEvent e = new PeerEvent(source, updater, PeerEvent.ULTIMATE_PRIORITY_EVENT);
+                    SunToolkit.postEvent(appContext, e);
+                }
             }
         }
     }
--- a/src/windows/classes/sun/awt/windows/WToolkit.java	Wed Apr 09 09:44:12 2014 -0700
+++ b/src/windows/classes/sun/awt/windows/WToolkit.java	Mon Apr 14 10:54:06 2014 -0700
@@ -37,6 +37,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import sun.awt.AWTAutoShutdown;
+import sun.awt.AppContext;
 import sun.awt.SunToolkit;
 import sun.misc.ThreadGroupUtils;
 import sun.awt.Win32GraphicsDevice;
@@ -863,7 +864,18 @@
      * Windows doesn't always send WM_SETTINGCHANGE when it should.
      */
     private void windowsSettingChange() {
-        updateProperties();
+        if (AppContext.getAppContext() == null) {
+            // No AppContext, so we can update properties on the current thread,
+            // DesktopPropertyChangeSupport will only post events.
+            updateProperties();
+        } else {
+            EventQueue.invokeLater(new Runnable() {
+                @Override
+                public void run() {
+                    updateProperties();
+                }
+            });
+        }
     }
 
     private synchronized void updateProperties() {