changeset 3177:23a3e724ee9d

6709453: (dav)Screen flickers when a JFrame switches to fullscreen mode Reviewed-by: art, dcherepanov
author dav
date Wed, 01 Dec 2010 14:43:56 +0300
parents 357ecafd727b
children 386b49abc195
files src/windows/classes/sun/awt/Win32GraphicsDevice.java
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/classes/sun/awt/Win32GraphicsDevice.java	Tue Nov 30 21:54:55 2010 +0300
+++ b/src/windows/classes/sun/awt/Win32GraphicsDevice.java	Wed Dec 01 14:43:56 2010 +0300
@@ -30,6 +30,7 @@
 import java.awt.GraphicsConfiguration;
 import java.awt.GraphicsEnvironment;
 import java.awt.DisplayMode;
+import java.awt.EventQueue;
 import java.awt.Frame;
 import java.awt.Rectangle;
 import java.awt.Window;
@@ -610,11 +611,18 @@
      *
      * @param w full-screen window
      */
-    protected void addFSWindowListener(Window w) {
+    protected void addFSWindowListener(final Window w) {
         // Note: even though we create a listener for Window instances of
         // fs windows they will not receive window events.
         fsWindowListener = new Win32FSWindowAdapter(this);
-        w.addWindowListener(fsWindowListener);
+
+        // Fix for 6709453. Using invokeLater to avoid listening
+        // for the events already posted to the queue.
+        EventQueue.invokeLater(new Runnable() {
+            public void run() {
+                w.addWindowListener(fsWindowListener);
+            }
+        });
     }
 
     /**