|
From: <ka...@us...> - 2012-11-01 22:21:30
|
Revision: 3807
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3807&view=rev
Author: kappa1
Date: 2012-11-01 22:21:23 +0000 (Thu, 01 Nov 2012)
Log Message:
-----------
Updated macosx_ant build.xml, removed PPC support, bumped the minimum OS X SDK for 32/64bit native to SDK 10.5. Commented out some code in Display.m that required SDK 10.7+, namely NSApplicationPresentationFullScreen, etc
Modified Paths:
--------------
branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml
branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m
Modified: branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml
===================================================================
--- branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml 2012-11-01 20:54:17 UTC (rev 3806)
+++ branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml 2012-11-01 22:21:23 UTC (rev 3807)
@@ -3,7 +3,7 @@
<property name="native" location="../../src/native"/>
<target name="init">
- <mkdir dir="ppc"/>
+ <!--mkdir dir="ppc"/-->
<mkdir dir="i386"/>
<mkdir dir="x86_64"/>
</target>
@@ -12,7 +12,7 @@
<delete failonerror="false">
<fileset dir="i386"/>
<fileset dir="x86_64"/>
- <fileset dir="ppc"/>
+ <!--fileset dir="ppc"/-->
<fileset dir="." includes="liblwjgl.jnilib"/>
<fileset dir="." includes="lwjgl.symbols"/>
</delete>
@@ -46,21 +46,21 @@
<target name="nativelibrary" depends="init">
<property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/>
- <property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/>
+ <!--property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/-->
<property name="x86_64_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/>
<property name="universal_flags" value="-isysroot ${universal_sdkroot}"/>
- <property name="ppc_flags" value="-isysroot ${ppc_sdkroot}"/>
+ <!--property name="ppc_flags" value="-isysroot ${ppc_sdkroot}"/>
<antcall target="compile">
<param name="dstdir" location="ppc"/>
<param name="compiler" value="gcc-4.2"/>
<param name="sdkroot" location="${ppc_sdkroot}"/>
<param name="cflags" value="${universal_flags} -arch ppc -mmacosx-version-min=10.3"/>
- </antcall>
+ </antcall-->
<antcall target="compile">
<param name="dstdir" location="i386"/>
<param name="compiler" value="gcc-4.2"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
- <param name="cflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.4"/>
+ <param name="cflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.5"/>
</antcall>
<antcall target="compile">
<param name="dstdir" location="x86_64"/>
@@ -72,12 +72,12 @@
<arg path="../../platform_build/macosx_ant/build-symbol-list"/>
<arg path="i386"/>
</exec>
- <antcall target="link">
+ <!--antcall target="link">
<param name="objdir" location="ppc"/>
<param name="libname" value="liblwjgl-ppc.jnilib"/>
<param name="linker" value="gcc-4.2"/>
<param name="linkerflags" value="${universal_flags} -arch ppc -mmacosx-version-min=10.3"/>
- </antcall>
+ </antcall-->
<antcall target="link">
<param name="objdir" location="i386"/>
<param name="libname" value="liblwjgl-i386.jnilib"/>
@@ -95,7 +95,7 @@
<srcfile/>
<arg value="-output"/>
<arg path="liblwjgl.jnilib"/>
- <fileset file="ppc/liblwjgl-ppc.jnilib"/>
+ <!--fileset file="ppc/liblwjgl-ppc.jnilib"/-->
<fileset file="i386/liblwjgl-i386.jnilib"/>
<fileset file="x86_64/liblwjgl-i86_64.jnilib"/>
</apply>
Modified: branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m
===================================================================
--- branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m 2012-11-01 20:54:17 UTC (rev 3806)
+++ branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m 2012-11-01 22:21:23 UTC (rev 3807)
@@ -315,7 +315,7 @@
}
- (void)scrollWheel:(NSEvent *)event {
- JNIEnv *env = attachCurrentThread();
+ /*JNIEnv *env = attachCurrentThread();
if (env == nil || event == nil || _parent == nil) {
return;
}
@@ -328,6 +328,7 @@
jmethodID mousemove = (*env)->GetMethodID(env, mouse_class, "mouseMoved", "(FFFFFJ)V");
NSPoint loc = [self convertPoint:[event locationInWindow] toView:self];
(*env)->CallVoidMethod(env, _parent->jmouse, mousemove, loc.x, loc.y, [event deltaX], [event deltaY], dz, time);
+ */
}
- (void)viewDidMoveToWindow
@@ -492,9 +493,9 @@
MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle);
if(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) {
- NSApplicationPresentationOptions options = NSApplicationPresentationDefault;
+ /*NSApplicationPresentationOptions options = NSApplicationPresentationDefault;
if (hide == JNI_TRUE) {
- options = NSApplicationPresentationFullScreen;
+ options = NSApplicationPresentationFullScreen; // this requires OS X 10.7+ to compile
options |= NSApplicationPresentationHideDock;
options |= NSApplicationPresentationHideMenuBar;
}
@@ -502,7 +503,7 @@
window_info->window_options = options;
if (window_info->window != nil) {
[[NSApplication sharedApplication] setPresentationOptions:options];
- }
+ }*/
} else {
if (hide == JNI_TRUE) {
SetSystemUIMode(kUIModeContentSuppressed, 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-11-04 20:11:10
|
Revision: 3814
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3814&view=rev
Author: kappa1
Date: 2012-11-04 20:11:03 +0000 (Sun, 04 Nov 2012)
Log Message:
-----------
Tiny Clean up and remove some more references to JNF
Modified Paths:
--------------
branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml
branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m
Modified: branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml
===================================================================
--- branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml 2012-11-04 20:09:13 UTC (rev 3813)
+++ branches/osx-java7/LWJGL/platform_build/macosx_ant/build.xml 2012-11-04 20:11:03 UTC (rev 3814)
@@ -3,7 +3,6 @@
<property name="native" location="../../src/native"/>
<target name="init">
- <!--mkdir dir="ppc"/-->
<mkdir dir="i386"/>
<mkdir dir="x86_64"/>
</target>
@@ -12,7 +11,6 @@
<delete failonerror="false">
<fileset dir="i386"/>
<fileset dir="x86_64"/>
- <!--fileset dir="ppc"/-->
<fileset dir="." includes="liblwjgl.jnilib"/>
<fileset dir="." includes="lwjgl.symbols"/>
</delete>
@@ -20,7 +18,7 @@
<target name="compile">
<apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}">
- <arg line="${cflags} -ObjC -O2 -Wall -Wunused -c -fPIC -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${native}/common -I${native}/common/opengl -I${native}/macosx -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaNativeFoundation.framework/Versions/A/Headers"/>
+ <arg line="${cflags} -ObjC -O2 -Wall -Wunused -c -fPIC -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${native}/common -I${native}/common/opengl -I${native}/macosx"/>
<!-- Map from *.m and *.c to .o -->
<mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/>
<fileset dir="${native}/macosx" includes="*.m"/>
@@ -35,7 +33,7 @@
<target name="link">
<apply dir="${objdir}" parallel="true" executable="${linker}" os="Mac OS X" failonerror="true" skipemptyfilesets="true">
- <arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -weak_framework AppKit -framework JavaVM -framework Carbon -framework OpenGL -framework QuartzCore -framework JavaNativeFoundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks"/>
+ <arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -weak_framework AppKit -framework JavaVM -framework Carbon -framework OpenGL -framework QuartzCore -F/System/Library/Frameworks/JavaVM.framework/Frameworks"/>
<fileset dir="${objdir}" includes="*.o"/>
</apply>
<apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true">
@@ -46,17 +44,9 @@
<target name="nativelibrary" depends="init">
<property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/>
- <!--property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/-->
<property name="x86_64_sdkroot" location="/Developer/SDKs/MacOSX10.6.sdk"/>
<property name="universal_flags" value="-isysroot ${universal_sdkroot}"/>
- <!--property name="ppc_flags" value="-isysroot ${ppc_sdkroot}"/>
<antcall target="compile">
- <param name="dstdir" location="ppc"/>
- <param name="compiler" value="gcc-4.2"/>
- <param name="sdkroot" location="${ppc_sdkroot}"/>
- <param name="cflags" value="${universal_flags} -arch ppc -mmacosx-version-min=10.3"/>
- </antcall-->
- <antcall target="compile">
<param name="dstdir" location="i386"/>
<param name="compiler" value="gcc-4.2"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
@@ -72,17 +62,11 @@
<arg path="../../platform_build/macosx_ant/build-symbol-list"/>
<arg path="i386"/>
</exec>
- <!--antcall target="link">
- <param name="objdir" location="ppc"/>
- <param name="libname" value="liblwjgl-ppc.jnilib"/>
- <param name="linker" value="gcc-4.2"/>
- <param name="linkerflags" value="${universal_flags} -arch ppc -mmacosx-version-min=10.3"/>
- </antcall-->
<antcall target="link">
<param name="objdir" location="i386"/>
<param name="libname" value="liblwjgl-i386.jnilib"/>
<param name="linker" value="gcc-4.2"/>
- <param name="linkerflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.4"/>
+ <param name="linkerflags" value="${universal_flags} -arch i386 -mmacosx-version-min=10.5"/>
</antcall>
<antcall target="link">
<param name="objdir" location="x86_64"/>
@@ -95,7 +79,6 @@
<srcfile/>
<arg value="-output"/>
<arg path="liblwjgl.jnilib"/>
- <!--fileset file="ppc/liblwjgl-ppc.jnilib"/-->
<fileset file="i386/liblwjgl-i386.jnilib"/>
<fileset file="x86_64/liblwjgl-i86_64.jnilib"/>
</apply>
Modified: branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m
===================================================================
--- branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m 2012-11-04 20:09:13 UTC (rev 3813)
+++ branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m 2012-11-04 20:11:03 UTC (rev 3814)
@@ -317,20 +317,19 @@
}
- (void)scrollWheel:(NSEvent *)event {
- /*JNIEnv *env = attachCurrentThread();
+ JNIEnv *env = attachCurrentThread();
if (env == nil || event == nil || _parent == nil) {
return;
}
long time = [event timestamp] * 1000000000;
- float dz = [event scrollingDeltaY];
- if (![event hasPreciseScrollingDeltas]) {
- dz *= 12; // or so
- }
- jclass mouse_class = (*env)->GetObjectClass(env, _parent->jmouse);
- jmethodID mousemove = (*env)->GetMethodID(env, mouse_class, "mouseMoved", "(FFFFFJ)V");
- NSPoint loc = [self convertPoint:[event locationInWindow] toView:self];
- (*env)->CallVoidMethod(env, _parent->jmouse, mousemove, loc.x, loc.y, [event deltaX], [event deltaY], dz, time);
- */
+ //float dz = [event scrollingDeltaY]; // An OS X 10.7+ API
+ //if (![event hasPreciseScrollingDeltas]) { // Also an OS X 10.7 API
+ // dz *= 12; // or so
+ //}
+ //jclass mouse_class = (*env)->GetObjectClass(env, _parent->jmouse);
+ //jmethodID mousemove = (*env)->GetMethodID(env, mouse_class, "mouseMoved", "(FFFFFJ)V");
+ //NSPoint loc = [self convertPoint:[event locationInWindow] toView:self];
+ //(*env)->CallVoidMethod(env, _parent->jmouse, mousemove, loc.x, loc.y, [event deltaX], [event deltaY], dz, time);
}
- (void)viewDidMoveToWindow
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-11-13 21:13:21
|
Revision: 3826
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3826&view=rev
Author: kappa1
Date: 2012-11-13 21:13:11 +0000 (Tue, 13 Nov 2012)
Log Message:
-----------
Cleaned up code by removing unneeded java classes MacOSXFrame and MacOSXMouseEventQueue and native code by removing mouse.c
Modified Paths:
--------------
branches/osx-java7/LWJGL/build.xml
branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java
Removed Paths:
-------------
branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java
branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java
branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.c
Modified: branches/osx-java7/LWJGL/build.xml
===================================================================
--- branches/osx-java7/LWJGL/build.xml 2012-11-11 19:03:50 UTC (rev 3825)
+++ branches/osx-java7/LWJGL/build.xml 2012-11-13 21:13:11 UTC (rev 3826)
@@ -316,7 +316,6 @@
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes">
<class name="org.lwjgl.MacOSXSysImplementation" />
- <class name="org.lwjgl.opengl.MacOSXMouseEventQueue" />
<class name="org.lwjgl.opengl.MacOSXCanvasPeerInfo" />
<class name="org.lwjgl.opengl.MacOSXPeerInfo" />
<class name="org.lwjgl.opengl.MacOSXPbufferPeerInfo" />
Modified: branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
===================================================================
--- branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2012-11-11 19:03:50 UTC (rev 3825)
+++ branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2012-11-13 21:13:11 UTC (rev 3826)
@@ -70,7 +70,7 @@
private MacOSXCanvasListener canvas_listener;
private Canvas canvas;
private Robot robot;
- private MacOSXMouseEventQueue mouse_queue;
+ //private MacOSXMouseEventQueue mouse_queue;
private KeyboardEventQueue keyboard_queue;
private java.awt.DisplayMode requested_mode;
@@ -84,30 +84,10 @@
private int width;
private int height;
- /* Whether we're using a native window or an AWT canvas */
- private boolean native_mode;
+ private boolean close_requested;
- private boolean close_requested;
-
MacOSXDisplay() {
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- Application.getApplication().addApplicationListener(new ApplicationAdapter() {
- public void handleQuit(ApplicationEvent event) {
- doHandleQuit();
- }
- });
- return null;
- }
- });
- } catch (Throwable e) {
- /**
- * In an applet environment, referencing com.apple.eawt.Application can fail with
- * a native exception. So log any exceptions instead of re-throwing.
- */
- LWJGLUtil.log("Failed to register quit handler: " + e.getMessage());
- }
+
}
private native ByteBuffer nCreateWindow(int x, int y, int width, int height, boolean fullscreen, boolean undecorated, ByteBuffer peer_info_handle, ByteBuffer window_handle) throws LWJGLException;
@@ -142,7 +122,6 @@
window = nCreateWindow(x, y, mode.getWidth(), mode.getHeight(),
fullscreen, isUndecorated(),
peer_handle, window);
- native_mode = true;
this.x = x;
this.y = y;
this.width = mode.getWidth();
@@ -165,15 +144,8 @@
public native void nDestroyWindow(ByteBuffer window_handle);
public void destroyWindow() {
- if (native_mode) {
- nDestroyWindow(window);
- } else {
- if (canvas_listener != null) {
- canvas_listener.disableListeners();
- canvas_listener = null;
- }
- }
- hideUI(false);
+ nDestroyWindow(window);
+ hideUI(false);
}
public int getGammaRampLength() {
@@ -213,11 +185,7 @@
}
public void resetDisplayMode() {
- if (!native_mode) {
- if (getDevice().getFullScreenWindow() != null)
- getDevice().setFullScreenWindow(null);
- }
- requested_mode = null;
+ requested_mode = null;
restoreGamma();
}
@@ -273,12 +241,8 @@
}
public boolean isActive() {
- if (native_mode) {
- boolean ret = nIsFocused(window);
- return ret;
- } else {
- return canvas.isFocusOwner();
- }
+ boolean ret = nIsFocused(window);
+ return ret;
}
public Canvas getCanvas() {
@@ -300,10 +264,7 @@
private static final IntBuffer current_viewport = BufferUtils.createIntBuffer(16);
public void update() {
boolean should_update = true;
- if (!native_mode) {
- should_update = canvas_listener.syncShouldUpdateContext();
- }
- /*
+ /*
* Workaround for the "white screen in fullscreen mode" problem
*
* Sometimes, switching from windowed mode to fullscreen or simply creating the Display
@@ -331,14 +292,6 @@
glGetInteger(GL_VIEWPORT, current_viewport);
glViewport(current_viewport.get(0), current_viewport.get(1), current_viewport.get(2), current_viewport.get(3));
}
- /*
- if (frame != null && mouse_queue != null) {
- if (frame.syncShouldReleaseCursor())
- MacOSXMouseEventQueue.nGrabMouse(false);
- if (frame.syncShouldWarpCursor())
- mouse_queue.warpCursor();
- }
- */
}
/**
@@ -369,52 +322,29 @@
}
public void createMouse() throws LWJGLException {
- if (native_mode) {
- mouse = new MacOSXNativeMouse(this, window);
- mouse.register();
- } else {
- mouse_queue = new MacOSXMouseEventQueue(canvas);
- mouse_queue.register();
- }
+ mouse = new MacOSXNativeMouse(this, window);
+ mouse.register();
}
public void destroyMouse() {
- MacOSXMouseEventQueue.nGrabMouse(false);
- if (native_mode) {
- if (mouse != null) {
- mouse.unregister();
- }
- mouse = null;
- } else {
- if (mouse_queue != null) {
- mouse_queue.unregister();
- }
- mouse_queue = null;
+ //MacOSXMouseEventQueue.nGrabMouse(false);
+
+ if (mouse != null) {
+ mouse.unregister();
}
+ mouse = null;
}
public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons_buffer) {
- if (native_mode) {
- mouse.poll(coord_buffer, buttons_buffer);
- } else {
- mouse_queue.poll(coord_buffer, buttons_buffer);
- }
+ mouse.poll(coord_buffer, buttons_buffer);
}
public void readMouse(ByteBuffer buffer) {
- if (native_mode) {
- mouse.copyEvents(buffer);
- } else {
- mouse_queue.copyEvents(buffer);
- }
+ mouse.copyEvents(buffer);
}
public void grabMouse(boolean grab) {
- if (native_mode) {
- mouse.setGrabbed(grab);
- } else {
- mouse_queue.setGrabbed(grab);
- }
+ mouse.setGrabbed(grab);
}
public int getNativeCursorCapabilities() {
@@ -422,7 +352,10 @@
}
public void setCursorPosition(int x, int y) {
- MacOSXMouseEventQueue.nWarpCursor(x, y);
+ if (mouse != null) {
+ mouse.warpCursor(x, y);
+ }
+ //MacOSXMouseEventQueue.nWarpCursor(x, y);
}
public void setNativeCursor(Object handle) throws LWJGLException {
@@ -438,41 +371,23 @@
/* Keyboard */
public void createKeyboard() throws LWJGLException {
- if (native_mode) {
- this.keyboard = new MacOSXNativeKeyboard(window);
- keyboard.register();
- } else {
- this.keyboard_queue = new KeyboardEventQueue(canvas);
- keyboard_queue.register();
- }
+ this.keyboard = new MacOSXNativeKeyboard(window);
+ keyboard.register();
}
public void destroyKeyboard() {
- if (native_mode) {
- if (keyboard != null)
- keyboard.unregister();
- keyboard = null;
- } else {
- if (keyboard_queue != null)
- keyboard_queue.unregister();
- keyboard_queue = null;
- }
+ if (keyboard != null) {
+ keyboard.unregister();
+ }
+ keyboard = null;
}
public void pollKeyboard(ByteBuffer keyDownBuffer) {
- if (native_mode) {
- keyboard.poll(keyDownBuffer);
- } else {
- keyboard_queue.poll(keyDownBuffer);
- }
+ keyboard.poll(keyDownBuffer);
}
public void readKeyboard(ByteBuffer buffer) {
- if (native_mode) {
- keyboard.copyEvents(buffer);
- } else {
- keyboard_queue.copyEvents(buffer);
- }
+ keyboard.copyEvents(buffer);
}
/** Native cursor handles */
@@ -577,9 +492,7 @@
}
public void setResizable(boolean resizable) {
- if (native_mode) {
- nSetResizable(window, resizable);
- }
+ nSetResizable(window, resizable);
}
public boolean wasResized() {
Deleted: branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java
===================================================================
--- branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java 2012-11-11 19:03:50 UTC (rev 3825)
+++ branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java 2012-11-13 21:13:11 UTC (rev 3826)
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-/**
- * This is the Mac OS X AWT Frame. It contains thread safe
- * methods to manipulateit from non-AWT threads
- * @author elias_naur
- */
-
-import java.awt.BorderLayout;
-import java.awt.Frame;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.Insets;
-import java.awt.Rectangle;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import org.lwjgl.LWJGLException;
-
-final class MacOSXFrame extends Frame implements WindowListener, ComponentListener {
-
- private static final long serialVersionUID = -5823294716668988777L;
-
- private final MacOSXGLCanvas canvas;
- private boolean close_requested;
-
- /* States */
- private Rectangle bounds;
- private boolean active;
- private boolean minimized;
- private boolean should_warp_cursor;
- private boolean should_release_cursor;
-
- MacOSXFrame(DisplayMode mode, final java.awt.DisplayMode requested_mode, boolean fullscreen, int x, int y) throws LWJGLException {
- setResizable(Display.isResizable());
- addWindowListener(this);
- addComponentListener(this);
- canvas = new MacOSXGLCanvas();
- canvas.setFocusTraversalKeysEnabled(false);
- add(canvas, BorderLayout.CENTER);
- boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
- setUndecorated(fullscreen || undecorated);
- if ( fullscreen ) {
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- getDevice().setFullScreenWindow(MacOSXFrame.this);
- getDevice().setDisplayMode(requested_mode);
- java.awt.DisplayMode real_mode = getDevice().getDisplayMode();
- /** For some strange reason, the display mode is sometimes silently capped even though the mode is reported as supported */
- if ( requested_mode.getWidth() != real_mode.getWidth() || requested_mode.getHeight() != real_mode.getHeight() ) {
- getDevice().setFullScreenWindow(null);
- if (isDisplayable())
- dispose();
- throw new LWJGLException("AWT capped mode: requested mode = " + requested_mode.getWidth() + "x" + requested_mode.getHeight() +
- " but got " + real_mode.getWidth() + " " + real_mode.getHeight());
- }
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- throw new LWJGLException(e);
- }
- }
- pack();
- resize(x, y, mode.getWidth(), mode.getHeight());
- setVisible(true);
- requestFocus();
- canvas.requestFocus();
- updateBounds();
- }
-
- public void resize(int x, int y, int width, int height) {
- Insets insets = getInsets();
- setBounds(x, y, width + insets.left + insets.right, height + insets.top + insets.bottom);
- }
-
- public int getWidth() {
- Insets insets = getInsets();
- return super.getWidth() - insets.left - insets.right;
- }
-
- public int getHeight() {
- Insets insets = getInsets();
- return super.getHeight() - insets.top - insets.bottom;
- }
-
- public Rectangle syncGetBounds() {
- synchronized ( this ) {
- return bounds;
- }
- }
-
- public void componentShown(ComponentEvent e) {
- }
-
- public void componentHidden(ComponentEvent e) {
- }
-
- private void updateBounds() {
- synchronized ( this ) {
- bounds = getBounds();
- }
- }
-
- public void componentResized(ComponentEvent e) {
- updateBounds();
- }
-
- public void componentMoved(ComponentEvent e) {
- updateBounds();
- }
-
- public static GraphicsDevice getDevice() {
- GraphicsEnvironment g_env = GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsDevice device = g_env.getDefaultScreenDevice();
- return device;
- }
-
- public void windowIconified(WindowEvent e) {
- synchronized ( this ) {
- minimized = true;
- }
- }
-
- public void windowDeiconified(WindowEvent e) {
- synchronized ( this ) {
- minimized = false;
- }
- }
-
- public void windowOpened(WindowEvent e) {
- }
-
- public void windowClosed(WindowEvent e) {
- }
-
- public void windowClosing(WindowEvent e) {
- synchronized ( this ) {
- close_requested = true;
- }
- }
-
- public void windowDeactivated(WindowEvent e) {
- synchronized ( this ) {
- active = false;
- should_release_cursor = true;
- should_warp_cursor = false;
- }
- }
-
- public void windowActivated(WindowEvent e) {
- synchronized ( this ) {
- active = true;
- should_warp_cursor = true;
- should_release_cursor = false;
- }
- }
-
- public boolean syncIsCloseRequested() {
- boolean result;
- synchronized ( this ) {
- result = close_requested;
- close_requested = false;
- }
- return result;
- }
-
- public boolean syncIsVisible() {
- synchronized ( this ) {
- return !minimized;
- }
- }
-
- public boolean syncIsActive() {
- synchronized ( this ) {
- return active;
- }
- }
-
- public MacOSXGLCanvas getCanvas() {
- return canvas;
- }
-
- public boolean syncShouldReleaseCursor() {
- boolean result;
- synchronized ( this ) {
- result = should_release_cursor;
- should_release_cursor = false;
- }
- return result;
- }
-
- public boolean syncShouldWarpCursor() {
- boolean result;
- synchronized ( this ) {
- result = should_warp_cursor;
- should_warp_cursor = false;
- }
- return result;
- }
-}
Deleted: branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java
===================================================================
--- branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java 2012-11-11 19:03:50 UTC (rev 3825)
+++ branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java 2012-11-13 21:13:11 UTC (rev 3826)
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-/**
- * An AWT implementation of a LWJGL compatible Mouse event queue.
- * @author elias_naur
- */
-
-import java.awt.Component;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.nio.IntBuffer;
-
-import org.lwjgl.BufferUtils;
-
-final class MacOSXMouseEventQueue extends MouseEventQueue {
- private IntBuffer delta_buffer = BufferUtils.createIntBuffer(2);
-
- private boolean skip_event;
- private static boolean is_grabbed;
-
- MacOSXMouseEventQueue(Component component) {
- super(component);
- }
-
- public void setGrabbed(boolean grab) {
- if (is_grabbed != grab) {
- super.setGrabbed(grab);
- warpCursor();
- grabMouse(grab);
- }
- }
-
- private static synchronized void grabMouse(boolean grab) {
- is_grabbed = grab;
- if (!grab)
- nGrabMouse(grab);
- }
-
- protected void resetCursorToCenter() {
- super.resetCursorToCenter();
- /* Clear accumulated deltas */
- getMouseDeltas(delta_buffer);
- }
-
- protected void updateDeltas(long nanos) {
- super.updateDeltas(nanos);
- synchronized ( this ) {
- getMouseDeltas(delta_buffer);
- int dx = delta_buffer.get(0);
- int dy = -delta_buffer.get(1);
- if (skip_event) {
- skip_event = false;
- nGrabMouse(isGrabbed());
- return;
- }
- if ( dx != 0 || dy != 0 ) {
- putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0, nanos);
- addDelta(dx, dy);
- }
- }
- }
-
- void warpCursor() {
- synchronized (this) {
- // If we're going to warp the cursor position, we'll skip the next event to avoid bogus delta values
- skip_event = isGrabbed();
- }
- }
-
- private static native void getMouseDeltas(IntBuffer delta_buffer);
-
- public static native void nWarpCursor(int x, int y);
-
- public static native void nGrabMouse(boolean grab);
-}
Modified: branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java
===================================================================
--- branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java 2012-11-11 19:03:50 UTC (rev 3825)
+++ branches/osx-java7/LWJGL/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java 2012-11-13 21:13:11 UTC (rev 3826)
@@ -92,6 +92,10 @@
nRegisterMouseListener(window_handle);
}
+ public synchronized void warpCursor(int x, int y) {
+ nWarpCursor(window_handle, x, y);
+ }
+
public synchronized void unregister() {
nUnregisterMouseListener(window_handle);
}
Deleted: branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.c
===================================================================
--- branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.c 2012-11-11 19:03:50 UTC (rev 3825)
+++ branches/osx-java7/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.c 2012-11-13 21:13:11 UTC (rev 3826)
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * $Id$
- *
- * Mac OS X mouse handling.
- *
- * @author elias_naur <eli...@us...>
- * @version $Revision$
- */
-
-#include <jni.h>
-#include <ApplicationServices/ApplicationServices.h>
-#include "org_lwjgl_opengl_MacOSXMouseEventQueue.h"
-#include "common_tools.h"
-
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nGrabMouse(JNIEnv *env, jclass unused, jboolean grab) {
- CGAssociateMouseAndMouseCursorPosition(grab == JNI_TRUE ? FALSE : TRUE);
- if (grab)
- CGDisplayHideCursor(kCGDirectMainDisplay);
- else
- CGDisplayShowCursor(kCGDirectMainDisplay);
-}
-
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nWarpCursor(JNIEnv *env, jclass unused, jint x, jint y) {
- CGPoint p;
- p.x = x;
- p.y = y;
- CGWarpMouseCursorPosition(p);
-}
-
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_getMouseDeltas(JNIEnv *env, jclass unused, jobject delta_buffer) {
- CGMouseDelta dx, dy;
- CGGetLastMouseDelta(&dx, &dy);
- int buffer_length = (*env)->GetDirectBufferCapacity(env, delta_buffer);
- if (buffer_length != 2) {
- printfDebugJava(env, "Delta buffer not large enough!");
- return;
- }
- jint *buffer = (*env)->GetDirectBufferAddress(env, delta_buffer);
- buffer[0] = dx;
- buffer[1] = dy;
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|