diff options
author | Sven Gothel <[email protected]> | 2010-12-15 03:39:35 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-12-15 03:39:35 +0100 |
commit | 4c27377366a338ca9049006dd45672dad0f770ce (patch) | |
tree | 081eb0b374b788168c910cd6fcf53e136946e18f /src/nativewindow/classes/com/jogamp | |
parent | 23d67dafc885bddcb81b84fbe50492bc531d4e0e (diff) |
JAWTUtil: Fix case when init is run on AWT EDT (which is odd, ie not using GLProfile.initSingleton(..)
Diffstat (limited to 'src/nativewindow/classes/com/jogamp')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java | 27 |
1 files changed, 16 insertions, 11 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 0f1b85cd9..68d6dc2a8 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java @@ -115,18 +115,23 @@ public class JAWTUtil { jawtToolkitLock = new JAWTToolkitLock(); - // trigger native AWT toolkit initialization - final ArrayList desktophintsBucket = new ArrayList(); + // trigger native AWT toolkit / properties initialization + Map desktophints = null; 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); + if(EventQueue.isDispatchThread()) { + desktophints = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); + } else { + final ArrayList desktophintsBucket = new ArrayList(); + EventQueue.invokeAndWait(new Runnable() { + public void run() { + Map _desktophints = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); + if(null!=_desktophints) { + desktophintsBucket.add(_desktophints); + } } - } - }); + }); + desktophints = ( desktophintsBucket.size() > 0 ) ? (Map)desktophintsBucket.get(0) : null ; + } } catch (InterruptedException ex) { ex.printStackTrace(); } catch (InvocationTargetException ex) { @@ -137,7 +142,7 @@ public class JAWTUtil { 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 ; + int hints = ( null != desktophints ) ? desktophints.size() : 0 ; System.err.println("JAWTUtil: AWT Desktop hints " + hints); } } |