From dba4677caf231ac26c70518a3e82651b0e01c8f2 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Wed, 9 Nov 2005 20:11:30 +0000 Subject: 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 --- .../impl/windows/WindowsGLDrawableFactory.java | 2 +- .../impl/windows/WindowsOnscreenGLDrawable.java | 25 ++++------------------ 2 files changed, 5 insertions(+), 22 deletions(-) (limited to 'src/classes/com/sun/opengl/impl/windows') diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java index ae48be999..ac56d9469 100644 --- a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawableFactory.java @@ -61,7 +61,7 @@ public class WindowsGLDrawableFactory extends GLDrawableFactoryImpl { private long hglu32; static { - NativeLibLoader.load(); + NativeLibLoader.loadCore(); } public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities, diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java index fa3766a80..c475e1d0a 100644 --- a/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsOnscreenGLDrawable.java @@ -48,7 +48,6 @@ public class WindowsOnscreenGLDrawable extends WindowsGLDrawable { public static final int LOCK_SURFACE_NOT_READY = 1; public static final int LOCK_SURFACE_CHANGED = 2; public static final int LOCK_SUCCESS = 3; - private static JAWT jawt; // Variables for lockSurface/unlockSurface private JAWT_DrawingSurface ds; @@ -123,7 +122,7 @@ public class WindowsOnscreenGLDrawable extends WindowsGLDrawable { if (hdc != 0) { throw new GLException("Surface already locked"); } - ds = getJAWT().GetDrawingSurface(component); + ds = JAWT.getJAWT().GetDrawingSurface(component); if (ds == null) { // Widget not yet realized return LOCK_SURFACE_NOT_READY; @@ -145,7 +144,7 @@ public class WindowsOnscreenGLDrawable extends WindowsGLDrawable { if (dsi == null) { // Widget not yet realized ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); + JAWT.getJAWT().FreeDrawingSurface(ds); ds = null; return LOCK_SURFACE_NOT_READY; } @@ -155,7 +154,7 @@ public class WindowsOnscreenGLDrawable extends WindowsGLDrawable { // Widget not yet realized ds.FreeDrawingSurfaceInfo(dsi); ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); + JAWT.getJAWT().FreeDrawingSurface(ds); ds = null; dsi = null; win32dsi = null; @@ -173,26 +172,10 @@ public class WindowsOnscreenGLDrawable extends WindowsGLDrawable { } ds.FreeDrawingSurfaceInfo(dsi); ds.Unlock(); - getJAWT().FreeDrawingSurface(ds); + JAWT.getJAWT().FreeDrawingSurface(ds); ds = null; dsi = null; win32dsi = null; hdc = 0; } - - //---------------------------------------------------------------------- - // Internals only below this point - // - - private JAWT getJAWT() { - if (jawt == null) { - 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 jawt; - } } -- cgit v1.2.3