diff options
author | Sven Gothel <[email protected]> | 2010-12-12 07:52:54 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-12-12 07:52:54 +0100 |
commit | ca1e14eee25536a217d682c66f9ad07d5bdf642e (patch) | |
tree | 0ceac6c955a3389ea11ba31d682084df796826d4 /src/nativewindow/classes/com/jogamp | |
parent | 48f6568ebffdd557651460fb5f3f7f4abbca2440 (diff) |
JAWTUtil: Eager initialization of AWT desktop props
Triggers immediate AWT property resolution.
Would reproduce any javaws / AWT race condition.
Diffstat (limited to 'src/nativewindow/classes/com/jogamp')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java index 9f120e9ab..0f1b85cd9 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java @@ -37,13 +37,18 @@ package com.jogamp.nativewindow.impl.jawt; import com.jogamp.nativewindow.impl.*; +import java.awt.EventQueue; +import java.awt.Frame; import javax.media.nativewindow.*; import java.awt.GraphicsEnvironment; +import java.awt.Toolkit; import java.lang.reflect.*; import java.security.*; +import java.util.ArrayList; +import java.util.Map; public class JAWTUtil { protected static final boolean DEBUG = Debug.debug("JAWT"); @@ -110,10 +115,30 @@ public class JAWTUtil { jawtToolkitLock = new JAWTToolkitLock(); + // trigger native AWT toolkit initialization + final ArrayList desktophintsBucket = new ArrayList(); + try { + EventQueue.invokeAndWait(new Runnable() { + public void run() { + Toolkit tk = Toolkit.getDefaultToolkit(); + Map desktophints = (Map)(tk.getDesktopProperty("awt.font.desktophints")); + if(null!=desktophints) { + desktophintsBucket.add(desktophints); + } + } + }); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } catch (InvocationTargetException ex) { + ex.printStackTrace(); + } + if (DEBUG) { System.err.println("JAWTUtil: Has sun.awt.SunToolkit.awtLock/awtUnlock " + hasSunToolkitAWTLock); System.err.println("JAWTUtil: Has Java2D " + j2dExist); System.err.println("JAWTUtil: Is headless " + headlessMode); + int hints = ( desktophintsBucket.size() > 0 ) ? ((Map)desktophintsBucket.get(0)).size() : 0 ; + System.err.println("JAWTUtil: AWT Desktop hints " + hints); } } |