diff --git a/src/java/org/lwjgl/opengl/MacOSXDisplay.java b/src/java/org/lwjgl/opengl/MacOSXDisplay.java index 3e36a42d..697521ec 100644 --- a/src/java/org/lwjgl/opengl/MacOSXDisplay.java +++ b/src/java/org/lwjgl/opengl/MacOSXDisplay.java @@ -77,6 +77,7 @@ final class MacOSXDisplay implements DisplayImplementation { } public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException { + hideUI(fullscreen); close_requested = false; try { frame = new MacOSXFrame(mode, requested_mode, fullscreen, x, y); @@ -98,6 +99,7 @@ final class MacOSXDisplay implements DisplayImplementation { setView(null); frame.syncDispose(); frame = null; + hideUI(false); } public int getGammaRampLength() { @@ -222,6 +224,13 @@ final class MacOSXDisplay implements DisplayImplementation { } } + /** + * This is an interface to the native Carbon call + * SetSystemUIMode. It is used to hide the dock in a way + * that will prevent AWT from shifting the fullscreen window + */ + private native void hideUI(boolean hide); + native void getMouseDeltas(IntBuffer delta_buffer); private native void updateContext(); diff --git a/src/native/macosx/Makefile b/src/native/macosx/Makefile index 06a57bdf..b24a8c4c 100644 --- a/src/native/macosx/Makefile +++ b/src/native/macosx/Makefile @@ -6,7 +6,7 @@ CC=gcc LINKER=gcc STRIP=strip CFLAGS_LINK=-dynamiclib -Wall -FRAMEWORKS=-framework Foundation -framework AppKit -framework JavaVM +FRAMEWORKS=-framework Foundation -framework AppKit -framework JavaVM -framework Carbon CFLAGS_O=-fPIC -O2 -D_MACOSX -Wall -c -I${AL}/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers SRC=$(wildcard *.m) $(wildcard *.c) $(wildcard ../common/*.c) $(wildcard ../common/arb/*.c) $(wildcard ../common/ati/*.c) $(wildcard ../common/ext/*.c) $(wildcard ../common/nv/*.c) OBJECTS=$(subst .m,.o, $(subst .c,.o,$(SRC))) diff --git a/src/native/macosx/org_lwjgl_opengl_Display.m b/src/native/macosx/org_lwjgl_opengl_Display.m index 6f2f0558..435e4104 100644 --- a/src/native/macosx/org_lwjgl_opengl_Display.m +++ b/src/native/macosx/org_lwjgl_opengl_Display.m @@ -153,7 +153,6 @@ static void setView(JNIEnv *env, jobject canvas) { usleep(WAIT_DELAY); } -// [gl_context clearDrawable]; [gl_context setView:view]; [view unlockFocus]; @@ -163,6 +162,14 @@ static void setView(JNIEnv *env, jobject canvas) { awt.FreeDrawingSurface(ds); } +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_hideUI(JNIEnv *env, jobject this, jboolean hide) { + if (hide == JNI_TRUE) { + SetSystemUIMode(kUIModeContentSuppressed, 0); + } else { + SetSystemUIMode(kUIModeNormal, 0); + } +} + JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_setVSyncEnabled(JNIEnv *env, jobject this, jboolean vsync) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; long vsync_value = vsync == JNI_TRUE ? 1 : 0;