diff options
author | Kenneth Russel <[email protected]> | 2005-11-09 20:11:30 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-11-09 20:11:30 +0000 |
commit | dba4677caf231ac26c70518a3e82651b0e01c8f2 (patch) | |
tree | 53b494a55ff1c4a00c6d2bd1dbb3e4b7e66b8b5e /make/jawt-CustomJavaCode.java | |
parent | 23e6684c5ae7047f39620e861b607db2f761799d (diff) |
Refactored JOGL's use of the JAWT to enable it to be more lazily
loaded. Separated out AWT-specific native code into a new jogl_awt
native library on all platforms. Added a static helper method to the
JAWT class to fetch the JAWT which is now called by all users. Added a
new NativeLibLoader entry point to load the native code for the AWT
implementation. Renamed the X11 platform's "lockAWT" and "unlockAWT"
methods to "lockToolkit" and "unlockToolkit", respectively. In order
to change this behavior only two methods in X11GLDrawableFactory need
to be overridden. (During the writing of this checkin comment it was
noted that these methods are currently static, but that will be fixed
in a subsequent checkin.) Added the new jogl_awt native library to the
the "dist" target's error checking code. Tested on Windows; more
testing, including build testing, is needed on other platforms.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@429 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make/jawt-CustomJavaCode.java')
-rwxr-xr-x | make/jawt-CustomJavaCode.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/make/jawt-CustomJavaCode.java b/make/jawt-CustomJavaCode.java new file mode 100755 index 000000000..7e8e83b39 --- /dev/null +++ b/make/jawt-CustomJavaCode.java @@ -0,0 +1,27 @@ +private static volatile JAWT jawt; + +/** Helper routine for all users to call to access the JAWT. */ +public static JAWT getJAWT() { + if (jawt == null) { + synchronized (JAWT.class) { + if (jawt == null) { + NativeLibLoader.loadAWTImpl(); + // Workaround for 4845371. + // Make sure the first reference to the JNI GetDirectBufferAddress is done + // from a privileged context so the VM's internal class lookups will succeed. + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + JAWT j = JAWT.create(); + j.version(JAWTFactory.JAWT_VERSION_1_4); + if (!JAWTFactory.JAWT_GetAWT(j)) { + throw new RuntimeException("Unable to initialize JAWT"); + } + jawt = j; + return null; + } + }); + } + } + } + return jawt; +} |