diff --git a/build.xml b/build.xml index 7f6bb68e..6f8fbede 100644 --- a/build.xml +++ b/build.xml @@ -88,8 +88,8 @@ - - + + @@ -97,15 +97,15 @@ - - - - - + + + + + - - + + @@ -295,82 +295,88 @@ - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - + + + - - - - - - - - - - - + lwjgl.src.headers = ${lwjgl.src.headers} - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -380,60 +386,60 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lwjgl.java.windows.version = ${lwjgl.java.windows.version} - lwjgl.native.windows.version = ${lwjgl.native.windows.version} - lwjgl.java.linux.version = ${lwjgl.java.linux.version} - lwjgl.native.linux.version = ${lwjgl.native.linux.version} - lwjgl.java.freebsd.version = ${lwjgl.java.linux.version} - lwjgl.native.freebsd.version = ${lwjgl.native.linux.version} - lwjgl.java.openbsd.version = ${lwjgl.java.linux.version} - lwjgl.native.openbsd.version = ${lwjgl.native.linux.version} - lwjgl.java.macosx.version = ${lwjgl.java.macosx.version} - lwjgl.native.macosx.version = ${lwjgl.native.macosx.version} - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -462,7 +468,7 @@ - + @@ -475,8 +481,8 @@ - - + + @@ -560,7 +566,7 @@ - + diff --git a/platform_build/build-generator.xml b/platform_build/build-generator.xml index fa121198..f9f9690e 100644 --- a/platform_build/build-generator.xml +++ b/platform_build/build-generator.xml @@ -24,7 +24,7 @@ - + @@ -33,7 +33,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -91,7 +91,7 @@ - + @@ -120,7 +120,7 @@ - + @@ -143,7 +143,7 @@ - + @@ -167,7 +167,7 @@ - + @@ -185,7 +185,7 @@ - + @@ -204,7 +204,7 @@ - + @@ -230,7 +230,7 @@ - + @@ -253,7 +253,7 @@ - + @@ -277,7 +277,7 @@ - + @@ -296,7 +296,7 @@ - + @@ -322,7 +322,7 @@ - + @@ -345,7 +345,7 @@ - + @@ -369,7 +369,7 @@ - + @@ -388,7 +388,7 @@ - + diff --git a/platform_build/macosx_ant/build.xml b/platform_build/macosx_ant/build.xml index 93177b69..be454117 100644 --- a/platform_build/macosx_ant/build.xml +++ b/platform_build/macosx_ant/build.xml @@ -2,7 +2,7 @@ - + @@ -15,7 +15,8 @@ - + + @@ -102,8 +103,7 @@ - - + @@ -111,7 +111,7 @@ - + @@ -136,10 +136,10 @@ - - - - + + + + @@ -147,76 +147,74 @@ - - - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - + + + - + - \ No newline at end of file + diff --git a/src/java/org/lwjgl/MacOSXSysImplementation.java b/src/java/org/lwjgl/MacOSXSysImplementation.java index b92cdeeb..99ed184b 100644 --- a/src/java/org/lwjgl/MacOSXSysImplementation.java +++ b/src/java/org/lwjgl/MacOSXSysImplementation.java @@ -31,7 +31,6 @@ */ package org.lwjgl; -import com.apple.eio.FileManager; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; @@ -55,13 +54,5 @@ final class MacOSXSysImplementation extends J2SESysImplementation { return JNI_VERSION; } - public boolean openURL(String url) { - try { - FileManager.openURL(url); - return true; - } catch (Exception e) { - LWJGLUtil.log("Exception occurred while trying to invoke browser: " + e); - return false; - } - } + public native boolean openURL(String url); } diff --git a/src/java/org/lwjgl/MemoryUtil.java b/src/java/org/lwjgl/MemoryUtil.java index 9dd389ab..17fafa88 100644 --- a/src/java/org/lwjgl/MemoryUtil.java +++ b/src/java/org/lwjgl/MemoryUtil.java @@ -62,10 +62,10 @@ public final class MemoryUtil { // Depends on java.nio.Buffer#address and sun.misc.Unsafe util = loadAccessor("org.lwjgl.MemoryUtilSun$AccessorUnsafe"); } catch (Exception e0) { - try { - // Depends on java.nio.Buffer#address and sun.reflect.FieldAccessor - util = loadAccessor("org.lwjgl.MemoryUtilSun$AccessorReflectFast"); - } catch (Exception e1) { + // try { + // // Depends on java.nio.Buffer#address and sun.reflect.FieldAccessor + // util = loadAccessor("org.lwjgl.MemoryUtilSun$AccessorReflectFast"); + // } catch (Exception e1) { try { // Depends on java.nio.Buffer#address util = new AccessorReflect(); @@ -73,7 +73,7 @@ public final class MemoryUtil { LWJGLUtil.log("Unsupported JVM detected, this will likely result in low performance. Please inform LWJGL developers."); util = new AccessorJNI(); } - } + // } } LWJGLUtil.log("MemoryUtil Accessor: " + util.getClass().getSimpleName()); @@ -282,7 +282,8 @@ public final class MemoryUtil { throw new RuntimeException(e); } } - out.flip(); + // cast to use Buffer's implementation of flip even when compiling against versions of java that have ByteBuffer::flip + ((Buffer)out).flip(); return out; } diff --git a/src/java/org/lwjgl/MemoryUtilSun.java b/src/java/org/lwjgl/MemoryUtilSun.java index 683f372b..1ef5c77a 100644 --- a/src/java/org/lwjgl/MemoryUtilSun.java +++ b/src/java/org/lwjgl/MemoryUtilSun.java @@ -37,7 +37,7 @@ import java.lang.reflect.Modifier; import java.nio.Buffer; import sun.misc.Unsafe; -import sun.reflect.FieldAccessor; +// import sun.reflect.FieldAccessor; /** * MemoryUtil.Accessor implementations that depend on sun.misc. @@ -104,32 +104,32 @@ final class MemoryUtilSun { } /** Implementation using reflection on ByteBuffer, FieldAccessor is used directly. */ - private static class AccessorReflectFast implements MemoryUtil.Accessor { + // private static class AccessorReflectFast implements MemoryUtil.Accessor { - private final FieldAccessor addressAccessor; + // private final FieldAccessor addressAccessor; - AccessorReflectFast() { - Field address; - try { - address = MemoryUtil.getAddressField(); - } catch (NoSuchFieldException e) { - throw new UnsupportedOperationException(e); - } - address.setAccessible(true); + // AccessorReflectFast() { + // Field address; + // try { + // address = MemoryUtil.getAddressField(); + // } catch (NoSuchFieldException e) { + // throw new UnsupportedOperationException(e); + // } + // address.setAccessible(true); - try { - Method m = Field.class.getDeclaredMethod("acquireFieldAccessor", boolean.class); - m.setAccessible(true); - addressAccessor = (FieldAccessor)m.invoke(address, true); - } catch (Exception e) { - throw new UnsupportedOperationException(e); - } - } + // try { + // Method m = Field.class.getDeclaredMethod("acquireFieldAccessor", boolean.class); + // m.setAccessible(true); + // addressAccessor = (FieldAccessor)m.invoke(address, true); + // } catch (Exception e) { + // throw new UnsupportedOperationException(e); + // } + // } - public long getAddress(final Buffer buffer) { - return addressAccessor.getLong(buffer); - } + // public long getAddress(final Buffer buffer) { + // return addressAccessor.getLong(buffer); + // } - } + // } -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/input/Keyboard.java b/src/java/org/lwjgl/input/Keyboard.java index 00c7652b..2a99203b 100644 --- a/src/java/org/lwjgl/input/Keyboard.java +++ b/src/java/org/lwjgl/input/Keyboard.java @@ -33,6 +33,7 @@ package org.lwjgl.input; import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; @@ -331,7 +332,7 @@ public class Keyboard { } private static void reset() { - readBuffer.limit(0); + ((Buffer)readBuffer).limit(0); for (int i = 0; i < keyDownBuffer.remaining(); i++) keyDownBuffer.put(i, (byte)0); current_event.reset(); @@ -392,7 +393,7 @@ public class Keyboard { private static void read() { readBuffer.compact(); implementation.readKeyboard(readBuffer); - readBuffer.flip(); + ((Buffer)readBuffer).flip(); } /** @@ -453,7 +454,7 @@ public class Keyboard { int num_events = 0; while (readNext(tmp_event) && (!tmp_event.repeat || repeat_enabled)) num_events++; - readBuffer.position(old_position); + ((Buffer)readBuffer).position(old_position); return num_events; } } diff --git a/src/java/org/lwjgl/input/Mouse.java b/src/java/org/lwjgl/input/Mouse.java index 9c32bc6f..59157937 100644 --- a/src/java/org/lwjgl/input/Mouse.java +++ b/src/java/org/lwjgl/input/Mouse.java @@ -31,6 +31,7 @@ */ package org.lwjgl.input; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.security.AccessController; @@ -249,7 +250,7 @@ public class Mouse { private static void resetMouse() { dx = dy = dwheel = 0; - readBuffer.position(readBuffer.limit()); + ((Buffer)readBuffer).position(readBuffer.limit()); } static InputImplementation getImplementation() { @@ -279,7 +280,7 @@ public class Mouse { if (currentCursor != null && implementation.getNativeCursorCapabilities() != 0) setNativeCursor(currentCursor); readBuffer = ByteBuffer.allocate(EVENT_SIZE * BUFFER_SIZE); - readBuffer.limit(0); + ((Buffer)readBuffer).limit(0); setGrabbed(isGrabbed); } @@ -383,7 +384,7 @@ public class Mouse { private static void read() { readBuffer.compact(); implementation.readMouse(readBuffer); - readBuffer.flip(); + ((Buffer)readBuffer).flip(); } /** diff --git a/src/java/org/lwjgl/openal/ALC11.java b/src/java/org/lwjgl/openal/ALC11.java index ae849a9e..301eb5e6 100644 --- a/src/java/org/lwjgl/openal/ALC11.java +++ b/src/java/org/lwjgl/openal/ALC11.java @@ -31,6 +31,7 @@ */ package org.lwjgl.openal; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -177,7 +178,7 @@ public final class ALC11 { try { IntBuffer ib = BufferUtils.createIntBuffer(2); ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MAJOR_VERSION, ib); - ib.position(1); + ((Buffer)ib).position(1); ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MINOR_VERSION, ib); int major = ib.get(0); diff --git a/src/java/org/lwjgl/opengl/APIUtil.java b/src/java/org/lwjgl/opengl/APIUtil.java index 86ef98c3..e7212761 100644 --- a/src/java/org/lwjgl/opengl/APIUtil.java +++ b/src/java/org/lwjgl/opengl/APIUtil.java @@ -97,7 +97,7 @@ final class APIUtil { buffer = BufferUtils.createByteBuffer(size); caps.util.buffer = buffer; } else - buffer.clear(); + ((Buffer)buffer).clear(); return buffer; } @@ -114,8 +114,8 @@ final class APIUtil { bufferNew.put(buffer); caps.util.buffer = (buffer = bufferNew); } else { - buffer.position(buffer.limit()); - buffer.limit(buffer.capacity()); + ((Buffer)buffer).position(buffer.limit()); + ((Buffer)buffer).limit(buffer.capacity()); } return buffer; @@ -193,7 +193,7 @@ final class APIUtil { */ static long getBuffer(final ContextCapabilities caps, final CharSequence string) { final ByteBuffer buffer = encode(getBufferByte(caps, string.length()), string); - buffer.flip(); + ((Buffer)buffer).flip(); return MemoryUtil.getAddress0(buffer); } @@ -206,7 +206,7 @@ final class APIUtil { */ static long getBuffer(final ContextCapabilities caps, final CharSequence string, final int offset) { final ByteBuffer buffer = encode(getBufferByteOffset(caps, offset + string.length()), string); - buffer.flip(); + ((Buffer)buffer).flip(); return MemoryUtil.getAddress(buffer); } @@ -220,7 +220,7 @@ final class APIUtil { static long getBufferNT(final ContextCapabilities caps, final CharSequence string) { final ByteBuffer buffer = encode(getBufferByte(caps, string.length() + 1), string); buffer.put((byte)0); - buffer.flip(); + ((Buffer)buffer).flip(); return MemoryUtil.getAddress0(buffer); } @@ -245,7 +245,7 @@ final class APIUtil { for ( CharSequence string : strings ) encode(buffer, string); - buffer.flip(); + ((Buffer)buffer).flip(); return MemoryUtil.getAddress0(buffer); } @@ -264,7 +264,7 @@ final class APIUtil { buffer.put((byte)0); } - buffer.flip(); + ((Buffer)buffer).flip(); return MemoryUtil.getAddress0(buffer); } @@ -281,7 +281,7 @@ final class APIUtil { for ( CharSequence string : strings ) buffer.put(string.length()); - buffer.flip(); + ((Buffer)buffer).flip(); return MemoryUtil.getAddress0(buffer); } @@ -293,4 +293,4 @@ final class APIUtil { return MemoryUtil.getAddress0(getBufferByte(caps, 0)); } -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/Display.java b/src/java/org/lwjgl/opengl/Display.java index 8b0a55f1..a519b23e 100644 --- a/src/java/org/lwjgl/opengl/Display.java +++ b/src/java/org/lwjgl/opengl/Display.java @@ -55,6 +55,7 @@ import java.awt.*; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.security.AccessController; @@ -1222,8 +1223,8 @@ public final class Display { cached_icons[i] = BufferUtils.createByteBuffer(icons[i].capacity()); int old_position = icons[i].position(); cached_icons[i].put(icons[i]); - icons[i].position(old_position); - cached_icons[i].flip(); + ((Buffer)icons[i]).position(old_position); + ((Buffer)cached_icons[i]).flip(); } } diff --git a/src/java/org/lwjgl/opengl/EventQueue.java b/src/java/org/lwjgl/opengl/EventQueue.java index 064a3f86..dc2333ec 100644 --- a/src/java/org/lwjgl/opengl/EventQueue.java +++ b/src/java/org/lwjgl/opengl/EventQueue.java @@ -36,6 +36,7 @@ package org.lwjgl.opengl; * @author elias_naur */ +import java.nio.Buffer; import java.nio.ByteBuffer; class EventQueue { @@ -58,12 +59,12 @@ class EventQueue { * Copy available events into the specified buffer. */ public synchronized void copyEvents(ByteBuffer dest) { - queue.flip(); + ((Buffer)queue).flip(); int old_limit = queue.limit(); if (dest.remaining() < queue.remaining()) - queue.limit(dest.remaining() + queue.position()); + ((Buffer)queue).limit(dest.remaining() + queue.position()); dest.put(queue); - queue.limit(old_limit); + ((Buffer)queue).limit(old_limit); queue.compact(); } diff --git a/src/java/org/lwjgl/opengl/MacOSXNativeKeyboard.java b/src/java/org/lwjgl/opengl/MacOSXNativeKeyboard.java index 428541a6..636c5b10 100644 --- a/src/java/org/lwjgl/opengl/MacOSXNativeKeyboard.java +++ b/src/java/org/lwjgl/opengl/MacOSXNativeKeyboard.java @@ -39,6 +39,7 @@ package org.lwjgl.opengl; import java.awt.event.KeyEvent; import java.util.HashMap; +import java.nio.Buffer; import java.nio.ByteBuffer; import org.lwjgl.input.Keyboard; @@ -209,9 +210,9 @@ final class MacOSXNativeKeyboard extends EventQueue { } public void putKeyboardEvent(int key_code, byte state, int character, long nanos, boolean repeat) { - event.clear(); + ((Buffer)event).clear(); event.putInt(key_code).put(state).putInt(character).putLong(nanos).put(repeat ? (byte)1 : (byte)0); - event.flip(); + ((Buffer)event).flip(); putEvent(event); } @@ -219,7 +220,7 @@ final class MacOSXNativeKeyboard extends EventQueue { flushDeferredEvent(); int old_position = key_down_buffer.position(); key_down_buffer.put(key_states); - key_down_buffer.position(old_position); + ((Buffer)key_down_buffer).position(old_position); } public synchronized void copyEvents(ByteBuffer dest) { diff --git a/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java b/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java index 8d23bfcf..ab8ed174 100644 --- a/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java +++ b/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java @@ -37,6 +37,7 @@ package org.lwjgl.opengl; * @author kappaOne */ +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -156,9 +157,9 @@ final class MacOSXNativeMouse extends EventQueue { } protected void putMouseEventWithCoords(byte button, byte state, int coord1, int coord2, int dz, long nanos) { - event.clear(); + ((Buffer)event).clear(); event.put(button).put(state).putInt(coord1).putInt(coord2).putInt(dz).putLong(nanos); - event.flip(); + ((Buffer)event).flip(); putEvent(event); } @@ -174,7 +175,7 @@ final class MacOSXNativeMouse extends EventQueue { accum_dx = accum_dy = accum_dz = 0; int old_position = buttons_buffer.position(); buttons_buffer.put(buttons, 0, buttons.length); - buttons_buffer.position(old_position); + ((Buffer)buttons_buffer).position(old_position); } private void setCursorPos(float x, float y, long nanos) { diff --git a/src/java/org/lwjgl/util/applet/AppletLoader.java b/src/java/org/lwjgl/util/applet/AppletLoader.java index 2628ad1a..710e6065 100644 --- a/src/java/org/lwjgl/util/applet/AppletLoader.java +++ b/src/java/org/lwjgl/util/applet/AppletLoader.java @@ -85,7 +85,6 @@ import java.util.concurrent.Future; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; -import java.util.jar.Pack200; import java.util.zip.CRC32; import java.util.zip.CheckedInputStream; import java.util.zip.GZIPInputStream; @@ -376,12 +375,12 @@ public class AppletLoader extends Applet implements Runnable, AppletStub { } // check pack200 support - try { - java.util.jar.Pack200.class.getSimpleName(); - pack200Supported = true; - } catch (Throwable e) { - /* no pack200 support */ - } + // try { + // java.util.jar.Pack200.class.getSimpleName(); + // pack200Supported = true; + // } catch (Throwable e) { + // /* no pack200 support */ + // } } /** @@ -1680,20 +1679,21 @@ public class AppletLoader extends Applet implements Runnable, AppletStub { * @throws Exception if any errors occur */ protected void extractPack(String in, String out) throws Exception { - File f = new File(in); - FileOutputStream fostream = new FileOutputStream(out); - JarOutputStream jostream = new JarOutputStream(fostream); + throw new UnsupportedOperationException(); + // File f = new File(in); + // FileOutputStream fostream = new FileOutputStream(out); + // JarOutputStream jostream = new JarOutputStream(fostream); - try { - Pack200.Unpacker unpacker = Pack200.newUnpacker(); - unpacker.unpack(f, jostream); - } finally { - jostream.close(); - fostream.close(); - } + // try { + // Pack200.Unpacker unpacker = Pack200.newUnpacker(); + // unpacker.unpack(f, jostream); + // } finally { + // jostream.close(); + // fostream.close(); + // } - // delete pack file as its no longer needed - f.delete(); + // // delete pack file as its no longer needed + // f.delete(); } /** diff --git a/src/java/org/lwjgl/util/generator/GeneratorProcessor.java b/src/java/org/lwjgl/util/generator/GeneratorProcessor.java index dc034047..a74e9bc3 100644 --- a/src/java/org/lwjgl/util/generator/GeneratorProcessor.java +++ b/src/java/org/lwjgl/util/generator/GeneratorProcessor.java @@ -51,7 +51,7 @@ import javax.tools.Diagnostic; * @version $Revision$ $Id$ */ @SupportedAnnotationTypes({ "*" }) -@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedSourceVersion(SourceVersion.RELEASE_7) @SupportedOptions({ "binpath", "typemap", "generatechecks", "contextspecific" }) public class GeneratorProcessor extends AbstractProcessor { diff --git a/src/java/org/lwjgl/util/generator/GeneratorVisitor.java b/src/java/org/lwjgl/util/generator/GeneratorVisitor.java index 98c933f9..2c713871 100644 --- a/src/java/org/lwjgl/util/generator/GeneratorVisitor.java +++ b/src/java/org/lwjgl/util/generator/GeneratorVisitor.java @@ -300,7 +300,10 @@ public class GeneratorVisitor extends ElementKindVisitor6 { } // TODO: Back-port LWJGL 3's generation file handling (generate in-memory and avoid touching files if nothing has changed) - java_writer = new PrintWriter(env.getFiler().createSourceFile(Utils.getQualifiedClassName(e), env.getElementUtils().getPackageOf(e)).openWriter()); + // java_writer = new PrintWriter(env.getFiler().createSourceFile(Utils.getQualifiedClassName(e), env.getElementUtils().getPackageOf(e)).openWriter()); + outputJava.getParentFile().mkdirs(); + outputJava.createNewFile(); + java_writer = new PrintWriter(outputJava); generateJavaSource(e, java_writer); if ( methods.size() > 0 ) { diff --git a/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessor.java b/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessor.java index c4e1bad0..c14f3696 100644 --- a/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessor.java +++ b/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessor.java @@ -50,7 +50,7 @@ import javax.lang.model.util.ElementFilter; * @author Spasi */ @SupportedAnnotationTypes({ "*" }) -@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedSourceVersion(SourceVersion.RELEASE_7) @SupportedOptions({ "generatechecks", "contextspecific" }) public class CLGeneratorProcessor extends AbstractProcessor { diff --git a/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessor.java b/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessor.java index 5e539664..4bfcb5a8 100644 --- a/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessor.java +++ b/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessor.java @@ -50,7 +50,7 @@ import javax.lang.model.util.ElementFilter; * 2010-04-09 23:57:40Z spasi $ */ @SupportedAnnotationTypes({ "*" }) -@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedSourceVersion(SourceVersion.RELEASE_7) @SupportedOptions({ "contextspecific", "generatechecks" }) public class GLESGeneratorProcessor extends AbstractProcessor { diff --git a/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessor.java b/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessor.java index 1581af4d..ec404e9e 100644 --- a/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessor.java +++ b/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessor.java @@ -50,7 +50,7 @@ import javax.lang.model.util.ElementFilter; * 2010-04-09 23:57:40Z spasi $ */ @SupportedAnnotationTypes({ "*" }) -@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedSourceVersion(SourceVersion.RELEASE_7) @SupportedOptions({ "generatechecks", "contextspecific" }) public class GLGeneratorProcessor extends AbstractProcessor { diff --git a/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessor.java b/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessor.java index c27fb170..5bdfb7e0 100644 --- a/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessor.java +++ b/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessor.java @@ -53,7 +53,7 @@ import javax.lang.model.util.ElementFilter; * 2009-09-08 15:07:15Z spasi $ */ @SupportedAnnotationTypes({ "*" }) -@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedSourceVersion(SourceVersion.RELEASE_7) @SupportedOptions({ "generatechecks", "contextspecific" }) public class GLReferencesGeneratorProcessor extends AbstractProcessor { diff --git a/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c b/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c index ebb5dacd..53f3442b 100644 --- a/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c +++ b/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c @@ -39,11 +39,7 @@ */ #include -#ifdef __MACH__ -#include -#else #include -#endif #include "org_lwjgl_opengl_AWTSurfaceLock.h" #include "awt_tools.h" #include "common_tools.h" diff --git a/src/native/macosx/context.h b/src/native/macosx/context.h index 2753d3e5..8fee142f 100644 --- a/src/native/macosx/context.h +++ b/src/native/macosx/context.h @@ -50,6 +50,11 @@ #include "common_tools.h" #include +typedef struct JAWT_MacOSXDrawingSurfaceInfo { + NSView *cocoaViewRef; // the view is guaranteed to be valid only for the duration of Component.paint method +} +JAWT_MacOSXDrawingSurfaceInfo; + enum { NSControlLeftKeyMask = 0x0001, NSControlRightKeyMask = 0x2000, diff --git a/src/native/macosx/context.m b/src/native/macosx/context.m index 1bc8c359..5761b79d 100644 --- a/src/native/macosx/context.m +++ b/src/native/macosx/context.m @@ -101,10 +101,11 @@ NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool g bpp = 16; else if(CFStringCompare(pixEnc, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) bpp = 8; - else - bpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); + else { + throwException(env, "unknown pixel encoding"); + } } else { - bpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); + throwException(env, "unreachable"); } } else diff --git a/src/native/macosx/org_lwjgl_MacOSXSysImplementation.m b/src/native/macosx/org_lwjgl_MacOSXSysImplementation.m new file mode 100644 index 00000000..802ec528 --- /dev/null +++ b/src/native/macosx/org_lwjgl_MacOSXSysImplementation.m @@ -0,0 +1,12 @@ +#import +#import +#import "org_lwjgl_MacOSXSysImplementation.h" + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_MacOSXSysImplementation_openURL(JNIEnv * env, jobject this, jstring url) { + @autoreleasepool { + const jchar *chars = (*env)->GetStringChars(env, url, NULL); + NSString *s = [NSString stringWithCharacters:chars length:(*env)->GetStringLength(env, url)]; + [[NSWorkspace shared] openURL: [NSURL URLWithString:s]]; + (*env)->ReleaseStringChars(env, url, chars); + } +} diff --git a/src/native/macosx/org_lwjgl_opengl_Display.m b/src/native/macosx/org_lwjgl_opengl_Display.m index 35d0afd6..e64890bb 100644 --- a/src/native/macosx/org_lwjgl_opengl_Display.m +++ b/src/native/macosx/org_lwjgl_opengl_Display.m @@ -77,10 +77,7 @@ static NSUInteger lastModifierFlags = 0; // Inform the view of its parent window info; [window_info->view setParent:window_info]; - if (window_info->enableHighDPI) { - // call method using runtime selector as its a 10.7+ api and allows compiling on older SDK's - [window_info->view performSelector:NSSelectorFromString(@"setWantsBestResolutionOpenGLSurface:") withObject:YES]; - } + [window_info->view setWantsBestResolutionOpenGLSurface:NO]; // set nsapp delegate for catching app quit events [NSApp setDelegate:window_info->view]; @@ -261,7 +258,9 @@ static NSUInteger lastModifierFlags = 0; if (context == nil) return; if ([context view] != self) { - [context setView:self]; + dispatch_sync(dispatch_get_main_queue(), ^{ + [context setView:self]; + }); } [context makeCurrentContext]; @@ -594,7 +593,9 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nResizeWindow(JNIEnv MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); window_info->display_rect = NSMakeRect(x, y, width, height); [window_info->window setFrame:window_info->display_rect display:false]; - [window_info->view update]; + dispatch_sync(dispatch_get_main_queue(), ^{ + [window_info->view update]; + }); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nWasResized(JNIEnv *env, jobject this, jobject window_handle) { diff --git a/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m b/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m index 20cd7a5d..dfad16f9 100644 --- a/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m +++ b/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m @@ -132,7 +132,9 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nUpdate (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); - [context_info->context update]; + dispatch_sync(dispatch_get_main_queue(), ^{ + [context_info->context update]; + }); [pool release]; } @@ -163,7 +165,9 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_setView peer_info->glLayer->setViewport = YES; } - [context_info->context setView: peer_info->window_info->view]; + dispatch_sync(dispatch_get_main_queue(), ^{ + [context_info->context setView: peer_info->window_info->view]; + }); } else { [context_info->context setPixelBuffer:peer_info->pbuffer cubeMapFace:0 mipMapLevel:0 currentVirtualScreen:0];