From 13edf0ce99d75591870c976197ecb4a4ac1218cb Mon Sep 17 00:00:00 2001 From: Caspian Rychlik-Prince Date: Thu, 12 Jun 2003 14:08:10 +0000 Subject: [PATCH] *** empty log message *** --- src/java/org/lwjgl/Sys.java | 1 + src/java/org/lwjgl/Window.java | 4 +- src/java/org/lwjgl/openal/BaseAL.java | 159 +++++++++++++------------- src/native/common/extal.cpp | 21 +++- src/native/win32/org_lwjgl_Window.cpp | 14 ++- 5 files changed, 111 insertions(+), 88 deletions(-) diff --git a/src/java/org/lwjgl/Sys.java b/src/java/org/lwjgl/Sys.java index 409dea03..0af1095d 100644 --- a/src/java/org/lwjgl/Sys.java +++ b/src/java/org/lwjgl/Sys.java @@ -107,6 +107,7 @@ public final class Sys { } } + /** * @return the name of the native library to load diff --git a/src/java/org/lwjgl/Window.java b/src/java/org/lwjgl/Window.java index 92b97fe1..ef570ccc 100644 --- a/src/java/org/lwjgl/Window.java +++ b/src/java/org/lwjgl/Window.java @@ -149,7 +149,7 @@ public abstract class Window { /** * Minimize the game and allow the operating system's default display to become - * visible. It is NOT the responsibility of LWJGL's native code to restore the display + * visible. It is the responsibility of LWJGL's native code to restore the display * to its normal display settings. * * If the display is already minimized then this is a no-op. @@ -157,7 +157,7 @@ public abstract class Window { public final native void minimize(); /** - * Restore the game and hide the operating system away. It is NOT the responsibility of + * Restore the game and hide the operating system away. It is the responsibility of * LWJGL's native code to restore the display to its game display settings. * * If the display is not minimized then this is a no-op/ diff --git a/src/java/org/lwjgl/openal/BaseAL.java b/src/java/org/lwjgl/openal/BaseAL.java index 50de4623..1f78536a 100644 --- a/src/java/org/lwjgl/openal/BaseAL.java +++ b/src/java/org/lwjgl/openal/BaseAL.java @@ -47,87 +47,90 @@ import java.util.StringTokenizer; * @version $Revision$ */ public abstract class BaseAL { - /** Have we been created? */ - protected static boolean created; - - static { - initialize(); - } - - /** - * Override to provide any initialization code after creation. - */ - protected void init() throws OpenALException { - } - - /** - * Static initialization - */ - private static void initialize() { - System.loadLibrary(org.lwjgl.Sys.getLibraryName()); - } - - /** - * Creates the AL instance - * - * @throws Exception if a failiure occured in the AL creation process - */ - public void create() throws OpenALException { - if (created) { - return; - } + /** Have we been created? */ + protected static boolean created; - // need to pass path of possible locations of OAL to native side - String libpath = System.getProperty("java.library.path"); - String seperator = System.getProperty("path.separator"); - String libname; + static { + initialize(); + } - // libname is hardcoded atm - this will change in a near future... - libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) - ? "libopenal.so" - : "OpenAL32.dll"; + /** + * Override to provide any initialization code after creation. + */ + protected void init() throws OpenALException { + } - StringTokenizer st = new StringTokenizer(libpath, seperator); - - //create needed string array - String[] oalPaths = new String[st.countTokens()+1]; + /** + * Static initialization + */ + private static void initialize() { + System.loadLibrary(org.lwjgl.Sys.getLibraryName()); + try { + System.loadLibrary("OpenAL32"); + } catch (Exception e) { + System.loadLibrary("openal"); + } + } - //build paths - for(int i=0;iGetArrayLength(oalPaths); + + /* + * CAS: Experimental new code for loading OpenAL. We're ignoring the paths + * and just trying to load it once. + */ + +#ifdef _WIN32 + handleOAL = LoadLibrary("OpenAL32.dll"); +#endif +#ifdef _X11 + handleOAL = dlopen("libopenal.so", RTLD_LAZY); +#endif +#ifdef TARGET_OS_MAC + oalInitEntryPoints(); +#endif + + /* + jsize pathcount = env->GetArrayLength(oalPaths); #ifdef _DEBUG printf("Found %d OpenAL paths\n", pathcount); #endif @@ -201,7 +218,7 @@ void LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) { break; } env->ReleaseStringUTFChars(path, path_str); - } + */ } /** diff --git a/src/native/win32/org_lwjgl_Window.cpp b/src/native/win32/org_lwjgl_Window.cpp index 3bafd5bc..e087c591 100644 --- a/src/native/win32/org_lwjgl_Window.cpp +++ b/src/native/win32/org_lwjgl_Window.cpp @@ -149,12 +149,18 @@ void closeWindow() */ void appActivate(bool active) { + if (!active) { + tempResetDisplayMode(); + } if (active) { SetForegroundWindow(hwnd); ShowWindow(hwnd, SW_RESTORE); } else if (isFullScreen) { ShowWindow(hwnd, SW_MINIMIZE); } + if (active) { + tempRestoreDisplayMode(); + } } /* @@ -200,15 +206,11 @@ LRESULT CALLBACK lwjglWindowProc(HWND hWnd, case WA_CLICKACTIVE: environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_FALSE); isMinimized = false; - // Change to game display settings - tempRestoreDisplayMode(); break; case WA_INACTIVE: environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_TRUE); isMinimized = true; - // Restore display settings - tempResetDisplayMode(); break; } @@ -413,7 +415,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Window_minimize if (isMinimized) return; ShowWindow(hwnd, SW_MINIMIZE); -// tempResetDisplayMode(); + tempResetDisplayMode(); } /* @@ -427,6 +429,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Window_restore if (!isMinimized) return; -// tempRestoreDisplayMode(); + tempRestoreDisplayMode(); ShowWindow(hwnd, SW_RESTORE); }