6709453: (dav)Screen flickers when a JFrame switches to fullscreen mode
Reviewed-by: art, dcherepanov
--- a/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java Tue Nov 30 21:54:55 2010 +0300
+++ b/jdk/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);
+ }
+ });
}
/**