< prev index next >

src/windows/classes/sun/awt/windows/WToolkit.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 66,75 **** --- 66,77 ---- import java.util.Hashtable; import java.util.Locale; import java.util.Map; import java.util.Properties; + import java.util.concurrent.ExecutorService; + import java.util.concurrent.Executors; import sun.font.FontManager; import sun.font.FontManagerFactory; import sun.font.SunFontManager; import sun.misc.PerformanceLogger;
*** 826,850 **** ((Win32GraphicsEnvironment)GraphicsEnvironment .getLocalGraphicsEnvironment()) .paletteChanged(); } /* * Called from Toolkit native code when a WM_DISPLAYCHANGE occurs. * Have Win32GraphicsEnvironment execute the display change code on the * Event thread. */ static public void displayChanged() { ! EventQueue.invokeLater(new Runnable() { ! @Override ! public void run() { ! ((Win32GraphicsEnvironment)GraphicsEnvironment ! .getLocalGraphicsEnvironment()) ! .displayChanged(); ! } }); } /** * create the peer for a DragSourceContext */ --- 828,866 ---- ((Win32GraphicsEnvironment)GraphicsEnvironment .getLocalGraphicsEnvironment()) .paletteChanged(); } + private static ExecutorService displayChangeExecutor; + /* * Called from Toolkit native code when a WM_DISPLAYCHANGE occurs. * Have Win32GraphicsEnvironment execute the display change code on the * Event thread. */ static public void displayChanged() { ! final Runnable runnable = () -> { ! Object lge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ! if (lge instanceof DisplayChangedListener) { ! ((DisplayChangedListener) lge).displayChanged(); ! } ! }; ! if (AppContext.getAppContext() != null) { ! // Common case, standalone application ! EventQueue.invokeLater(runnable); ! } else { ! if (displayChangeExecutor == null) { ! // No synchronization, called on the Toolkit thread only ! displayChangeExecutor = Executors.newFixedThreadPool(1, r -> { ! Thread t = Executors.defaultThreadFactory().newThread(r); ! t.setDaemon(true); ! return t; }); } + displayChangeExecutor.submit(runnable); + } + } /** * create the peer for a DragSourceContext */
< prev index next >