jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
changeset 23900 fd98305f0d19
parent 23893 1a92335b55bb
child 24520 e8afd90fcb69
equal deleted inserted replaced
23899:a926ecef7eb3 23900:fd98305f0d19
    48 import javax.swing.UIDefaults;
    48 import javax.swing.UIDefaults;
    49 import sun.awt.*;
    49 import sun.awt.*;
    50 import sun.awt.datatransfer.DataTransferer;
    50 import sun.awt.datatransfer.DataTransferer;
    51 import sun.font.FontConfigManager;
    51 import sun.font.FontConfigManager;
    52 import sun.java2d.SunGraphicsEnvironment;
    52 import sun.java2d.SunGraphicsEnvironment;
    53 import sun.misc.PerformanceLogger;
    53 import sun.misc.*;
       
    54 import sun.misc.ThreadGroupUtils;
    54 import sun.print.PrintJob2D;
    55 import sun.print.PrintJob2D;
    55 import sun.security.action.GetPropertyAction;
    56 import sun.security.action.GetPropertyAction;
    56 import sun.security.action.GetBooleanAction;
    57 import sun.security.action.GetBooleanAction;
    57 import sun.util.logging.PlatformLogger;
    58 import sun.util.logging.PlatformLogger;
    58 
    59 
   252                 }
   253                 }
   253             });
   254             });
   254         } finally {
   255         } finally {
   255             awtUnlock();
   256             awtUnlock();
   256         }
   257         }
   257         PrivilegedAction<Void> a = new PrivilegedAction<Void>() {
   258         PrivilegedAction<Void> a = () -> {
   258             public Void run() {
   259             Thread shutdownThread = new Thread(ThreadGroupUtils.getRootThreadGroup(), "XToolkt-Shutdown-Thread") {
   259                 Thread shutdownThread = new Thread(getRootThreadGroup(), "XToolkt-Shutdown-Thread") {
   260                     public void run() {
   260                         public void run() {
   261                         XSystemTrayPeer peer = XSystemTrayPeer.getPeerInstance();
   261                             XSystemTrayPeer peer = XSystemTrayPeer.getPeerInstance();
   262                         if (peer != null) {
   262                             if (peer != null) {
   263                             peer.dispose();
   263                                 peer.dispose();
       
   264                             }
       
   265                             if (xs != null) {
       
   266                                 ((XAWTXSettings)xs).dispose();
       
   267                             }
       
   268                             freeXKB();
       
   269                             if (log.isLoggable(PlatformLogger.Level.FINE)) {
       
   270                                 dumpPeers();
       
   271                             }
       
   272                         }
   264                         }
   273                     };
   265                         if (xs != null) {
   274                 shutdownThread.setContextClassLoader(null);
   266                             ((XAWTXSettings)xs).dispose();
   275                 Runtime.getRuntime().addShutdownHook(shutdownThread);
   267                         }
   276                 return null;
   268                         freeXKB();
   277             }
   269                         if (log.isLoggable(PlatformLogger.Level.FINE)) {
       
   270                             dumpPeers();
       
   271                         }
       
   272                     }
       
   273                 };
       
   274             shutdownThread.setContextClassLoader(null);
       
   275             Runtime.getRuntime().addShutdownHook(shutdownThread);
       
   276             return null;
   278         };
   277         };
   279         AccessController.doPrivileged(a);
   278         AccessController.doPrivileged(a);
   280     }
   279     }
   281 
   280 
   282     static String getCorrectXIDString(String val) {
   281     static String getCorrectXIDString(String val) {
   314             awtAppClassName = getCorrectXIDString(mainClassName);
   313             awtAppClassName = getCorrectXIDString(mainClassName);
   315 
   314 
   316             init();
   315             init();
   317             XWM.init();
   316             XWM.init();
   318 
   317 
   319             PrivilegedAction<Thread> action = new PrivilegedAction() {
   318             toolkitThread = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
   320                 public Thread run() {
   319                 Thread thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), XToolkit.this, "AWT-XAWT");
   321                     Thread thread = new Thread(getRootThreadGroup(), XToolkit.this, "AWT-XAWT");
   320                 thread.setContextClassLoader(null);
   322                     thread.setContextClassLoader(null);
   321                 thread.setPriority(Thread.NORM_PRIORITY + 1);
   323                     thread.setPriority(Thread.NORM_PRIORITY + 1);
   322                 thread.setDaemon(true);
   324                     thread.setDaemon(true);
   323                 return thread;
   325                     return thread;
   324             });
   326                 }
       
   327             };
       
   328             toolkitThread = AccessController.doPrivileged(action);
       
   329             toolkitThread.start();
   325             toolkitThread.start();
   330         }
   326         }
   331     }
   327     }
   332 
   328 
   333     public ButtonPeer createButton(Button target) {
   329     public ButtonPeer createButton(Button target) {