|
From: <eli...@us...> - 2006-06-26 13:52:08
|
Revision: 2386 Author: elias_naur Date: 2006-06-26 06:50:48 -0700 (Mon, 26 Jun 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2386&view=rev Log Message: ----------- Windows: LWJGL didn't work well with jinput, but compatibility could be greatly improved if LWJGL used DirectInput 8 (like jinput). This can't be done unconditionally, since we need the DX3 support for older versions of windows. So, I've moved most Mouse and Keyboard stuff from native to java side and generalized DirectInput access through an abstract base class, with two concrete subclasses, one for dx3 and one for dx8. Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/platform_build/win32_ms_cmdline/build.bat trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java trunk/LWJGL/src/native/common/common_tools.c trunk/LWJGL/src/native/common/common_tools.h trunk/LWJGL/src/native/win32/LWJGL.c trunk/LWJGL/src/native/win32/Window.h trunk/LWJGL/src/native/win32/org_lwjgl_opengl_Display.c Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput3.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput8.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice3.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice8.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDeviceObjectCallback.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsKeyboard.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsMouse.java trunk/LWJGL/src/native/win32/dinputhelper.c trunk/LWJGL/src/native/win32/dinputhelper.h trunk/LWJGL/src/native/win32/org_lwjgl_opengl_WindowsDirectInput3.c trunk/LWJGL/src/native/win32/org_lwjgl_opengl_WindowsDirectInput8.c trunk/LWJGL/src/native/win32/org_lwjgl_opengl_WindowsDirectInputDevice3.c trunk/LWJGL/src/native/win32/org_lwjgl_opengl_WindowsDirectInputDevice8.c trunk/LWJGL/src/native/win32/org_lwjgl_opengl_WindowsKeyboard.c Removed Paths: ------------- trunk/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.c trunk/LWJGL/src/native/win32/org_lwjgl_input_Mouse.c Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-06-23 16:45:21 UTC (rev 2385) +++ trunk/LWJGL/build.xml 2006-06-26 13:50:48 UTC (rev 2386) @@ -420,6 +420,11 @@ </javah> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/win32" force="yes"> + <class name="org.lwjgl.opengl.WindowsKeyboard" /> + <class name="org.lwjgl.opengl.WindowsDirectInput8" /> + <class name="org.lwjgl.opengl.WindowsDirectInputDevice8" /> + <class name="org.lwjgl.opengl.WindowsDirectInput3" /> + <class name="org.lwjgl.opengl.WindowsDirectInputDevice3" /> <class name="org.lwjgl.opengl.Win32PbufferPeerInfo" /> <class name="org.lwjgl.opengl.Win32Display" /> <class name="org.lwjgl.opengl.Win32Registry" /> Modified: trunk/LWJGL/platform_build/win32_ms_cmdline/build.bat =================================================================== --- trunk/LWJGL/platform_build/win32_ms_cmdline/build.bat 2006-06-23 16:45:21 UTC (rev 2385) +++ trunk/LWJGL/platform_build/win32_ms_cmdline/build.bat 2006-06-26 13:50:48 UTC (rev 2386) @@ -9,7 +9,7 @@ set COPTIONS=/Wp64 /I"%CHOME%\include" /I"%PLTSDKHOME%\include" /I"%DXSDK_DIR%\include" /I"%JAVA_HOME%\include" /I"%JAVA_HOME%\include\win32" /I"%ALHOME%\include" /I"..\..\src\native\common" /Ox /Ob2 /Oi /Ot /Oy /FD /EHsc /MT /Gy /W2 /nologo /c /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LWJGL_EXPORTS" /D "_WINDLL" set LINKEROPTS=/link /LIBPATH:"%JAVA_HOME%\lib" /LIBPATH:"%ALHOME%\libs" /LIBPATH:"%DXSDK_DIR%\Lib\x86" /LIBPATH:"%PLTSDKHOME%\Lib" /LIBPATH:"%CHOME%\Lib" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /MACHINE:X86 /NOLOGO /DLL /DELAYLOAD:jawt.dll -set LIBS=Kernel32.lib dinput.lib dxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib delayimp.lib winmm.lib +set LIBS=Kernel32.lib ole32.lib dinput.lib dxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib delayimp.lib winmm.lib for %%x in (..\..\src\native\win32\*.c) do cl %COPTIONS% %%x for %%x in (..\..\src\native\common\*.c) do cl %COPTIONS% %%x Modified: trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java 2006-06-23 16:45:21 UTC (rev 2385) +++ trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -71,6 +71,16 @@ } /** + * Construct a direct native-order charbuffer with the specified number + * of elements. + * @param size The size, in chars + * @return an CharBuffer + */ + public static CharBuffer createCharBuffer(int size) { + return createByteBuffer(size << 1).asCharBuffer(); + } + + /** * Construct a direct native-order intbuffer with the specified number * of elements. * @param size The size, in ints @@ -81,10 +91,10 @@ } /** - * Construct a direct native-order intbuffer with the specified number + * Construct a direct native-order longbuffer with the specified number * of elements. - * @param size The size, in ints - * @return an IntBuffer + * @param size The size, in longs + * @return an LongBuffer */ public static LongBuffer createLongBuffer(int size) { return createByteBuffer(size << 3).asLongBuffer(); Modified: trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-06-23 16:45:21 UTC (rev 2385) +++ trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -348,7 +348,7 @@ private static void read() { readBuffer.compact(); - int numEvents = Display.getImplementation().readKeyboard(readBuffer, readBuffer.position()); + int numEvents = Display.getImplementation().readKeyboard(readBuffer); readBuffer.position(readBuffer.position() + numEvents*EVENT_SIZE); readBuffer.flip(); } Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-06-23 16:45:21 UTC (rev 2385) +++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -306,7 +306,7 @@ private static void read() { readBuffer.compact(); - int numEvents = Display.getImplementation().readMouse(readBuffer, readBuffer.position()); + int numEvents = Display.getImplementation().readMouse(readBuffer); readBuffer.position(readBuffer.position() + numEvents * EVENT_SIZE); readBuffer.flip(); } Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java 2006-06-23 16:45:21 UTC (rev 2385) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -153,9 +153,8 @@ * * @return the total number of events read. */ - int readMouse(IntBuffer buffer, int buffer_position); + int readMouse(IntBuffer buffer); - void grabMouse(boolean grab); /** @@ -201,7 +200,7 @@ * Method to read the keyboard buffer * @return the total number of events read. */ - int readKeyboard(IntBuffer buffer, int buffer_position); + int readKeyboard(IntBuffer buffer); // int isStateKeySet(int key); Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java 2006-06-23 16:45:21 UTC (rev 2385) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/EventQueue.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -40,7 +40,7 @@ import java.nio.ByteBuffer; import java.nio.IntBuffer; -abstract class EventQueue { +class EventQueue { private static final int QUEUE_SIZE = 200; Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-06-23 16:45:21 UTC (rev 2385) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -513,10 +513,10 @@ } private static native void nPollMouse(IntBuffer coord_buffer, ByteBuffer buttons); - public int readMouse(IntBuffer buffer, int buffer_position) { + public int readMouse(IntBuffer buffer) { update(); lockAWT(); - int count = nReadMouse(buffer, buffer_position); + int count = nReadMouse(buffer, buffer.position()); unlockAWT(); return count; } @@ -616,10 +616,10 @@ } private static native void nPollKeyboard(ByteBuffer keyDownBuffer); - public int readKeyboard(IntBuffer buffer, int buffer_position) { + public int readKeyboard(IntBuffer buffer) { update(); lockAWT(); - int count = nReadKeyboard(buffer, buffer_position); + int count = nReadKeyboard(buffer, buffer.position()); unlockAWT(); return count; } Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2006-06-23 16:45:21 UTC (rev 2385) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -321,8 +321,7 @@ mouse_queue.poll(coord_buffer, buttons_buffer); } - public int readMouse(IntBuffer buffer, int buffer_position) { - assert buffer_position == buffer.position(); + public int readMouse(IntBuffer buffer) { return mouse_queue.copyEvents(buffer); } @@ -408,8 +407,7 @@ keyboard_queue.poll(keyDownBuffer); } - public int readKeyboard(IntBuffer buffer, int buffer_position) { - assert buffer_position == buffer.position(); + public int readKeyboard(IntBuffer buffer) { return keyboard_queue.copyEvents(buffer); } Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java 2006-06-23 16:45:21 UTC (rev 2385) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -48,9 +48,23 @@ final class Win32Display implements DisplayImplementation { private final static int GAMMA_LENGTH = 256; + private final static int WM_MOUSEMOVE = 0x0200; + private final static int WM_LBUTTONDOWN = 0x0201; + private final static int WM_LBUTTONUP = 0x0202; + private final static int WM_LBUTTONDBLCLK = 0x0203; + private final static int WM_RBUTTONDOWN = 0x0204; + private final static int WM_RBUTTONUP = 0x0205; + private final static int WM_RBUTTONDBLCLK = 0x0206; + private final static int WM_MBUTTONDOWN = 0x0207; + private final static int WM_MBUTTONUP = 0x0208; + private final static int WM_MBUTTONDBLCLK = 0x0209; + private final static int WM_MOUSEWHEEL = 0x020A; private static Win32DisplayPeerInfo peer_info; + private static WindowsKeyboard keyboard; + private static WindowsMouse mouse; + public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException { nCreateWindow(mode, fullscreen, x, y); peer_info.initDC(); @@ -126,47 +140,70 @@ public native DisplayMode[] getAvailableDisplayModes() throws LWJGLException; /* Mouse */ - public native boolean hasWheel(); - public native int getButtonCount(); - public native void createMouse() throws LWJGLException; - public native void destroyMouse(); + public boolean hasWheel() { + return mouse.hasWheel(); + } + + public int getButtonCount() { + return mouse.getButtonCount(); + } + + public void createMouse() throws LWJGLException { + mouse = new WindowsMouse(createDirectInput(), getHwnd()); + } + + public void destroyMouse() { + mouse.destroy(); + mouse = null; + } + public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) { update(); - nPollMouse(coord_buffer, buttons); + mouse.poll(coord_buffer, buttons); } - private native void nPollMouse(IntBuffer coord_buffer, ByteBuffer buttons); - public int readMouse(IntBuffer buffer, int buffer_position) { + public int readMouse(IntBuffer buffer) { update(); - return nReadMouse(buffer, buffer_position); + return mouse.read(buffer); } - private native int nReadMouse(IntBuffer buffer, int buffer_position); - public native void grabMouse(boolean grab); + public void grabMouse(boolean grab) { + mouse.grab(grab); + } + public int getNativeCursorCapabilities() { return Cursor.CURSOR_ONE_BIT_TRANSPARENCY; } public native void setCursorPosition(int x, int y); + public native void setNativeCursor(Object handle) throws LWJGLException; + public native int getMinCursorSize(); public native int getMaxCursorSize(); + private static native long getDllInstance(); + private static native long getHwnd(); + /* Keyboard */ - public native void createKeyboard() throws LWJGLException; - public native void destroyKeyboard(); + public void createKeyboard() throws LWJGLException { + keyboard = new WindowsKeyboard(createDirectInput(), getHwnd()); + } + + public void destroyKeyboard() { + keyboard.destroy(); + keyboard = null; + } public void pollKeyboard(ByteBuffer keyDownBuffer) { update(); - nPollKeyboard(keyDownBuffer); + keyboard.poll(keyDownBuffer); } - private native void nPollKeyboard(ByteBuffer keyDownBuffer); - public int readKeyboard(IntBuffer buffer, int buffer_position) { + public int readKeyboard(IntBuffer buffer) { update(); - return nReadKeyboard(buffer, buffer_position); + return keyboard.read(buffer); } - private native int nReadKeyboard(IntBuffer buffer, int buffer_position); // public native int isStateKeySet(int key); @@ -249,4 +286,64 @@ private static native int nSetWindowIcon16(IntBuffer icon); private static native int nSetWindowIcon32(IntBuffer icon); + + private static void handleMouseButton(int button, int state) { + if (mouse != null) + mouse.handleMouseButton(button, state); + } + + private static void handleMouseMoved(int x, int y) { + if (mouse != null) + mouse.handleMouseMoved(x, y); + } + + private static void handleMouseScrolled(int amount) { + if (mouse != null) + mouse.handleMouseScrolled(amount); + } + + private static native int transformY(long hwnd, int y); + + private static boolean handleMessage(long hwnd, int msg, long wParam, long lParam) { + switch (msg) { + case WM_MOUSEMOVE: + int xPos = (int)(short)(lParam & 0xFFFF); + int yPos = transformY(getHwnd(), (int)(short)((lParam >> 16) & 0xFFFF)); + handleMouseMoved(xPos, yPos); + return true; + case WM_MOUSEWHEEL: + int dwheel = (int)(short)((wParam >> 16) & 0xFFFF); + handleMouseScrolled(dwheel); + return true; + case WM_LBUTTONDOWN: + handleMouseButton(0, 1); + return true; + case WM_LBUTTONUP: + handleMouseButton(0, 0); + return true; + case WM_RBUTTONDOWN: + handleMouseButton(1, 1); + return true; + case WM_RBUTTONUP: + handleMouseButton(1, 0); + return true; + case WM_MBUTTONDOWN: + handleMouseButton(2, 1); + return true; + case WM_MBUTTONUP: + handleMouseButton(2, 0); + return true; + default: + return false; + } + } + + private static WindowsDirectInput createDirectInput() throws LWJGLException { + try { + return new WindowsDirectInput8(getDllInstance()); + } catch (LWJGLException e) { + LWJGLUtil.log("Failed to create DirectInput 8 interface, falling back to DirectInput 3"); + return new WindowsDirectInput3(getDllInstance()); + } + } } Added: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2002-2004 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 DirectInput base class + * @author elias_naur + */ + +import org.lwjgl.LWJGLException; + +abstract class WindowsDirectInput { + public final static int KEYBOARD_TYPE = 1; + public final static int MOUSE_TYPE = 2; + + /* DirectInput constants */ + public final static int DI_OK = 0x00000000; + public final static int DI_NOEFFECT = 0x00000001; + public final static int DI_PROPNOEFFECT = 0x00000001; + + public final static int DI_DOWNLOADSKIPPED = 0x00000003; + public final static int DI_EFFECTRESTARTED = 0x00000004; + public final static int DI_TRUNCATED = 0x00000008; + public final static int DI_SETTINGSNOTSAVED = 0x0000000B; + public final static int DI_TRUNCATEDANDRESTARTED = 0x0000000C; + + public final static int DI_BUFFEROVERFLOW = 0x00000001; + public final static int DIERR_INPUTLOST = 0x8007001E; + public final static int DIERR_NOTACQUIRED = 0x8007001C; + public final static int DIERR_OTHERAPPHASPRIO = 0x80070005; + + private final long di_interface; + + public WindowsDirectInput(long hinst) throws LWJGLException { + di_interface = createDirectInput(hinst); + } + protected abstract long createDirectInput(long hinst) throws LWJGLException; + + public WindowsDirectInputDevice createDevice(int type) throws LWJGLException { + return createDevice(di_interface, type); + } + protected abstract WindowsDirectInputDevice createDevice(long di_interface, int type) throws LWJGLException; + + public void release() { + release(di_interface); + } + protected abstract void release(long di_interface); +} Property changes on: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput.java ___________________________________________________________________ Name: svn:executable + * Added: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput3.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput3.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput3.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2002-2004 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 DirectInput3 interface + * @author elias_naur + */ + +import org.lwjgl.LWJGLException; + +final class WindowsDirectInput3 extends WindowsDirectInput { + /* Re-define device types to get them included in the native headers */ + public final static int KEYBOARD_TYPE = WindowsDirectInput.KEYBOARD_TYPE; + public final static int MOUSE_TYPE = WindowsDirectInput.MOUSE_TYPE; + + public WindowsDirectInput3(long hinst) throws LWJGLException { + super(hinst); + } + + protected native long createDirectInput(long hinst) throws LWJGLException; + + protected WindowsDirectInputDevice createDevice(long di_interface, int type) throws LWJGLException { + long device = nCreateDevice(di_interface, type); + return new WindowsDirectInputDevice3(device); + } + private static native long nCreateDevice(long di_interface, int type) throws LWJGLException; + + protected native void release(long di_interface); +} Property changes on: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput3.java ___________________________________________________________________ Name: svn:executable + * Added: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput8.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput8.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput8.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2002-2004 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 DirectInput8 interface + * @author elias_naur + */ + +import org.lwjgl.LWJGLException; + +final class WindowsDirectInput8 extends WindowsDirectInput { + /* Re-define device types to get them included in the native headers */ + public final static int KEYBOARD_TYPE = WindowsDirectInput.KEYBOARD_TYPE; + public final static int MOUSE_TYPE = WindowsDirectInput.MOUSE_TYPE; + + public WindowsDirectInput8(long hinst) throws LWJGLException { + super(hinst); + } + + protected native long createDirectInput(long hinst) throws LWJGLException; + + protected WindowsDirectInputDevice createDevice(long di_interface, int type) throws LWJGLException { + long device = nCreateDevice(di_interface, type); + return new WindowsDirectInputDevice8(device); + } + private static native long nCreateDevice(long di_interface, int type) throws LWJGLException; + + protected native void release(long di_interface); +} Property changes on: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput8.java ___________________________________________________________________ Name: svn:executable + * Added: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java 2006-06-26 13:50:48 UTC (rev 2386) @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2002-2004 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 DirectInputDevice interface + * @author elias_naur + */ + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import org.lwjgl.LWJGLException; +import org.lwjgl.BufferUtils; + +abstract class WindowsDirectInputDevice { + public final static int DISCL_EXCLUSIVE = 0x00000001; + public final static int DISCL_NONEXCLUSIVE = 0x00000002; + public final static int DISCL_FOREGROUND = 0x00000004; + public final static int DISCL_BACKGROUND = 0x00000008; + public final static int DISCL_NOWINKEY = 0x00000010; + + public final static int GUID_XAxis = 1; + public final static int GUID_YAxis = 2; + public final static int GUID_ZAxis = 3; + public final static int GUID_Button = 4; + public final static int GUID_Unknown = 5; + + private final long di_device; + private ByteBuffer event_buffer; + + public WindowsDirectInputDevice(long di_device) { + this.di_device = di_device; + } + + public void release() { + release(di_device); + } + protected abstract void release(long di_device); + + public int poll() { + return poll(di_device); + } + protected abstract int poll(long di_device); + + public void setDataFormat(int type) throws LWJGLException { + int ret = setDataFormat(di_device, type); + if (ret != WindowsDirectInput.DI_OK) + throw new LWJGLException("Failed to set data format (" + ret + ")"); + } + protected abstract int setDataFormat(long di_device, int type); + + public void setCooperateLevel(long hwnd, int flags) throws LWJGLException { + int ret = setCooperativeLevel(di_device, hwnd, flags); + if (ret != WindowsDirectInput.DI_OK) + throw new LWJGLException("Failed to set cooperative level (" + ret + ")"); + } + protected abstract int setCooperativeLevel(long di_device, long hwnd, int flags); + + public int acquire() { + return acquire(di_device); + } + protected abstract int acquire(long di_device); + + public void setBufferSize(int buffer_s... [truncated message content] |
|
From: <eli...@us...> - 2006-06-27 15:42:25
|
Revision: 2393 Author: elias_naur Date: 2006-06-27 08:41:53 -0700 (Tue, 27 Jun 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2393&view=rev Log Message: ----------- Added an applet test (lwjgl from applets doesn't work yet). Modified Paths: -------------- trunk/LWJGL/build.xml Added Paths: ----------- trunk/LWJGL/applet/ trunk/LWJGL/applet/applet.html trunk/LWJGL/applet/lwjglkeystore Added: trunk/LWJGL/applet/applet.html =================================================================== --- trunk/LWJGL/applet/applet.html (rev 0) +++ trunk/LWJGL/applet/applet.html 2006-06-27 15:41:53 UTC (rev 2393) @@ -0,0 +1,5 @@ +<html> +<body> +<applet code="org.lwjgl.test.applet.LWJGLApplet" archive="lwjgl_applet.jar,lwjgl.jar" width="640" height="480"></applet> +</body> +</html> Added: trunk/LWJGL/applet/lwjglkeystore =================================================================== (Binary files differ) Property changes on: trunk/LWJGL/applet/lwjglkeystore ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-06-27 12:57:04 UTC (rev 2392) +++ trunk/LWJGL/build.xml 2006-06-27 15:41:53 UTC (rev 2393) @@ -75,6 +75,12 @@ <include name="org/lwjgl/devil/**"/> </fileset> + <!-- Files to include in the lwjgl_applet.jar file --> + <fileset id="lwjgl_applet.fileset" dir="${lwjgl.bin}"> + <exclude name="**.*"/> + <include name="org/lwjgl/test/applet/**"/> + </fileset> + <!-- Files to make Javadoc from --> <fileset id="lwjgl.javadoc.fileset" dir="${lwjgl.src}"> <include name="**/*.java" /> @@ -334,8 +340,18 @@ <jar destfile="${lwjgl.temp}/jar/lwjgl_devil.jar" taskname="lwjgl_devil.jar"> <fileset refid="lwjgl_devil.fileset" /> </jar> + </target> + <target name="applet" depends="jars"> + <!-- Create lwjgl_applet.jar --> + <jar destfile="applet/lwjgl_applet.jar" taskname="lwjgl_applet.jar"> + <fileset refid="lwjgl_applet.fileset" /> + </jar> + <copy file="${lwjgl.lib}/lwjgl.jar" todir="applet"/> + <signjar jar="applet/lwjgl.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> + </target> + <!-- Distributes files --> <target name="-distribute"> <delete> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-03 11:30:49
|
Revision: 2420 Author: elias_naur Date: 2006-07-03 04:30:30 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2420&view=rev Log Message: ----------- Removed org.lwjgl.util.model Modified Paths: -------------- trunk/LWJGL/build.xml Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/util/applet/ trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java Removed Paths: ------------- trunk/LWJGL/res/model/ trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java trunk/LWJGL/src/java/org/lwjgl/util/model/ Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-03 10:28:32 UTC (rev 2419) +++ trunk/LWJGL/build.xml 2006-07-03 11:30:30 UTC (rev 2420) @@ -31,6 +31,17 @@ <exclude name="org/lwjgl/examples/**" /> </fileset> + <fileset id="lwjgl_util_applet.fileset" dir="${lwjgl.bin}"> + <exclude name="**.*"/> + <include name="org/lwjgl/util/applet/**"/> + </fileset> + + <fileset id="lwjgl_util_applet_natives.fileset" dir="${lwjgl.lib}"> + <include name="win32/**"/> + <include name="linux/**"/> + <include name="macosx/**"/> + </fileset> + <!-- Files to include in the lwjgl_test.jar file --> <fileset id="lwjgl_test.fileset" dir="${lwjgl.bin}"> <exclude name="**.*" /> @@ -53,16 +64,10 @@ <fileset id="lwjgl_util.fileset" dir="${lwjgl.bin}"> <exclude name="**.*" /> <exclude name="org/lwjgl/util/generator/**" /> - <exclude name="org/lwjgl/util/model/**" /> + <exclude name="org/lwjgl/util/applet/**" /> <include name="org/lwjgl/util/**" /> </fileset> - <!-- Files to include in the lwjgl_model.jar file --> - <fileset id="lwjgl_model.fileset" dir="${lwjgl.bin}"> - <exclude name="**.*" /> - <include name="org/lwjgl/util/model/**" /> - </fileset> - <!-- Files to include in the lwjgl_fmod3.jar file --> <fileset id="lwjgl_fmod3.fileset" dir="${lwjgl.bin}"> <exclude name="**.*" /> @@ -162,7 +167,6 @@ <include name="**" /> <exclude name="jar/lwjgl_fmod3.jar" /> <exclude name="jar/lwjgl_devil.jar" /> - <exclude name="jar/lwjgl_model.jar" /> <exclude name="native/win32/lwjgl-*.dll" /> <exclude name="native/win32/DevIL.dll" /> <exclude name="native/win32/ILU.dll" /> @@ -171,7 +175,6 @@ <exclude name="native/linux/liblwjgl-*.so" /> <exclude name="native/macosx/libIL*.dylib" /> <exclude name="native/macosx/liblwjgl-*.jnilib" /> - <exclude name="res/model/**" /> <exclude name="res/ILtest.*" /> <exclude name="res/Missing_you.mod" /> <exclude name="res/phero*.*" /> @@ -182,7 +185,6 @@ <patternset id="lwjgl_optional"> <include name="jar/lwjgl_fmod3.jar" /> <include name="jar/lwjgl_devil.jar" /> - <include name="jar/lwjgl_model.jar" /> <include name="native/win32/lwjgl-*.dll" /> <include name="native/win32/DevIL.dll" /> <include name="native/win32/ILU.dll" /> @@ -314,6 +316,12 @@ <jar destfile="${lwjgl.temp}/jar/lwjgl.jar" taskname="lwjgl.jar"> <fileset refid="lwjgl.fileset" /> </jar> + + <!-- Create lwjgl_util_applet.jar --> + <jar destfile="${lwjgl.temp}/jar/lwjgl_util_applet.jar" taskname="lwjgl_util_applet.jar"> + <fileset refid="lwjgl_util_applet.fileset" /> + <fileset refid="lwjgl_util_applet_natives.fileset"/> + </jar> <!-- Create lwjgl_test.jar --> <jar destfile="${lwjgl.temp}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar"> @@ -326,11 +334,6 @@ <fileset refid="lwjgl_util.fileset" /> </jar> - <!-- Create lwjgl_model.jar --> - <jar destfile="${lwjgl.temp}/jar/lwjgl_model.jar" taskname="lwjgl_model.jar"> - <fileset refid="lwjgl_model.fileset" /> - </jar> - <!-- Create lwjgl_fmod.jar --> <jar destfile="${lwjgl.temp}/jar/lwjgl_fmod3.jar" taskname="lwjgl_fmod3.jar"> <fileset refid="lwjgl_fmod3.fileset" /> @@ -348,18 +351,15 @@ <fileset refid="lwjgl_applet.fileset" /> </jar> <copy file="${lwjgl.lib}/lwjgl.jar" todir="applet"/> + <copy file="${lwjgl.lib}/lwjgl_util_applet.jar" todir="applet"/> <copy file="${lwjgl.lib}/lwjgl_util.jar" todir="applet"/> <copy file="${lwjgl.lib}/lwjgl_fmod3.jar" todir="applet"/> <copy file="${lwjgl.lib}/lwjgl_devil.jar" todir="applet"/> <zip destfile="applet/res.jar"> <zipfileset dir="${lwjgl.res}" includes="Footsteps.wav, ILtest.tga, Missing_you.mod"/> </zip> - <zip destfile="applet/lwjgl.jar" update="true"> - <zipfileset dir="${lwjgl.lib}" prefix="native" includes="win32/**"/> - <zipfileset dir="${lwjgl.lib}" prefix="native" includes="linux/**"/> - <zipfileset dir="${lwjgl.lib}" prefix="native" includes="macosx/**"/> - </zip> <signjar jar="applet/lwjgl.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> + <signjar jar="applet/lwjgl_util_applet.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> <signjar jar="applet/lwjgl_fmod3.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> <signjar jar="applet/lwjgl_devil.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> </target> @@ -438,6 +438,7 @@ <target name="headers" description="invokes javah on java classes" depends="compile"> <!-- platform specific classes --> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes"> + <class name="org.lwjgl.opengl.LinuxKeyboard" /> <class name="org.lwjgl.opengl.LinuxDisplay" /> <class name="org.lwjgl.opengl.LinuxPeerInfo" /> <class name="org.lwjgl.opengl.LinuxPbufferPeerInfo" /> Copied: trunk/LWJGL/src/java/org/lwjgl/util/applet (from rev 2415, trunk/LWJGL/src/java/org/lwjgl/applet) Deleted: trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/applet/LWJGLInstaller.java 2006-07-02 22:01:27 UTC (rev 2415) +++ trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java 2006-07-03 11:30:30 UTC (rev 2420) @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2006 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.applet; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileFilter; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.security.AccessController; -import java.security.PrivilegedAction; - -import org.lwjgl.LWJGLException; -import org.lwjgl.LWJGLUtil; - -/** - * <p> - * - * </p> - * @author Brian Matzon <br...@ma...> - * @version $Revision$ - * $Id$ - */ -public class LWJGLInstaller { - - /** - * Files to install for each supported platform - * @see org.lwjgl.LWJGLUtil#getPlatform() - */ - public static final String[][] PLATFORM_FILES = { - { "lwjgl", "lwjgl-fmod3", "lwjgl-devil", "openal", "fmod", "IL", "ILU", "ILUT", "jinput-osx"}, - { "lwjgl", "lwjgl-fmod3", "lwjgl-devil", "openal", "fmod", "IL", "ILU", "ILUT", "jinput-linux"}, - { "lwjgl", "lwjgl-fmod3", "lwjgl-devil", "OpenAL32", "fmod", "DevIL", "ILU", "ILUT", "jinput-dx8", "jinput-raw"} - }; - - /** Whether the installer has been called */ - public static boolean installed; - - /** Whether to hook uninstall rutine. Must be called prior to installation */ - public static boolean disableUninstall = false; - - /** Directory that was installed into */ - public static String installDirectory; - - /** Buffer used when copying files */ - private static final byte[] COPY_BUFFER = new byte[4096]; - - private LWJGLInstaller() { - /* Unused */ - } - - /** - * Create a temporary installation of LWJGL. - * This will extract the relevant native files (for the platform) into - * the users temp directory, and instruct the LWJGL subsystem to load its - * native files from there. - * The files required by the installer, are gotten from the classloader via its - * getResource command, and are assumed to in the path: /native/<win32|linux|macosx>/ - * Any call to this method will also add a shutdown hook to the uninstall of the libraries - * Note: Due to the nature of native libraries, we cannot actually uninstall the currently - * loaded files, but rather the "last" installed. This means that the most recent install of LWJGL - * will always be present in the users temp dir. - * - * @see java.lang.ClassLoader#getResource(String) - * @return true if the installation was successfull - */ - public static boolean tempInstall() throws LWJGLException { - // only need to install once - if (installed) { - return true; - } - - // libraries to validate and install - String[] libraries = PLATFORM_FILES[LWJGLUtil.getPlatform() - 1]; - - // Validate the certificates of the native files - validateCertificates(); - - // install shutdown installer hook - if(!disableUninstall) { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - LWJGLInstaller.uninstall(); - } - }); - return null; - } - }); - } - - // create a temporary dir for the native files - String user_temp_dir = getPriveledgedString("java.io.tmpdir"); - String path = createTemporaryDir(user_temp_dir); - if(path == null) { - throw new LWJGLException("Failed creation of temporary directory in " + user_temp_dir); - } - - // extract natives - for (int i = 0; i < libraries.length; i++) { - String library = System.mapLibraryName(libraries[i]); - if(!extract(library, path)) { - LWJGLUtil.log("Failed extract of " + library + " to " + path); - uninstall(); - return false; - } - } - - installDirectory = path; - return installed = true; - } - - /** - * Validates the certificates of the native libraries. - * When installing native libraries, it is imperative that we also check the certficates. - * The reson for this, is that a user may inject a malicious jar to the classpath - * before the "real" LWJGL jar, containing native libraries with unwanted code. - * By forcing all the native libraries to have the same certificate as the signed - * installer, we can also be sure that the native libraries indeed are correct. - * @throws LWJGLException If we encounter a certificate mismatch - */ - private static void validateCertificates() throws LWJGLException { - /* TODO */ - } - - /** - * Extracts a file in the classpath to a specified dir - * - * @param file File to extract - * @param path Path to extract to - * @return true if the file was extracted successdully - */ - private static boolean extract(final String file, final String path) throws LWJGLException { - return (Boolean) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - // check for existing file, and get out - File out = new File(path + File.separator + file); - if (out.exists()) { - return false; - } - - // create the new file and copy it to its destination - try { - out.createNewFile(); - String in = "/native/" + LWJGLUtil.getPlatformName() + "/" + file; - OutputStream os = new BufferedOutputStream(new FileOutputStream(out)); - InputStream is = new BufferedInputStream(getClass().getResourceAsStream(in)); - - // Sanity check - // =========================================== - if (os == null) { - LWJGLUtil.log("Unable to write to outputstream at " + out.getAbsolutePath()); - return false; - } - - if (is == null) { - LWJGLUtil.log("Unable to read classpath inputstream from " + in); - return false; - } - // ------------------------------------------- - - // copy the actual file - copyFile(is, os); - } catch (IOException ioe) { - LWJGLUtil.log("Exception while extracting " + file + ": " + ioe.getMessage()); - return false; - } - return true; - } - }); - } - - /** - * Copies an inputstream to an outputstream - * @param is InputStream to read from - * @param os OutputStream to write to - * @throws IOException if the copy process fail in any way - */ - static void copyFile(InputStream is, OutputStream os) throws IOException { - int len; - while ((len = is.read(COPY_BUFFER)) > 0) { - os.write(COPY_BUFFER, 0, len); - } - is.close(); - os.close(); - } - - /** - * Creates the temporary dir to store lwjgl files in. - * The temporary dir will be created in the users temp dir and - * called 'lwjgl-' and appended System.currentTimeMillis(). A watermark file - * called '.lwjglinstaller' will also be created in the directory. - * @return Name of temp directory or null if directory creation failed - */ - static String createTemporaryDir(final String user_temp_dir) { - return (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - // create the temp directory - File tempDir = new File(user_temp_dir + File.separator + "lwjgl-" + System.currentTimeMillis()); - if(!tempDir.mkdir()) { - return null; - } - - // add the watermark file - // TODO: Write some info to the file ? - try { - File watermark = new File(tempDir.getAbsolutePath() + File.separator + ".lwjglinstaller"); - watermark.createNewFile(); - } catch (IOException ioe) { - return null; - } - return tempDir.getAbsolutePath(); - } - }); - } - - - /** - * Gets a property as a privileged action. - */ - private static String getPriveledgedString(final String property) { - return (String) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - return System.getProperty(property); - } - }); - } - - /** - * Uninstalls any PREVIOUS installations - * We cannot uninstall the current installation, since the files are locked - * by the VM. - */ - private static void uninstall() { - LWJGLUtil.log("running LWJGL uninstaller"); - - // locate all installer dirs and uninstall them - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String temp = System.getProperty("java.io.tmpdir"); - File tempDir = new File(temp); - File[] files = tempDir.listFiles(new FileFilter() { - - /* - * @see java.io.FileFilter#accept(java.io.File) - */ - public boolean accept(File pathname) { - return pathname.getAbsolutePath().indexOf("lwjgl") != -1 && isInstallDirectory(pathname); - } - - /** - * Checks whether the specified directory is an install directory. - * This is done by checking for the watermark file - * @param directory Directory to check - * @return true if the directory is an install directory - */ - private boolean isInstallDirectory(File directory) { - File installFile = new File(directory.getAbsolutePath() + File.separator + ".lwjglinstaller"); - return installFile.exists(); - } - - }); - - // uninstall each of the dirs - for (int i = 0; i < files.length; i++) { - uninstall(files[i]); - } - return null; - } - }); - } - - /** - * Uninstall LWJGL from a directory. This deletes all the files in the directory - * and deletes the directory too. - * @param file directory to uninstall LWJGL from - */ - private static void uninstall(File file) { - File[] files = file.listFiles(); - for (int i = 0; i < files.length; i++) { - files[i].delete(); - } - file.delete(); - } -} \ No newline at end of file Copied: trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java (from rev 2419, trunk/LWJGL/src/java/org/lwjgl/applet/LWJGLInstaller.java) =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java 2006-07-03 11:30:30 UTC (rev 2420) @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2006 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.util.applet; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileFilter; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; + +import org.lwjgl.LWJGLUtil; + +/** + * <p> + * + * </p> + * @author Brian Matzon <br...@ma...> + * @version $Revision$ + * $Id$ + */ +public class LWJGLInstaller { + + /** + * Files to install for each supported platform + * @see org.lwjgl.LWJGLUtil#getPlatform() + */ + public static final String[][] PLATFORM_FILES = { + { "lwjgl", "lwjgl-fmod3", "lwjgl-devil", "openal", "fmod", "IL", "ILU", "ILUT", "jinput-osx"}, + { "lwjgl", "lwjgl-fmod3", "lwjgl-devil", "openal", "fmod", "IL", "ILU", "ILUT", "jinput-linux"}, + { "lwjgl", "lwjgl-fmod3", "lwjgl-devil", "OpenAL32", "fmod", "DevIL", "ILU", "ILUT", "jinput-dx8", "jinput-raw"} + }; + + /** Whether the installer has been called */ + public static boolean installed; + + /** Whether to hook uninstall rutine. Must be called prior to installation */ + public static boolean disableUninstall = false; + + /** Buffer used when copying files */ + private static final byte[] COPY_BUFFER = new byte[4096]; + + private LWJGLInstaller() { + /* Unused */ + } + + /** + * Create a temporary installation of LWJGL. + * This will extract the relevant native files (for the platform) into + * the users temp directory, and instruct the LWJGL subsystem to load its + * native files from there. + * The files required by the installer, are gotten from the classloader via its + * getResource command, and are assumed to in the path: /native/<win32|linux|macosx>/ + * Any call to this method will also add a shutdown hook to the uninstall of the libraries + * Note: Due to the nature of native libraries, we cannot actually uninstall the currently + * loaded files, but rather the "last" installed. This means that the most recent install of LWJGL + * will always be present in the users temp dir. + * + * @see java.lang.ClassLoader#getResource(String) + */ + public static void tempInstall() throws Exception { + // only need to install once + if (installed) { + return; + } + + try { + // libraries to validate and install + String[] libraries = PLATFORM_FILES[LWJGLUtil.getPlatform() - 1]; + + // Validate the certificates of the native files + validateCertificates(); + + // install shutdown installer hook + if(!disableUninstall) { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + uninstall(); + } + }); + return null; + } + }); + } + + // create a temporary dir for the native files + String user_temp_dir = getPriviledgedString("java.io.tmpdir"); + final String path = createTemporaryDir(user_temp_dir); + + // extract natives + for (int i = 0; i < libraries.length; i++) { + String library = System.mapLibraryName(libraries[i]); + extract(library, path); + } + + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + System.setProperty("org.lwjgl.librarypath", path); + return null; + } + }); + } catch (Exception e) { + LWJGLUtil.log("Failed extraction e = " + e.getMessage()); + uninstall(); + throw e; + } + } + + /** + * Validates the certificates of the native libraries. + * When installing native libraries, it is imperative that we also check the certficates. + * The reson for this, is that a user may inject a malicious jar to the classpath + * before the "real" LWJGL jar, containing native libraries with unwanted code. + * By forcing all the native libraries to have the same certificate as the signed + * installer, we can also be sure that the native libraries indeed are correct. + * @throws Exception If we encounter a certificate mismatch + */ + private static void validateCertificates() throws Exception { + /* TODO */ + } + + /** + * Extracts a file in the classpath to a specified dir + * + * @param file File to extract + * @param path Path to extract to + */ + private static void extract(final String file, final String path) { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + // check for existing file, and get out + File out = new File(path + File.separator + file); + if (out.exists()) { + return null; + } + + // create the new file and copy it to its destination + try { + out.createNewFile(); + String in = "/native/" + LWJGLUtil.getPlatformName() + "/" + file; + OutputStream os = new BufferedOutputStream(new FileOutputStream(out)); + InputStream is = new BufferedInputStream(getClass().getResourceAsStream(in)); + + // Sanity check + // =========================================== + if (os == null) { + LWJGLUtil.log("Unable to write to outputstream at " + out.getAbsolutePath()); + return null; + } + + if (is == null) { + LWJGLUtil.log("Unable to read classpath inputstream from " + in); + return null; + } + // ------------------------------------------- + + // copy the actual file + copyFile(is, os); + } catch (IOException ioe) { + LWJGLUtil.log("Exception while extracting " + file + ": " + ioe.getMessage()); + return null; + } + return null; + } + }); + } + + /** + * Copies an inputstream to an outputstream + * @param is InputStream to read from + * @param os OutputStream to write to + * @throws IOException if the copy process fail in any way + */ + static void copyFile(InputStream is, OutputStream os) throws IOException { + int len; + while ((len = is.read(COPY_BUFFER)) > 0) { + os.write(COPY_BUFFER, 0, len); + } + is.close(); + os.close(); + } + + /** + * Creates the temporary dir to store lwjgl files in. + * The temporary dir will be created in the users temp dir and + * called 'lwjgl-' and appended System.currentTimeMillis(). A watermark file + * called '.lwjglinstaller' will also be created in the directory. + * @return Name of temp directory or null if directory creation failed + */ + static String createTemporaryDir(final String user_temp_dir) throws Exception { + return (String) AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + // create the temp directory + File tempDir = new File(user_temp_dir + File.separator + "lwjgl-" + System.currentTimeMillis()); + if(!tempDir.mkdir()) { + throw new IOException("Failed to create directory: " + tempDir); + } + + // add the watermark file + // TODO: Write some info to the file ? + File watermark = new File(tempDir.getAbsolutePath() + File.separator + ".lwjglinstaller"); + watermark.createNewFile(); + return tempDir.getAbsolutePath(); + } + }); + } + + + /** + * Gets a property as a privileged action. + */ + private static String getPriviledgedString(final String property) { + return (String) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty(property); + } + }); + } + + /** + * Uninstalls any PREVIOUS installations + * We cannot uninstall the current installation, since the files are locked + * by the VM. + */ + private static void uninstall() { + LWJGLUtil.log("running LWJGL uninstaller"); + + // locate all installer dirs and uninstall them + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String temp = System.getProperty("java.io.tmpdir"); + File tempDir = new File(temp); + File[] files = tempDir.listFiles(new FileFilter() { + + /* + * @see java.io.FileFilter#accept(java.io.File) + */ + public boolean accept(File pathname) { + return pathname.getAbsolutePath().indexOf("lwjgl") != -1 && isInstallDirectory(pathname); + } + + /** + * Checks whether the specified directory is an install directory. + * This is done by checking for the watermark file + * @param directory Directory to check + * @return true if the directory is an install directory + */ + private boolean isInstallDirectory(File directory) { + File installFile = new File(directory.getAbsolutePath() + File.separator + ".lwjglinstaller"); + return installFile.exists(); + } + + }); + + // uninstall each of the dirs + for (int i = 0; i < files.length; i++) { + uninstall(files[i]); + } + return null; + } + }); + } + + /** + * Uninstall LWJGL from a directory. This deletes all the files in the directory + * and deletes the directory too. + * @param file directory to uninstall LWJGL from + */ + private static void uninstall(File file) { + File[] files = file.listFiles(); + for (int i = 0; i < files.length; i++) { + files[i].delete(); + } + file.delete(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-03 18:08:54
|
Revision: 2425 Author: elias_naur Date: 2006-07-03 11:07:44 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2425&view=rev Log Message: ----------- Linux: Moved most input related stuff from native to java Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java trunk/LWJGL/src/native/common/common_tools.c trunk/LWJGL/src/native/common/common_tools.h trunk/LWJGL/src/native/linux/Window.h trunk/LWJGL/src/native/linux/display.c trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c trunk/LWJGL/src/native/win32/dinputhelper.c trunk/LWJGL/src/native/win32/dinputhelper.h Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeycodes.java trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxMouse.java trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.c trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxMouse.c Removed Paths: ------------- trunk/LWJGL/src/native/linux/org_lwjgl_input_Keyboard.c trunk/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-03 12:00:12 UTC (rev 2424) +++ trunk/LWJGL/build.xml 2006-07-03 18:07:44 UTC (rev 2425) @@ -450,6 +450,7 @@ <target name="headers" description="invokes javah on java classes" depends="compile"> <!-- platform specific classes --> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes"> + <class name="org.lwjgl.opengl.LinuxMouse" /> <class name="org.lwjgl.opengl.LinuxKeyboard" /> <class name="org.lwjgl.opengl.LinuxDisplay" /> <class name="org.lwjgl.opengl.LinuxPeerInfo" /> Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-07-03 12:00:12 UTC (rev 2424) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-07-03 18:07:44 UTC (rev 2425) @@ -47,6 +47,13 @@ import org.lwjgl.input.Keyboard; final class LinuxDisplay implements DisplayImplementation { + /* X11 constants */ + private final static int GrabSuccess = 0; + private final static int AutoRepeatModeOff = 0; + private final static int AutoRepeatModeOn = 1; + private final static int AutoRepeatModeDefault = 2; + + /** Window mode enum */ private static final int FULLSCREEN_LEGACY = 1; private static final int FULLSCREEN_NETWM = 2; @@ -63,8 +70,6 @@ /** Current mode swithcing API */ private static int current_displaymode_extension = NONE; - private static final int NUM_BUTTONS = 3; - /** Keep track on the current awt lock owner to avoid * depending on JAWT locking to be re-entrant (This is a * problem with GCJ). JAWT locking is not that well specified @@ -86,6 +91,17 @@ private static DisplayMode saved_mode; private static DisplayMode current_mode; + private static boolean keyboard_grabbed; + private static boolean pointer_grabbed; + private static boolean input_released; + private static boolean grab; + private static boolean focused; + private static ByteBuffer current_cursor; + private static ByteBuffer blank_cursor; + + private static LinuxKeyboard keyboard; + private static LinuxMouse mouse; + private static ByteBuffer getCurrentGammaRamp() throws LWJGLException { lockAWT(); try { @@ -257,15 +273,113 @@ return WINDOWED; } + private static native long getDisplay(); + private static native int getScreen(); + private static native long getWindow(); + + private static void ungrabKeyboard() { + if (keyboard_grabbed) { + nUngrabKeyboard(getDisplay()); + keyboard_grabbed = false; + } + } + private static native int nUngrabKeyboard(long display); + + private static void grabKeyboard() { + if (!keyboard_grabbed) { + int res = nGrabKeyboard(getDisplay(), getWindow()); + if (res == GrabSuccess) + keyboard_grabbed = true; + } + } + private static native int nGrabKeyboard(long display, long window); + + private static void grabPointer() { + if (!pointer_grabbed) { + int result = nGrabPointer(getDisplay(), getWindow()); + if (result == GrabSuccess) { + pointer_grabbed = true; + // make sure we have a centered window + if (isLegacyFullscreen()) { + nSetViewPort(getDisplay(), getWindow(), getScreen()); + } + } + } + } + private static native int nGrabPointer(long display, long window); + private static native void nSetViewPort(long display, long window, int screen); + + private static void ungrabPointer() { + if (pointer_grabbed) { + pointer_grabbed = false; + nUngrabPointer(getDisplay()); + } + } + private static native int nUngrabPointer(long display); + + private static boolean isFullscreen() { + return current_window_mode == FULLSCREEN_LEGACY || current_window_mode == FULLSCREEN_NETWM; + } + + private static boolean shouldGrab() { + return !input_released && grab; + } + + private static void updatePointerGrab() { + if (isFullscreen() || shouldGrab()) { + grabPointer(); + } else { + ungrabPointer(); + } + updateCursor(); + } + + private static void updateCursor() { + ByteBuffer cursor; + if (shouldGrab()) { + cursor = blank_cursor; + } else { + cursor = current_cursor; + } + nDefineCursor(getDisplay(), getWindow(), cursor); + } + private static native void nDefineCursor(long display, long window, ByteBuffer cursor_handle); + + private static boolean isLegacyFullscreen() { + return current_window_mode == FULLSCREEN_LEGACY; + } + + private static void updateKeyboardGrab() { + if (isLegacyFullscreen()) + grabKeyboard(); + else + ungrabKeyboard(); + } + public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException { lockAWT(); try { - ByteBuffer handle = peer_info.lockAndGetHandle(); + incDisplay(); try { - current_window_mode = getWindowMode(fullscreen); - nCreateWindow(handle, mode, current_window_mode, x, y); - } finally { - peer_info.unlock(); + ByteBuffer handle = peer_info.lockAndGetHandle(); + try { + current_window_mode = getWindowMode(fullscreen); + nCreateWindow(handle, mode, current_window_mode, x, y); + blank_cursor = createBlankCursor(); + current_cursor = null; + focused = true; + input_released = false; + pointer_grabbed = false; + keyboard_grabbed = false; + grab = false; + updateInputGrab(); + nSetRepeatMode(getDisplay(), AutoRepeatModeOff); + } finally { + peer_info.unlock(); + } + } catch (LWJGLException e) { + decDisplay(); + throw e; } } finally { unlockAWT(); @@ -273,23 +387,41 @@ } private static native void nCreateWindow(ByteBuffer peer_info_handle, DisplayMode mode, int window_mode, int x, int y) throws LWJGLException; + private static void updateInputGrab() { + updatePointerGrab(); + updateKeyboardGrab(); + } + public void destroyWindow() { lockAWT(); - nDestroyWindow(); - unlockAWT(); + try { + try { + setNativeCursor(null); + } catch (LWJGLException e) { + LWJGLUtil.log("Failed to reset cursor: " + e.getMessage()); + } + nDestroyCursor(blank_cursor); + blank_cursor = null; + ungrabKeyboard(); + nDestroyWindow(); + nSetRepeatMode(getDisplay(), AutoRepeatModeDefault); + decDisplay(); + } finally { + unlockAWT(); + } } private static native void nDestroyWindow(); public void switchDisplayMode(DisplayMode mode) throws LWJGLException { lockAWT(); try { - nSwitchDisplayMode(current_displaymode_extension, mode); + nSwitchDisplayMode(getScreen(), current_displaymode_extension, mode); current_mode = mode; } finally { unlockAWT(); } } - private static native void nSwitchDisplayMode(int extension, DisplayMode mode) throws LWJGLException; + private static native void nSwitchDisplayMode(int screen, int extension, DisplayMode mode) throws LWJGLException; public void resetDisplayMode() { lockAWT(); @@ -312,7 +444,7 @@ try { incDisplay(); try { - return nGetGammaRampLength(); + return nGetGammaRampLength(getDisplay(), getScreen()); } catch (LWJGLException e) { LWJGLUtil.log("Got exception while querying gamma length: " + e); return 0; @@ -327,7 +459,7 @@ unlockAWT(); } } - private static native int nGetGammaRampLength() throws LWJGLException; + private static native int nGetGammaRampLength(long display, int screen) throws LWJGLException; public void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException { if (!isXF86VidModeSupported()) @@ -338,13 +470,13 @@ private static void doSetGamma(ByteBuffer native_gamma) throws LWJGLException { lockAWT(); try { - nSetGammaRamp(native_gamma); + nSetGammaRamp(getScreen(), native_gamma); current_gamma = native_gamma; } finally { unlockAWT(); } } - private static native void nSetGammaRamp(ByteBuffer gammaRamp) throws LWJGLException; + private static native void nSetGammaRamp(int screen, ByteBuffer gammaRamp) throws LWJGLException; private static ByteBuffer convertToNativeRamp(FloatBuffer ramp) throws LWJGLException { return nConvertToNativeRamp(ramp, ramp.position(), ramp.remaining()); @@ -406,34 +538,42 @@ public void setTitle(String title) { lockAWT(); - nSetTitle(title); - unlockAWT(); + try { + nSetTitle(title); + } finally { + unlockAWT(); + } } private static native void nSetTitle(String title); public boolean isCloseRequested() { lockAWT(); - boolean result = nIsCloseRequested(); - unlockAWT(); - return result; + try { + return nIsCloseRequested(); + } finally { + unlockAWT(); + } } private static native boolean nIsCloseRequested(); public boolean isVisible() { lockAWT(); - boolean result = nIsVisible(); - unlockAWT(); - return result; + try { + return nIsVisible(); + } finally { + unlockAWT(); + } } private static native boolean nIsVisible(); public boolean isActive() { lockAWT(); - boolean result = nIsActive(current_window_mode); - unlockAWT(); - return result; + try { + return focused || isLegacyFullscreen(); + } finally { + unlockAWT(); + } } - private static native boolean nIsActive(int window_mode); public boolean isDirty() { lockAWT(); @@ -452,17 +592,22 @@ lockAWT(); try { nUpdate(current_displaymode_extension, current_window_mode, saved_gamma, current_gamma, saved_mode, current_mode); + checkInput(); } catch (LWJGLException e) { LWJGLUtil.log("Caught exception while processing messages: " + e); + } finally { + unlockAWT(); } - unlockAWT(); } private static native void nUpdate(int extension, int current_window_mode, ByteBuffer saved_gamma, ByteBuffer current_gamma, DisplayMode saved_mode, DisplayMode current_mode) throws LWJGLException; public void reshape(int x, int y, int width, int height) { lockAWT(); - nReshape(x, y, width, height); - unlockAWT(); + try { + nReshape(x, y, width, height); + } finally { + unlockAWT(); + } } private static native void nReshape(int x, int y, int width, int height); @@ -488,61 +633,118 @@ } public int getButtonCount() { - return NUM_BUTTONS; + return mouse.getButtonCount(); } public void createMouse() { lockAWT(); - nCreateMouse(current_window_mode); - unlockAWT(); + try { + mouse = new LinuxMouse(getDisplay(), getWindow()); + } finally { + unlockAWT(); + } } - private static native void nCreateMouse(int window_mode); public void destroyMouse() { - lockAWT(); - nDestroyMouse(); - unlockAWT(); + mouse = null; } - private static native void nDestroyMouse(); public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) { update(); lockAWT(); - nPollMouse(coord_buffer, buttons); - unlockAWT(); + try { + mouse.poll(grab, coord_buffer, buttons); + } finally { + unlockAWT(); + } } - private static native void nPollMouse(IntBuffer coord_buffer, ByteBuffer buttons); public int readMouse(IntBuffer buffer) { update(); lockAWT(); - int count = nReadMouse(buffer, buffer.position()); - unlockAWT(); - return count; + try { + return mouse.read(buffer); + } finally { + unlockAWT(); + } } - private static native int nReadMouse(IntBuffer buffer, int buffer_position); public void setCursorPosition(int x, int y) { lockAWT(); - nSetCursorPosition(x, y); - unlockAWT(); + try { + mouse.setCursorPosition(x, y); + } finally { + unlockAWT(); + } } - private native void nSetCursorPosition(int x, int y); - public void grabMouse(boolean grab) { + private static void checkInput() { + focused = nGetInputFocus(getDisplay()) == getWindow(); + if (focused) { + acquireInput(); + } else { + releaseInput(); + } + } + private static native long nGetInputFocus(long display); + + private static void releaseInput() { + if (isLegacyFullscreen() || input_released) + return; + input_released = true; + nSetRepeatMode(getDisplay(), AutoRepeatModeDefault); + updateInputGrab(); + if (current_window_mode == FULLSCREEN_NETWM) { + nIconifyWindow(getDisplay(), getWindow(), getScreen()); + try { + nSwitchDisplayMode(getScreen(), current_displaymode_extension, saved_mode); + nSetGammaRamp(getScreen(), saved_gamma); + } catch (LWJGLException e) { + LWJGLUtil.log("Failed to restore saved mode: " + e.getMessage()); + } + } + } + private static native void nIconifyWindow(long display, long window, int screen); + + private static void acquireInput() { + if (isLegacyFullscreen() || !input_released) + return; + input_released = false; + nSetRepeatMode(getDisplay(), AutoRepeatModeOff); + updateInputGrab(); + if (current_window_mode == FULLSCREEN_NETWM) { + try { + nSwitchDisplayMode(getScreen(), current_displaymode_extension, current_mode); + nSetGammaRamp(getScreen(), current_gamma); + } catch (LWJGLException e) { + LWJGLUtil.log("Failed to restore mode: " + e.getMessage()); + } + } + } + private static native void nSetRepeatMode(long display, int mode); + + public void grabMouse(boolean new_grab) { lockAWT(); - nGrabMouse(current_window_mode, grab); - unlockAWT(); + try { + if (new_grab != grab) { + grab = new_grab; + updateInputGrab(); + mouse.changeGrabbed(grab, pointer_grabbed, shouldGrab()); + } + } finally { + unlockAWT(); + } } - private static native void nGrabMouse(int window_mode, boolean grab); public int getNativeCursorCapabilities() { lockAWT(); try { incDisplay(); - int caps = nGetNativeCursorCapabilities(); - decDisplay(); - return caps; + try { + return nGetNativeCursorCapabilities(); + } finally { + decDisplay(); + } } catch (LWJGLException e) { throw new RuntimeException(e); } finally { @@ -552,19 +754,24 @@ private static native int nGetNativeCursorCapabilities() throws LWJGLException; public void setNativeCursor(Object handle) throws LWJGLException { + current_cursor = (ByteBuffer)handle; lockAWT(); - nSetNativeCursor(handle); - unlockAWT(); + try { + updateCursor(); + } finally { + unlockAWT(); + } } - private static native void nSetNativeCursor(Object handle) throws LWJGLException; public int getMinCursorSize() { lockAWT(); try { incDisplay(); - int min_size = nGetMinCursorSize(); - decDisplay(); - return min_size; + try { + return nGetMinCursorSize(); + } finally { + decDisplay(); + } } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred in getMinCursorSize: " + e); return 0; @@ -578,9 +785,11 @@ lockAWT(); try { incDisplay(); - int max_size = nGetMaxCursorSize(); - decDisplay(); - return max_size; + try { + return nGetMaxCursorSize(); + } finally { + decDisplay(); + } } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred in getMaxCursorSize: " + e); return 0; @@ -594,36 +803,41 @@ public void createKeyboard() throws LWJGLException { lockAWT(); try { - nCreateKeyboard(current_window_mode); + keyboard = new LinuxKeyboard(getDisplay(), getWindow()); } finally { unlockAWT(); } } - private static native void nCreateKeyboard(int window_mode) throws LWJGLException; public void destroyKeyboard() { lockAWT(); - nDestroyKeyboard(); - unlockAWT(); + try { + keyboard.destroy(); + keyboard = null; + } finally { + unlockAWT(); + } } - private static native void nDestroyKeyboard(); public void pollKeyboard(ByteBuffer keyDownBuffer) { update(); lockAWT(); - nPollKeyboard(keyDownBuffer); - unlockAWT(); + try { + keyboard.poll(keyDownBuffer); + } finally { + unlockAWT(); + } } - private static native void nPollKeyboard(ByteBuffer keyDownBuffer); public int readKeyboard(IntBuffer buffer) { update(); lockAWT(); - int count = nReadKeyboard(buffer, buffer.position()); - unlockAWT(); - return count; + try { + return keyboard.read(buffer); + } finally { + unlockAWT(); + } } - private static native int nReadKeyboard(IntBuffer buffer, int buffer_position); /* public int isStateKeySet(int key) { return Keyboard.STATE_UNKNOWN; @@ -631,6 +845,11 @@ */ private static native ByteBuffer nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException; + private static ByteBuffer createBlankCursor() { + return nCreateBlankCursor(getDisplay(), getWindow()); + } + private static native ByteBuffer nCreateBlankCursor(long display, long window); + public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { lockAWT(); try { @@ -648,9 +867,12 @@ public void destroyCursor(Object cursorHandle) { lockAWT(); - nDestroyCursor(cursorHandle); - decDisplay(); - unlockAWT(); + try { + nDestroyCursor(cursorHandle); + decDisplay(); + } finally { + unlockAWT(); + } } private static native void nDestroyCursor(Object cursorHandle); @@ -658,9 +880,11 @@ lockAWT(); try { incDisplay(); - int caps = nGetPbufferCapabilities(); - decDisplay(); - return caps; + try { + return nGetPbufferCapabilities(); + } finally { + decDisplay(); + } } catch (LWJGLException e) { LWJGLUtil.log("Exception occurred in getPbufferCapabilities: " + e); return 0; @@ -753,4 +977,25 @@ } private static native void nSetWindowIcon(ByteBuffer icon, int icons_size, int width, int height); + + /* Callbacks from nUpdate() */ + private static void handleButtonEvent(long millis, int type, int button, int state) { + if (mouse != null) + mouse.handleButtonEvent(grab, type, button); + } + + private static void handleKeyEvent(long event_ptr, long millis, int type, int keycode, int state) { + if (keyboard != null) + keyboard.handleKeyEvent(event_ptr, millis, type, keycode, state); + } + + private static void handlePointerMotionEvent(long root_window, int x_root, int y_root, int x, int y, int state) { + if (mouse != null) + mouse.handlePointerMotion(grab, pointer_grabbed, shouldGrab(), root_window, x_root, y_root, x, y); + } + + private static void handleWarpEvent(int x, int y) { + if (mouse != null) + mouse.handleWarpEvent(x, y); + } } Copied: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java (from rev 2397, trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java) =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxKeyboard.java 2006-07-03 18:07:44 UTC (rev 2425) @@ -0,0 +1,305 @@ +/* + * Copyright (c) 2002-2004 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; + +/** + * @author elias_naur + */ + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.nio.CharBuffer; + +import org.lwjgl.BufferUtils; +import org.lwjgl.input.Keyboard; + +import java.nio.charset.CharsetDecoder; +import java.nio.charset.Charset; + +final class LinuxKeyboard { + private static final int LockMapIndex = 1; + private static final int KeyPress = 2; + private static final int KeyRelease = 3; + private static final long NoSymbol = 0; + private static final long ShiftMask = 1 << 0; + private static final long LockMask = 1 << 1; + private static final int XLookupChars = 2; + private static final int XLookupBoth = 4; + + + private static final int EVENT_SIZE = 3; + private static final int KEYBOARD_BUFFER_SIZE = 50; + + private final long xim; + private final long xic; + + private final int numlock_mask; + private final int modeswitch_mask; + private final int caps_lock_mask; + private final int shift_lock_mask; + + private final ByteBuffer compose_status; + + private final byte[] key_down_buffer = new byte[Keyboard.KEYBOARD_SIZE]; + private final EventQueue event_queue = new EventQueue(EVENT_SIZE); + + private final int[] tmp_event = new int[3]; + private final int[] temp_translation_buffer = new int[KEYBOARD_BUFFER_SIZE]; + private final ByteBuffer native_translation_buffer = BufferUtils.createByteBuffer(KEYBOARD_BUFFER_SIZE); + private final CharsetDecoder utf8_decoder = Charset.forName("UTF-8").newDecoder(); + private final CharBuffer char_buffer = CharBuffer.allocate(KEYBOARD_BUFFER_SIZE); + + public LinuxKeyboard(long display, long window) { + long modifier_map = getModifierMapping(display); + int tmp_numlock_mask = 0; + int tmp_modeswitch_mask = 0; + int tmp_caps_lock_mask = 0; + int tmp_shift_lock_mask = 0; + if (modifier_map != 0) { + int max_keypermod = getMaxKeyPerMod(modifier_map); + // Find modifier masks + int i, j; + for (i = 0; i < 8; i++) { + for (j = 0; j < max_keypermod; j++) { + int key_code = lookupModifierMap(modifier_map, i*max_keypermod + j); + int key_sym = (int)keycodeToKeySym(display, key_code); + int mask = 1 << i; + switch (key_sym) { + case LinuxKeycodes.XK_Num_Lock: + tmp_numlock_mask |= mask; + break; + case LinuxKeycodes.XK_Mode_switch: + tmp_modeswitch_mask |= mask; + break; + case LinuxKeycodes.XK_Caps_Lock: + if (i == LockMapIndex) { + tmp_caps_lock_mask = mask; + tmp_shift_lock_mask = 0; + } + break; + case LinuxKeycodes.XK_Shift_Lock: + if (i == LockMapIndex && tmp_caps_lock_mask == 0) + tmp_shift_lock_mask = mask; + break; + default: + break; + } + } + } + freeModifierMapping(modifier_map); + } + numlock_mask = tmp_numlock_mask; + modeswitch_mask = tmp_modeswitch_mask; + caps_lock_mask = tmp_caps_lock_mask; + shift_lock_mask = tmp_shift_lock_mask; + xim = openIM(display); + if (xim != 0) { + xic = createIC(xim, window); + if (xic != 0) { + setupIMEventMask(display, window, xic); + } else { + destroy(); + } + } else { + xic = 0; + } + compose_status = allocateComposeStatus(); + } + private static native long getModifierMapping(long display); + private static native void freeModifierMapping(long modifier_map); + private static native int getMaxKeyPerMod(long modifier_map); + private static native int lookupModifierMap(long modifier_map, int index); + private static native long keycodeToKeySym(long display, int key_code); + + private static native long openIM(long display); + private static native long createIC(long xim, long window); + private static native void setupIMEventMask(long display, long window, long xic); + private static native ByteBuffer allocateComposeStatus(); + + public void destroy() { + destroyIC(xic); + closeIM(xim); + } + private static native void destroyIC(long xic); + private static native void closeIM(long xim); + + public int read(IntBuffer buffer) { + return event_queue.copyEvents(buffer); + } + + public void poll(ByteBuffer keyDownBuffer) { + int old_position = keyDownBuffer.position(); + keyDownBuffer.put(key_down_buffer); + keyDownBuffer.position(old_position); + } + + private void putKeyboardEvent(int keycode, int state, int ch) { + tmp_event[0] = keycode; + tmp_event[1] = state; + tmp_event[2] = ch; + event_queue.putEvent(tmp_event); + } + + private int lookupStringISO88591(long event_ptr, int[] translation_buffer) { + int i; + + int num_chars = lookupString(event_ptr, native_translation_buffer, compose_status); + for (i = 0; i < num_chars; i++) { + translation_buffer[i] = ((int)native_translation_buffer.get(i)) & 0xff; + } + return num_chars; + } + private static native int lookupString(long event_ptr, ByteBuffer buffer, ByteBuffer compose_status); + + private int lookupStringUnicode(long event_ptr, int[] translation_buffer) { + int status = utf8LookupString(xic, event_ptr, native_translation_buffer, native_translation_buffer.position(), native_translation_buffer.remaining()); + if (status != XLookupChars && status != XLookupBoth) + return 0; + native_translation_buffer.flip(); + utf8_decoder.decode(native_translation_buffer, char_buffer, true); + native_translation_buffer.compact(); + char_buffer.flip(); + int i = 0; + while (char_buffer.hasRemaining() && i < translation_buffer.length) { + translation_buffer[i++] = char_buffer.get(); + } + char_buffer.compact(); + return i; + } + private static native int utf8LookupString(long xic, long event_ptr, ByteBuffer buffer, int pos, int size); + + private int lookupString(long event_ptr, int[] translation_buffer) { + if (xic != 0) { + return lookupStringUnicode(event_ptr, translation_buffer); + } else + return lookupStringISO88591(event_ptr, translation_buffer); + } + + private void translateEvent(long event_ptr, int event_type, int keycode, int key_state) { + int num_chars, i; + int ch; + + if (event_type == KeyRelease) { + putKeyboardEvent(keycode, key_state, 0); + return; + } + num_chars = lookupString(event_ptr, temp_translation_buffer); + if (num_chars > 0) { + ch = temp_translation_buffer[0]; + putKeyboardEvent(keycode, key_state, ch); + for (i = 1; i < num_chars; i++) { + ch = temp_translation_buffer[i]; + putKeyboardEvent(0, 0, ch); + } + } else { + putKeyboardEvent(keycode, key_state, 0); + } + } + + private static boolean isKeypadKeysym(long keysym) { + return (0xFF80 <= keysym && keysym <= 0xFFBD) || + (0x11000000 <= keysym && keysym <= 0x1100FFFF); + } + + private static boolean isNoSymbolOrVendorSpecific(long keysym) { + return keysym == NoSymbol || (keysym & (1 << 28)) != 0; + } + + private static long getKeySym(long event_ptr, int group, int index) { + long keysym = lookupKeysym(event_ptr, group*2 + index); + if (isNoSymbolOrVendorSpecific(keysym) && index == 1) { + keysym = lookupKeysym(event_ptr, group*2 + 0); + } + if (isNoSymbolOrVendorSpecific(keysym) && group == 1) + keysym = getKeySym(event_ptr, 0, index); + return keysym; + } + private static native long lookupKeysym(long event_ptr, int index); + private static native long toUpper(long keysym); + + private long mapEventToKeySym(long event_ptr, int event_state) { + int group; + long keysym; + if ((event_state & modeswitch_mask) != 0) + group = 1; + else + group = 0; + if ((event_state & numlock_mask) != 0 && isKeypadKeysym(keysym = getKeySym(event_ptr, group, 1))) { + if ((event_state & (ShiftMask | shift_lock_mask)) != 0) { + return getKeySym(event_ptr, group, 0); + } else { + return keysym; + } + } else if ((event_state & (ShiftMask | LockMask)) == 0) { + return getKeySym(event_ptr, group, 0); + } else if ((event_state & ShiftMask) == 0) { + keysym = getKeySym(event_ptr, group, 0); + if ((event_state & caps_lock_mask) != 0) + keysym = toUpper(keysym); + return keysym; + } else { + keysym = getKeySym(event_ptr, group, 1); + if ((event_state & caps_lock_mask) != 0) + keysym = toUpper(keysym); + return keysym; + } + } + + private int getKeycode(long event_ptr, int event_state) { + long keysym = mapEventToKeySym(event_ptr, event_state); + int keycode = LinuxKeycodes.mapKeySymToLWJGLKeyCode(keysym); + if (keycode == Keyboard.KEY_NONE) { + // Try unshifted keysym mapping + keysym = lookupKeysym(event_ptr, 0); + keycode = LinuxKeycodes.mapKeySymToLWJGLKeyCode(keysym); + } + return keycode; + } + + private byte getKeyState(int event_type) { + switch (event_type) { + case KeyPress: + return 1; + case KeyRelease: + return 0; + default: + throw new IllegalArgumentException("Unknown event_type: " + event_type); + } + } + + public void handleKeyEvent(long event_ptr, ... [truncated message content] |
|
From: <eli...@us...> - 2006-07-07 11:00:43
|
Revision: 2451 Author: elias_naur Date: 2006-07-07 04:00:32 -0700 (Fri, 07 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2451&view=rev Log Message: ----------- Added linux specific build.xml for building liblwjgl.so. Moved FMOD and Devil native builds to compile_native_optional ant target Modified Paths: -------------- trunk/LWJGL/build.xml Added Paths: ----------- trunk/LWJGL/platform_build/linux_ant/ trunk/LWJGL/platform_build/linux_ant/build.xml Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-07 10:38:54 UTC (rev 2450) +++ trunk/LWJGL/build.xml 2006-07-07 11:00:32 UTC (rev 2451) @@ -1,4 +1,4 @@ -<project name="LWJGL" default="compile" basedir="."> +<project name="LWJGL" default="all" basedir="."> <!-- ================================================================== --> <!-- Global properties for build --> @@ -249,10 +249,7 @@ <target name="clean" description="Cleans the diectories controlled by this ant script"> <delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" /> <delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" /> - <delete dir="${lwjgl.bin}/org" quiet="true" failonerror="false" taskname="cleaning bin folder" /> - <delete taskname="cleaning bin folder" failonerror="false"> - <fileset dir="${lwjgl.bin}" includes="*.class" /> - </delete> + <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" /> </target> <!-- Creates a distribution of LWJGL --> @@ -297,6 +294,8 @@ <antcall target="-distribute" /> </target> + <target name="all" description="Creates the Java archives and the natives for the current platform" depends="jars, compile_native"/> + <!-- Create ONLY the jar archives --> <target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize, compile, -createjars"> <move todir="libs/"> @@ -465,7 +464,7 @@ </target> <!-- Compiles the Java source code --> - <target name="compile" description="Compiles the java source code"> + <target name="compile" description="Compiles the java source code" depends="-initialize"> <javac debug="yes" destdir="${lwjgl.bin}" includes="org/lwjgl/opengl/**" source="1.4" target="1.4" classpath="${lwjgl.lib}/jinput.jar" taskname="core"> <src path="${lwjgl.src}/java/"/> <src path="${lwjgl.src}/generated/"/> @@ -632,6 +631,8 @@ </apply> </target> + <target name="compile_native_all" depends="compile_native, compile_native_optional" description="Compiles the native files"/> + <!-- Compiles the native files --> <target name="compile_native" depends="headers" description="Compiles the native files"> <!-- check each platform, and run their build target --> @@ -650,7 +651,16 @@ </condition> <antcall target="-compile_native_mac" /> </target> + + <target name="compile_native_optional" depends="headers" description="Compiles the native files"> + <!-- check each platform, and run their build target --> + <condition property="lwjgl.platform.linux"> + <os name="Linux" /> + </condition> + <antcall target="-compile_native_linux_optional" /> + </target> + <!-- Compiles LWJGL on Win32 platforms --> <target name="-compile_native_win32" if="lwjgl.platform.windows"> <echo>Compiling Win32 LWJGL version</echo> @@ -695,9 +705,12 @@ <!-- Compiles LWJGL on Linux platforms --> <target name="-compile_native_linux" if="lwjgl.platform.linux"> - <echo>Compiling Linux LWJGL version</echo> + <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/> + <copy file="${lwjgl.bin}/liblwjgl.so" tofile="${lwjgl.lib}/linux/liblwjgl.so" /> + </target> - <!-- check for required properties --> + <target name="-compile_native_linux_optional" if="lwjgl.platform.linux"> + <!-- check for required properties --> <property environment="env"/> <fail message="Missing JAVA_HOME path environment property" unless="env.JAVA_HOME"/> <fail message="Missing FMOD path environment property" unless="env.FMOD"/> @@ -709,7 +722,6 @@ <exec executable="make" dir="${lwjgl.src.native}/common/fmod3"> <arg line="-f Makefile.linux"/> </exec> - <move file="${lwjgl.src.native}/linux/liblwjgl.so" tofile="${lwjgl.lib}/linux/liblwjgl.so" /> <move file="${lwjgl.src.native}/common/devil/liblwjgl-devil.so" tofile="${lwjgl.lib}/linux/liblwjgl-devil.so" /> <move file="${lwjgl.src.native}/common/fmod3/liblwjgl-fmod3.so" tofile="${lwjgl.lib}/linux/liblwjgl-fmod3.so" /> </target> @@ -745,12 +757,12 @@ <cvs command="export -D 'now'" compressionlevel="3" cvsRoot=":pserver:ano...@cv...:/cvsroot/java-game-lib" package="LWJGL/build.xml" dest="." /> <cvs command="export -D 'now'" compressionlevel="3" cvsRoot=":pserver:ano...@cv...:/cvsroot/java-game-lib" package="LWJGL/src" dest="." /> <cvs command="export -D 'now'" compressionlevel="3" cvsRoot=":pserver:ano...@cv...:/cvsroot/java-game-lib" package="LWJGL/doc" dest="." /> - <ant dir="LWJGL" target="compile_native" /> + <ant dir="LWJGL" target="compile_native_all" /> <ant dir="LWJGL" target="release" /> </target> <!-- --> - <target name="sign" description="Using relased files, creates the nescesarry files used for jnlp demos"> + <target name="sign" description="Using released files, creates the necessary files used for jnlp demos"> <!-- delete existing temp --> <delete dir="${lwjgl.temp}"/> Added: trunk/LWJGL/platform_build/linux_ant/build.xml =================================================================== --- trunk/LWJGL/platform_build/linux_ant/build.xml (rev 0) +++ trunk/LWJGL/platform_build/linux_ant/build.xml 2006-07-07 11:00:32 UTC (rev 2451) @@ -0,0 +1,39 @@ +<?xml version="1.0"?> + +<project name="lwjgl native code, linux" basedir="../../bin" default="compile"> + <property name="native" location="../src/native"/> + <property name="libname" value="liblwjgl.so"/> + <property name="libs" value="-L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lpthread -L${java.home}/lib/i386 -ljawt -Wl,-static,-lXxf86vm,-lXcursor,-lXrender,-lXrandr,-lXfixes,-call_shared"/> + <property name="cflags" value="-O2 -Wall -c -fPIC -std=c99 -pthread"/> + <property name="linker_flags" value="-Wl,--version-script=${native}/linux/lwjgl.map -shared -O2 -Wall -o ${libname} ${libs}"/> + + <target name="clean"> + <delete> + <fileset dir="." includes="*.o"/> + <fileset file="${libname}"/> + </delete> + </target> + + <target name="compile"> + <apply dir="." executable="cc" dest="." skipemptyfilesets="true" failonerror="true"> + <arg line="${cflags}"/> + <arg value="-I${java.home}/include"/> + <arg value="-I${java.home}/include/linux"/> + <arg value="-I${native}/common"/> + <arg value="-I${native}/linux"/> + <mapper type="glob" from="*.c" to="*.o"/> + <fileset dir="${native}/linux" includes="*.c"/> + <fileset dir="${native}/generated" includes="*.c"/> + <fileset dir="${native}/common" includes="*.c"/> + </apply> + <apply dir="." parallel="true" executable="cc" failonerror="true"> + <srcfile/> + <arg line="${linker_flags}"/> + <fileset dir="." includes="*.o"/> + </apply> + <apply dir="." parallel="true" executable="strip" failonerror="true"> + <fileset file="${libname}"/> + </apply> + </target> +</project> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-07 12:41:54
|
Revision: 2453 Author: elias_naur Date: 2006-07-07 05:41:36 -0700 (Fri, 07 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2453&view=rev Log Message: ----------- Mac OS X: Added support for compile_native target. Moved optional libraries to compile_native_optional target Modified Paths: -------------- trunk/LWJGL/build.xml Added Paths: ----------- trunk/LWJGL/platform_build/macosx_ant/ trunk/LWJGL/platform_build/macosx_ant/build-symbol-list trunk/LWJGL/platform_build/macosx_ant/build.xml Removed Paths: ------------- trunk/LWJGL/src/native/macosx/build-symbol-list trunk/LWJGL/src/native/macosx/build.xml Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-07 11:47:56 UTC (rev 2452) +++ trunk/LWJGL/build.xml 2006-07-07 12:41:36 UTC (rev 2453) @@ -646,10 +646,10 @@ </condition> <antcall target="-compile_native_linux" /> - <condition property="lwjgl.platform.mac"> + <condition property="lwjgl.platform.macosx"> <os name="Mac OS X" /> </condition> - <antcall target="-compile_native_mac" /> + <antcall target="-compile_native_macosx" /> </target> <target name="compile_native_optional" depends="headers" description="Compiles the native files"> @@ -658,6 +658,10 @@ <os name="Linux" /> </condition> <antcall target="-compile_native_linux_optional" /> + <condition property="lwjgl.platform.macosx"> + <os name="Mac OS X" /> + </condition> + <antcall target="-compile_native_macosx_optional" /> </target> @@ -706,7 +710,7 @@ <!-- Compiles LWJGL on Linux platforms --> <target name="-compile_native_linux" if="lwjgl.platform.linux"> <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/> - <copy file="${lwjgl.bin}/liblwjgl.so" tofile="${lwjgl.lib}/linux/liblwjgl.so" /> + <copy file="${lwjgl.bin}/liblwjgl.so" todir="${lwjgl.lib}/linux"/> </target> <target name="-compile_native_linux_optional" if="lwjgl.platform.linux"> @@ -715,7 +719,6 @@ <fail message="Missing JAVA_HOME path environment property" unless="env.JAVA_HOME"/> <fail message="Missing FMOD path environment property" unless="env.FMOD"/> - <exec executable="make" dir="${lwjgl.src.native}/linux"/> <exec executable="make" dir="${lwjgl.src.native}/common/devil"> <arg line="-f Makefile.linux"/> </exec> @@ -726,22 +729,25 @@ <move file="${lwjgl.src.native}/common/fmod3/liblwjgl-fmod3.so" tofile="${lwjgl.lib}/linux/liblwjgl-fmod3.so" /> </target> + <target name="-compile_native_macosx" if="lwjgl.platform.macosx"> + <ant antfile="platform_build/macosx_ant/build.xml" inheritAll="false"/> + <copy file="${lwjgl.bin}/liblwjgl.jnilib" todir="${lwjgl.lib}/macosx"/> + </target> + <!-- Compiles LWJGL on Mac OS X platforms --> - <target name="-compile_native_mac" if="lwjgl.platform.mac"> + <target name="-compile_native_macosx_optional" if="lwjgl.platform.macosx"> <!-- check for required properties --> <property environment="env"/> <fail message="Missing AL path environment property" unless="env.AL"/> <fail message="Missing FMOD path environment property" unless="env.FMOD"/> - <exec executable="make" dir="${lwjgl.src.native}/macosx" failonerror="true"/> <exec executable="make" dir="${lwjgl.src.native}/common/devil"> <arg line="-f Makefile.macosx"/> </exec> <exec executable="make" dir="${lwjgl.src.native}/common/fmod3"> <arg line="-f Makefile.macosx"/> </exec> - <move file="${lwjgl.src.native}/macosx/liblwjgl.jnilib" tofile="${lwjgl.lib}/macosx/liblwjgl.jnilib" /> <move file="${lwjgl.src.native}/common/devil/liblwjgl-devil.jnilib" tofile="${lwjgl.lib}/macosx/liblwjgl-devil.jnilib" /> <move file="${lwjgl.src.native}/common/fmod3/liblwjgl-fmod3.jnilib" tofile="${lwjgl.lib}/macosx/liblwjgl-fmod3.jnilib" /> </target> Copied: trunk/LWJGL/platform_build/macosx_ant/build-symbol-list (from rev 2451, trunk/LWJGL/src/native/macosx/build-symbol-list) =================================================================== --- trunk/LWJGL/platform_build/macosx_ant/build-symbol-list (rev 0) +++ trunk/LWJGL/platform_build/macosx_ant/build-symbol-list 2006-07-07 12:41:36 UTC (rev 2453) @@ -0,0 +1,3 @@ +#!/bin/sh + +nm -g "$1"/*.o | grep "Java_" | cut -d ' ' -f3 | cut -c 1- Copied: trunk/LWJGL/platform_build/macosx_ant/build.xml (from rev 2451, trunk/LWJGL/src/native/macosx/build.xml) =================================================================== --- trunk/LWJGL/platform_build/macosx_ant/build.xml (rev 0) +++ trunk/LWJGL/platform_build/macosx_ant/build.xml 2006-07-07 12:41:36 UTC (rev 2453) @@ -0,0 +1,82 @@ +<?xml version="1.0" ?> +<project name="OS X Native code" basedir="../../bin" default="nativelibrary"> + <property name="native" location="../src/native"/> + + <target name="init"> + <mkdir dir="ppc"/> + <mkdir dir="intel"/> + </target> + + <target name="clean"> + <delete failonerror="false"> + <fileset dir="intel"/> + <fileset dir="ppc"/> + <fileset dir="." includes="liblwjgl.jnilib"/> + <fileset dir="." includes="lwjgl.symbols"/> + </delete> + </target> + + <target name="compile"> + <apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}"> + <arg line="${cflags} -O2 -Wall -c -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${native}/common -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"/> + <fileset dir="${native}/macosx" includes="*.c"/> + <fileset dir="${native}/common" includes="*.c"/> + <fileset dir="${native}/generated" includes="*.c"/> + </apply> + </target> + + <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 -framework AppKit -framework JavaVM -framework Carbon"/> + <fileset dir="${objdir}" includes="*.o"/> + </apply> + <apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true"> + <arg line="-S -X"/> + <fileset dir="." file="${libname}"/> + </apply> + </target> + + <target name="nativelibrary" depends="init"> + <property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/> + <property name="legacy_sdkroot" location="/Developer/SDKs/MacOSX10.3.9.sdk"/> + <property name="universal_flags" value="-isysroot ${universal_sdkroot} -arch i386"/> + <antcall target="compile"> + <param name="dstdir" location="intel"/> + <param name="compiler" value="gcc-4.0"/> + <param name="sdkroot" location="${universal_sdkroot}"/> + <param name="cflags" value="${universal_flags}"/> + </antcall> + <antcall target="compile"> + <param name="dstdir" location="ppc"/> + <param name="compiler" value="gcc-3.3"/> + <param name="sdkroot" location="${legacy_sdkroot}"/> + <param name="cflags" value=""/> + </antcall> + <exec vmlauncher="false" executable="../platform_build/macosx_ant/build-symbol-list" output="lwjgl.symbols" failonerror="true"> + <arg path="intel"/> + </exec> + <antcall target="link"> + <param name="objdir" location="intel"/> + <param name="libname" value="liblwjgl-intel.jnilib"/> + <param name="linker" value="gcc-4.0"/> + <param name="linkerflags" value="${universal_flags}"/> + </antcall> + <antcall target="link"> + <param name="objdir" location="ppc"/> + <param name="libname" value="liblwjgl-ppc.jnilib"/> + <param name="linker" value="gcc-3.3"/> + <param name="linkerflags" value=""/> + </antcall> + <apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" > + <arg value="-create"/> + <srcfile/> + <arg value="-output"/> + <arg path="liblwjgl.jnilib"/> + <fileset file="ppc/liblwjgl-ppc.jnilib"/> + <fileset file="intel/liblwjgl-intel.jnilib"/> + </apply> + </target> +</project> Deleted: trunk/LWJGL/src/native/macosx/build-symbol-list =================================================================== --- trunk/LWJGL/src/native/macosx/build-symbol-list 2006-07-07 11:47:56 UTC (rev 2452) +++ trunk/LWJGL/src/native/macosx/build-symbol-list 2006-07-07 12:41:36 UTC (rev 2453) @@ -1,3 +0,0 @@ -#!/bin/sh - -nm -g intel/*.o | grep "Java_" | cut -d ' ' -f3 | cut -c 1- Deleted: trunk/LWJGL/src/native/macosx/build.xml =================================================================== --- trunk/LWJGL/src/native/macosx/build.xml 2006-07-07 11:47:56 UTC (rev 2452) +++ trunk/LWJGL/src/native/macosx/build.xml 2006-07-07 12:41:36 UTC (rev 2453) @@ -1,76 +0,0 @@ -<?xml version="1.0" ?> -<project name="OS X Native code" basedir="." default="nativelibrary"> - <target name="init"> - <mkdir dir="ppc"/> - <mkdir dir="intel"/> - </target> - - <target name="clean"> - <delete failonerror="false"> - <fileset dir="intel"/> - <fileset dir="ppc"/> - <fileset dir="." includes="liblwjgl.jnilib"/> - </delete> - </target> - - <target name="compile"> - <apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}"> - <arg line="${cflags} -O2 -Wall -c -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I../../common -I.."/> - <mapper type="regexp" from="^(.*)\.(c|m)" to="\1.o"/> - <fileset dir="." includes="*.m"/> - <fileset dir="." includes="*.c"/> - <fileset dir="../common" includes="*.c"/> - <fileset dir="../generated" includes="*.c"/> - </apply> - </target> - - <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 -framework AppKit -framework JavaVM -framework Carbon"/> - <fileset dir="${objdir}" includes="*.o"/> - </apply> - <apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true"> - <arg line="-S -X"/> - <fileset dir="." file="${libname}"/> - </apply> - </target> - - <target name="nativelibrary" depends="init"> - <property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/> - <property name="legacy_sdkroot" location="/Developer/SDKs/MacOSX10.3.9.sdk"/> - <property name="universal_flags" value="-isysroot ${universal_sdkroot} -arch i386"/> - <antcall target="compile"> - <param name="dstdir" location="intel"/> - <param name="compiler" value="gcc-4.0"/> - <param name="sdkroot" location="${universal_sdkroot}"/> - <param name="cflags" value="${universal_flags}"/> - </antcall> - <antcall target="compile"> - <param name="dstdir" location="ppc"/> - <param name="compiler" value="gcc-3.3"/> - <param name="sdkroot" location="${legacy_sdkroot}"/> - <param name="cflags" value=""/> - </antcall> - <exec executable="./build-symbol-list" output="lwjgl.symbols"/> - <antcall target="link"> - <param name="objdir" location="intel"/> - <param name="libname" value="liblwjgl-intel.jnilib"/> - <param name="linker" value="gcc-4.0"/> - <param name="linkerflags" value="${universal_flags}"/> - </antcall> - <antcall target="link"> - <param name="objdir" location="ppc"/> - <param name="libname" value="liblwjgl-ppc.jnilib"/> - <param name="linker" value="gcc-3.3"/> - <param name="linkerflags" value=""/> - </antcall> - <apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" > - <arg value="-create"/> - <srcfile/> - <arg value="-output"/> - <arg path="liblwjgl.jnilib"/> - <fileset file="ppc/liblwjgl-ppc.jnilib"/> - <fileset file="intel/liblwjgl-intel.jnilib"/> - </apply> - </target> -</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-08 17:20:54
|
Revision: 2457 Author: elias_naur Date: 2006-07-08 10:20:18 -0700 (Sat, 08 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2457&view=rev Log Message: ----------- Windows: Added ant build.xml for native core Modified Paths: -------------- trunk/LWJGL/build.xml Added Paths: ----------- trunk/LWJGL/platform_build/windows_ant/ trunk/LWJGL/platform_build/windows_ant/build.xml Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-07 14:06:46 UTC (rev 2456) +++ trunk/LWJGL/build.xml 2006-07-08 17:20:18 UTC (rev 2457) @@ -654,6 +654,11 @@ <target name="compile_native_optional" depends="headers" description="Compiles the native files"> <!-- check each platform, and run their build target --> + <condition property="lwjgl.platform.windows"> + <os family="windows" /> + </condition> + <antcall target="-compile_native_win32_optional" /> + <condition property="lwjgl.platform.linux"> <os name="Linux" /> </condition> @@ -670,15 +675,20 @@ <echo>Compiling Win32 LWJGL version</echo> <!-- check for required properties --> - <property environment="env"/> + <!-- <property environment="env"/> <fail message="Missing PLTSDKHOME path environment property" unless="env.PLTSDKHOME"/> <fail message="Missing ALHOME path environment property" unless="env.ALHOME"/> <fail message="Missing JAVA_HOME path environment property" unless="env.JAVA_HOME"/> <fail message="Missing CHOME path environment property" unless="env.CHOME"/> <fail message="Missing DXHOME path environment property" unless="env.DXHOME"/> + + <antcall target="-compile_native_win32_main" />--> + <ant antfile="platform_build/windows_ant/build.xml" inheritAll="false"/> + <copy file="${lwjgl.bin}/lwjgl.dll" todir="${lwjgl.lib}/win32"/> + </target> + + <target name="-compile_native_win32_optional" if="lwjgl.platform.windows"> <fail message="Missing FMODHOME path environment property" unless="env.FMODHOME"/> - - <antcall target="-compile_native_win32_main" /> <antcall target="-compile_native_win32_fmod" /> <antcall target="-compile_native_win32_devil" /> </target> Added: trunk/LWJGL/platform_build/windows_ant/build.xml =================================================================== --- trunk/LWJGL/platform_build/windows_ant/build.xml (rev 0) +++ trunk/LWJGL/platform_build/windows_ant/build.xml 2006-07-08 17:20:18 UTC (rev 2457) @@ -0,0 +1,61 @@ +<?xml version="1.0"?> + +<project name="lwjgl native code, native code" basedir="../../bin" default="compile"> + <property name="native" location="../src/native"/> + + <target name="compile_dir"> + <apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true"> + <arg line="/Ox /Wp64 /W2 /nologo /Ox /Ob2 /Oi /Ot /Oy /FD /EHsc /MT /Gy /W2 /nologo /c /D WIN32 /c"/> + <arg value="/I${toolkithome}\include"/> + <arg value="/I${sdkhome}\include"/> + <arg value="/I${dxhome}\include"/> + <arg value="/I${alhome}\include"/> + <arg value="/I${java.home}\..\include"/> + <arg value="/I${java.home}\..\include\win32"/> + <arg value="/I${native}/common"/> + <arg value="/I${native}/win32"/> + <srcfile/> + <fileset dir="${native}/win32" includes="*.c"/> + <fileset dir="${native}/common" includes="*.c"/> + <fileset dir="${native}/generated" includes="*.c"/> + <mapper type="glob" from="*.c" to="*.obj"/> + </apply> + </target> + + <target name="link"> + <apply dir="." parallel="true" executable="cl" failonerror="true"> + <arg line="/LD /nologo"/> + <srcfile/> + <arg line="/Fe${dllname} /link"/> + <arg value="/LIBPATH:${java.home}\..\lib"/> + <arg value="/LIBPATH:${dxhome}\lib\x86"/> + <arg value="/LIBPATH:${sdkhome}\lib"/> + <arg value="/LIBPATH:${alhome}\libs"/> + <arg value="/LIBPATH:${toolkithome}\lib"/> + <arg value="/OPT:REF"/> + <arg value="/OPT:ICF"/> + <arg line="/DLL /DELAYLOAD:jawt.dll ${libs}"/> + <fileset dir="." includes="*.obj"/> + </apply> + </target> + + <target name="clean"> + <delete> + <fileset dir="." includes="*.obj"/> + <fileset dir="." includes="*.dll"/> + </delete> + </target> + + <target name="compile"> + <property name="program_files" location="c:\Program Files"/> + <property name="dxhome" location="${program_files}\Microsoft DirectX SDK (February 2006)"/> + <property name="toolkithome" location="${program_files}\Microsoft Visual C++ Toolkit 2003"/> + <property name="sdkhome" location="${program_files}\Microsoft Platform SDK"/> + <property name="alhome" location="${program_files}\OpenAL 1.0 Software Development Kit"/> + <property name="dllname" value="lwjgl.dll"/> + <property name="libs" value="Kernel32.lib ole32.lib dinput.lib dxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib delayimp.lib winmm.lib"/> + <antcall target="compile_dir"/> + <antcall target="link"/> + </target> +</project> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-11 20:30:41
|
Revision: 2479 Author: elias_naur Date: 2006-07-11 13:30:19 -0700 (Tue, 11 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2479&view=rev Log Message: ----------- Linux: added support for 64 bit JVMs Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/platform_build/linux_ant/build.xml trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/Sys.java trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/build.xml 2006-07-11 20:30:19 UTC (rev 2479) @@ -358,14 +358,14 @@ </jar> <!-- create each of the native jars --> - <jar destfile="applet/win32_natives.jar" taskname="win32_natives.jar"> + <jar destfile="applet/windows_natives.jar" taskname="windows_natives.jar"> <fileset dir="${lwjgl.lib}/win32"> <patternset refid="lwjgl-win32.fileset"/> <patternset refid="lwjgl-win32_optional.fileset"/> <include name="fmod.dll"/> </fileset> </jar> - <signjar jar="applet/win32_natives.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> + <signjar jar="applet/windows_natives.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> <jar destfile="applet/linux_natives.jar" taskname="linux_natives.jar"> <fileset dir="${lwjgl.lib}/linux"> @@ -388,12 +388,12 @@ <!-- add it to a natives jar --> <jar destfile="applet/natives.jar" taskname="natives.jar"> <fileset dir="applet"> - <include name="win32_natives.jar"/> + <include name="windows_natives.jar"/> <include name="linux_natives.jar"/> <include name="macosx_natives.jar"/> </fileset> </jar> - <delete file="applet/win32_natives.jar"/> + <delete file="applet/windows_natives.jar"/> <delete file="applet/linux_natives.jar"/> <delete file="applet/macosx_natives.jar"/> Modified: trunk/LWJGL/platform_build/linux_ant/build.xml =================================================================== --- trunk/LWJGL/platform_build/linux_ant/build.xml 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/platform_build/linux_ant/build.xml 2006-07-11 20:30:19 UTC (rev 2479) @@ -2,7 +2,8 @@ <project name="lwjgl native code, linux" basedir="../../bin" default="compile"> <property name="native" location="../src/native"/> - <property name="libname" value="liblwjgl.so"/> + <property name="libname32" value="liblwjgl.so"/> + <property name="libname64" value="liblwjgl64.so"/> <property name="libs32" value="-L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lpthread -L${java.home}/lib/i386 -ljawt -Wl,-static,-lXxf86vm,-lXcursor,-lXrender,-lXrandr,-lXfixes,-call_shared"/> <property name="libs64" value="-L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lpthread -L${java.home}/lib/amd64 -ljawt -lXxf86vm -lXcursor -lXrender -lXrandr -lXfixes"/> <property name="cflags" value="-O2 -Wall -c -fPIC -std=c99 -pthread"/> @@ -21,6 +22,9 @@ <condition property="libs" value="${libs64}" else="${libs32}"> <equals arg1="${hwplatform}" arg2="x86_64"/> </condition> + <condition property="libname" value="${libname64}" else="${libname32}"> + <equals arg1="${hwplatform}" arg2="x86_64"/> + </condition> <property name="linker_flags" value="-Wl,--version-script=${native}/linux/lwjgl.map -shared -O2 -Wall -o ${libname} ${libs}"/> <apply dir="." executable="cc" dest="." skipemptyfilesets="true" failonerror="true"> <arg line="${cflags}"/> Modified: trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -46,6 +46,10 @@ return 1000; } + public boolean has64Bit() { + return false; + } + public abstract long getTime(); public abstract void alert(String title, String message); public abstract String getClipboard(); Modified: trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -58,7 +58,7 @@ public static final int PLATFORM_WINDOWS = 3; public static final String PLATFORM_LINUX_NAME = "linux"; public static final String PLATFORM_MACOSX_NAME = "macosx"; - public static final String PLATFORM_WINDOWS_NAME = "win32"; + public static final String PLATFORM_WINDOWS_NAME = "windows"; /** LWJGL Logo - 16 by 16 pixels */ public static final ByteBuffer LWJGLIcon16x16 = BufferUtils.createByteBuffer(16 * 16 * 4).put(new byte[] { Modified: trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -71,4 +71,8 @@ // Seems to have failed return false; } + + public boolean has64Bit() { + return true; + } } Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -58,8 +58,10 @@ /** The implementation instance to delegate platform specific behavior to */ private final static SysImplementation implementation; + + private final static String POSTFIX64BIT = "64"; - private static void loadLibrary(final String lib_name) { + private static void doLoadLibrary(final String lib_name) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { String library_path = System.getProperty("org.lwjgl.librarypath"); @@ -72,6 +74,21 @@ return null; } }); + } + + private static void loadLibrary(final String lib_name) { + try { + loadLibrary(lib_name); + } catch (UnsatisfiedLinkError e) { + if (implementation.has64Bit()) { + try { + loadLibrary(lib_name + POSTFIX64BIT); + } catch (UnsatisfiedLinkError e2) { + LWJGLUtil.log("Failed to load 64 bit library:" + e2.getMessage()); + } + } + throw e; + } } static { Modified: trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -44,22 +44,28 @@ /** * Return the version of the native library */ - public String getNativeLibraryVersion(); + String getNativeLibraryVersion(); - public void setDebug(boolean debug); + void setDebug(boolean debug); /** * Obtains the number of ticks that the hires timer does in a second. * * @return timer resolution in ticks per second or 0 if no timer is present. */ - public long getTimerResolution(); + long getTimerResolution(); - public long getTime(); + long getTime(); - public void alert(String title, String message); + void alert(String title, String message); boolean openURL(String url); - public String getClipboard(); + String getClipboard(); + + /** + * Returns true there exists a separate 64 bit library + * on the platform + */ + boolean has64Bit(); } Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -84,7 +84,7 @@ * the user's temp directory, and instruct the LWJGL subsystem to load its * native files from there. * The file required by the installer, is gotten from the classloader via its - * getResource command, and is expected to be named <win32 | linux | macosx>_natives.jar. + * getResource command, and is expected to be named <windows | linux | macosx>_natives.jar. * Note: Due to the nature of native libraries, we cannot actually uninstall the currently * loaded files, but rather the "last" installed. This means that the most recent install of LWJGL * will always be present in the users temp dir. When invoking the tempInstall method, all old installations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-11 20:49:36
|
Revision: 2480 Author: elias_naur Date: 2006-07-11 13:49:28 -0700 (Tue, 11 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2480&view=rev Log Message: ----------- Linux: more 64 bit stuff Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/src/java/org/lwjgl/Sys.java Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-11 20:30:19 UTC (rev 2479) +++ trunk/LWJGL/build.xml 2006-07-11 20:49:28 UTC (rev 2480) @@ -118,9 +118,9 @@ <!-- Files to include in linux, glibc2.3 package --> <patternset id="lwjgl-linux.fileset"> - <include name="liblwjgl.so" /> + <include name="liblwjgl*.so" /> <include name="libopenal.so" /> - <include name="libjinput-linux.so" /> + <include name="libjinput-linux.so" /> </patternset> <!-- Files to include in linux optional, glibc2.3 package --> @@ -720,7 +720,9 @@ <!-- Compiles LWJGL on Linux platforms --> <target name="-compile_native_linux" if="lwjgl.platform.linux"> <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/> - <copy file="${lwjgl.bin}/liblwjgl.so" todir="${lwjgl.lib}/linux"/> + <copy todir="${lwjgl.lib}/linux"> + <fileset dir="${lwjgl.bin}" includes="liblwjgl*.so"/> + </copy> </target> <target name="-compile_native_linux_optional" if="lwjgl.platform.linux"> Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-07-11 20:30:19 UTC (rev 2479) +++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-07-11 20:49:28 UTC (rev 2480) @@ -78,11 +78,11 @@ private static void loadLibrary(final String lib_name) { try { - loadLibrary(lib_name); + doLoadLibrary(lib_name); } catch (UnsatisfiedLinkError e) { if (implementation.has64Bit()) { try { - loadLibrary(lib_name + POSTFIX64BIT); + doLoadLibrary(lib_name + POSTFIX64BIT); } catch (UnsatisfiedLinkError e2) { LWJGLUtil.log("Failed to load 64 bit library:" + e2.getMessage()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-12 18:09:25
|
Revision: 2497 Author: elias_naur Date: 2006-07-12 11:09:11 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2497&view=rev Log Message: ----------- Windows: move natives from src/native/win32 to src/native/windows because the source really is bitness neutral, not 32 bit specific. Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/platform_build/windows_ant/build.xml Added Paths: ----------- trunk/LWJGL/src/native/windows/ Removed Paths: ------------- trunk/LWJGL/src/native/win32/ Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-12 16:55:05 UTC (rev 2496) +++ trunk/LWJGL/build.xml 2006-07-12 18:09:11 UTC (rev 2497) @@ -153,7 +153,7 @@ <fileset id="lwjgl.source.fileset" dir="."> <include name="build.xml" /> <include name="src/**" /> - <include name="platform_build/win32_ms_cmdline/*.bat" /> + <include name="platform_build/**/*" /> </fileset> <!-- files in the base package --> @@ -201,7 +201,7 @@ <uptodate property="lwjgl.main.built" targetfile="${lwjgl.lib}/win32/lwjgl.dll" > <srcfiles dir= "${lwjgl.src.native}/common" includes="*.c*"/> <srcfiles dir= "${lwjgl.src.native}/generated" includes="*.c"/> - <srcfiles dir= "${lwjgl.src.native}/win32" includes="*.cpp"/> + <srcfiles dir= "${lwjgl.src.native}/windows" includes="*.c"/> </uptodate> <uptodate property="lwjgl.fmod.built" targetfile="${lwjgl.lib}/win32/lwjgl-fmod3.dll" > @@ -356,9 +356,20 @@ <target name="runtest" depends="all"> <fail message="test.mainclass is not set. Use 'ant -Dtest.mainclass=<main-class> runtest'" unless="test.mainclass"/> + <condition property="native_path" value="libs/win32"> + <os family="windows" /> + </condition> + + <condition property="native_path" value="libs/linux"> + <os name="Linux" /> + </condition> + + <condition property="native_path" value="libs/macosx"> + <os name="Mac OS X" /> + </condition> <java classname="${test.mainclass}" classpath="${lwjgl.lib}/lwjgl.jar:${lwjgl.lib}/lwjgl_util.jar:${lwjgl.lib}/lwjgl_test.jar" fork="true"> <jvmarg value="-Dorg.lwjgl.util.Debug=true"/> - <jvmarg value="-Djava.library.path=libs/linux:libs/win32:libs/macosx"/> + <jvmarg value="-Djava.library.path=${native_path}"/> </java> </target> @@ -507,7 +518,7 @@ <class name="org.lwjgl.opengl.LinuxCanvasImplementation" /> </javah> - <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/win32" force="yes"> + <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows" force="yes"> <class name="org.lwjgl.opengl.WindowsKeyboard" /> <class name="org.lwjgl.opengl.WindowsDirectInput8" /> <class name="org.lwjgl.opengl.WindowsDirectInputDevice8" /> Modified: trunk/LWJGL/platform_build/windows_ant/build.xml =================================================================== --- trunk/LWJGL/platform_build/windows_ant/build.xml 2006-07-12 16:55:05 UTC (rev 2496) +++ trunk/LWJGL/platform_build/windows_ant/build.xml 2006-07-12 18:09:11 UTC (rev 2497) @@ -18,9 +18,9 @@ <arg value="/I${java.home}\..\include"/> <arg value="/I${java.home}\..\include\win32"/> <arg value="/I${native}\common"/> - <arg value="/I${native}\win32"/> + <arg value="/I${native}\windows"/> <srcfile/> - <fileset dir="${native}/win32" includes="*.c"/> + <fileset dir="${native}/windows" includes="*.c"/> <fileset dir="${native}/common" includes="*.c"/> <fileset dir="${native}/generated" includes="*.c"/> <mapper type="glob" from="*.c" to="*.obj"/> Copied: trunk/LWJGL/src/native/windows (from rev 2495, trunk/LWJGL/src/native/win32) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-12 18:11:26
|
Revision: 2498 Author: elias_naur Date: 2006-07-12 11:10:43 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2498&view=rev Log Message: ----------- remove .cvsignore files Removed Paths: ------------- trunk/LWJGL/.cvsignore trunk/LWJGL/src/native/common/.cvsignore trunk/LWJGL/src/native/common/devil/.cvsignore trunk/LWJGL/src/native/common/fmod3/.cvsignore trunk/LWJGL/src/native/linux/.cvsignore trunk/LWJGL/src/native/macosx/.cvsignore trunk/LWJGL/src/native/windows/.cvsignore Deleted: trunk/LWJGL/.cvsignore =================================================================== --- trunk/LWJGL/.cvsignore 2006-07-12 18:09:11 UTC (rev 2497) +++ trunk/LWJGL/.cvsignore 2006-07-12 18:10:43 UTC (rev 2498) @@ -1,4 +0,0 @@ -.classpath *.class *.class~ *.java~ .nbattrs .project -dist -libs -temp Deleted: trunk/LWJGL/src/native/common/.cvsignore =================================================================== --- trunk/LWJGL/src/native/common/.cvsignore 2006-07-12 18:09:11 UTC (rev 2497) +++ trunk/LWJGL/src/native/common/.cvsignore 2006-07-12 18:10:43 UTC (rev 2498) @@ -1,13 +0,0 @@ -Debug -Release -org_lwjgl_input_Cursor.h -org_lwjgl_input_Keyboard.h -org_lwjgl_input_Mouse.h -org_lwjgl_openal_AL.h -org_lwjgl_openal_ALC.h -org_lwjgl_opengl_GLContext.h -org_lwjgl_opengl_Pbuffer.h -org_lwjgl_Sys.h -org_lwjgl_opengl_Display.h -org_lwjgl_DefaultSysImplementation.h -org_lwjgl_NativeSysImplementation.h Deleted: trunk/LWJGL/src/native/common/devil/.cvsignore =================================================================== --- trunk/LWJGL/src/native/common/devil/.cvsignore 2006-07-12 18:09:11 UTC (rev 2497) +++ trunk/LWJGL/src/native/common/devil/.cvsignore 2006-07-12 18:10:43 UTC (rev 2498) @@ -1 +0,0 @@ -org_lwjgl_devil_ILNative.h \ No newline at end of file Deleted: trunk/LWJGL/src/native/common/fmod3/.cvsignore =================================================================== --- trunk/LWJGL/src/native/common/fmod3/.cvsignore 2006-07-12 18:09:11 UTC (rev 2497) +++ trunk/LWJGL/src/native/common/fmod3/.cvsignore 2006-07-12 18:10:43 UTC (rev 2498) @@ -1,3 +0,0 @@ -org_lwjgl_fmod3_FMOD.h -org_lwjgl_fmod3_FMusic.h -org_lwjgl_fmod3_FSound.h Deleted: trunk/LWJGL/src/native/linux/.cvsignore =================================================================== --- trunk/LWJGL/src/native/linux/.cvsignore 2006-07-12 18:09:11 UTC (rev 2497) +++ trunk/LWJGL/src/native/linux/.cvsignore 2006-07-12 18:10:43 UTC (rev 2498) @@ -1 +0,0 @@ -org_lwjgl_opengl_LinuxDisplay.h Deleted: trunk/LWJGL/src/native/macosx/.cvsignore =================================================================== --- trunk/LWJGL/src/native/macosx/.cvsignore 2006-07-12 18:09:11 UTC (rev 2497) +++ trunk/LWJGL/src/native/macosx/.cvsignore 2006-07-12 18:10:43 UTC (rev 2498) @@ -1 +0,0 @@ -org_lwjgl_opengl_MacOSXDisplay.h Deleted: trunk/LWJGL/src/native/windows/.cvsignore =================================================================== --- trunk/LWJGL/src/native/windows/.cvsignore 2006-07-12 18:09:11 UTC (rev 2497) +++ trunk/LWJGL/src/native/windows/.cvsignore 2006-07-12 18:10:43 UTC (rev 2498) @@ -1,5 +0,0 @@ -Debug -Release -org_lwjgl_opengl_Win32Display.h -org_lwjgl_Win32SysImplementation.h -org_lwjgl_NativeSysImplementation.h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-12 18:34:35
|
Revision: 2499 Author: elias_naur Date: 2006-07-12 11:32:58 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2499&view=rev Log Message: ----------- Windows: Rename Win32* files to Windows* Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java trunk/LWJGL/src/native/windows/LWJGL.c trunk/LWJGL/src/native/windows/context.c trunk/LWJGL/src/native/windows/context.h trunk/LWJGL/src/native/windows/display.c trunk/LWJGL/src/native/windows/display.h trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c trunk/LWJGL/src/native/windows/org_lwjgl_input_Cursor.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplayPeerInfo.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsPbufferPeerInfo.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsPeerInfo.java trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsRegistry.java trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsRegistry.c trunk/LWJGL/src/native/windows/windows_al.c Removed Paths: ------------- trunk/LWJGL/src/java/org/lwjgl/opengl/Win32AWTGLCanvasPeerInfo.java trunk/LWJGL/src/java/org/lwjgl/opengl/Win32CanvasImplementation.java trunk/LWJGL/src/java/org/lwjgl/opengl/Win32ContextImplementation.java trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java trunk/LWJGL/src/java/org/lwjgl/opengl/Win32DisplayPeerInfo.java trunk/LWJGL/src/java/org/lwjgl/opengl/Win32PbufferPeerInfo.java trunk/LWJGL/src/java/org/lwjgl/opengl/Win32PeerInfo.java trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Registry.java trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Win32ContextImplementation.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Win32DisplayPeerInfo.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Win32PeerInfo.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Win32Registry.c trunk/LWJGL/src/native/windows/win32_al.c Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-12 18:10:43 UTC (rev 2498) +++ trunk/LWJGL/build.xml 2006-07-12 18:32:58 UTC (rev 2499) @@ -524,14 +524,14 @@ <class name="org.lwjgl.opengl.WindowsDirectInputDevice8" /> <class name="org.lwjgl.opengl.WindowsDirectInput3" /> <class name="org.lwjgl.opengl.WindowsDirectInputDevice3" /> - <class name="org.lwjgl.opengl.Win32PbufferPeerInfo" /> - <class name="org.lwjgl.opengl.Win32Display" /> - <class name="org.lwjgl.opengl.Win32Registry" /> + <class name="org.lwjgl.opengl.WindowsPbufferPeerInfo" /> + <class name="org.lwjgl.opengl.WindowsDisplay" /> + <class name="org.lwjgl.opengl.WindowsRegistry" /> <class name="org.lwjgl.NativeSysImplementation" /> - <class name="org.lwjgl.opengl.Win32AWTGLCanvasPeerInfo" /> - <class name="org.lwjgl.opengl.Win32PeerInfo" /> - <class name="org.lwjgl.opengl.Win32DisplayPeerInfo" /> - <class name="org.lwjgl.opengl.Win32ContextImplementation" /> + <class name="org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo" /> + <class name="org.lwjgl.opengl.WindowsPeerInfo" /> + <class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" /> + <class name="org.lwjgl.opengl.WindowsContextImplementation" /> </javah> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes"> Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2006-07-12 18:10:43 UTC (rev 2498) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2006-07-12 18:32:58 UTC (rev 2499) @@ -89,7 +89,7 @@ class_name = "org.lwjgl.opengl.LinuxCanvasImplementation"; break; case LWJGLUtil.PLATFORM_WINDOWS: - class_name = "org.lwjgl.opengl.Win32CanvasImplementation"; + class_name = "org.lwjgl.opengl.WindowsCanvasImplementation"; break; case LWJGLUtil.PLATFORM_MACOSX: class_name = "org.lwjgl.opengl.MacOSXCanvasImplementation"; Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java 2006-07-12 18:10:43 UTC (rev 2498) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Context.java 2006-07-12 18:32:58 UTC (rev 2499) @@ -79,7 +79,7 @@ class_name = "org.lwjgl.opengl.LinuxContextImplementation"; break; case LWJGLUtil.PLATFORM_WINDOWS: - class_name = "org.lwjgl.opengl.Win32ContextImplementation"; + class_name = "org.lwjgl.opengl.WindowsContextImplementation"; break; case LWJGLUtil.PLATFORM_MACOSX: class_name = "org.lwjgl.opengl.MacOSXContextImplementation"; Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2006-07-12 18:10:43 UTC (rev 2498) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2006-07-12 18:32:58 UTC (rev 2499) @@ -144,7 +144,7 @@ class_name = "org.lwjgl.opengl.LinuxDisplay"; break; case LWJGLUtil.PLATFORM_WINDOWS: - class_name = "org.lwjgl.opengl.Win32Display"; + class_name = "org.lwjgl.opengl.WindowsDisplay"; break; case LWJGLUtil.PLATFORM_MACOSX: class_name = "org.lwjgl.opengl.MacOSXDisplay"; Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/Win32AWTGLCanvasPeerInfo.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Win32AWTGLCanvasPeerInfo.java 2006-07-12 18:10:43 UTC (rev 2498) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Win32AWTGLCanvasPeerInfo.java 2006-07-12 18:32:58 UTC (rev 2499) @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002-2004 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; - -import java.nio.ByteBuffer; - -import org.lwjgl.LWJGLException; - -/** - * - * @author elias_naur <eli...@us...> - * @version $Revision$ - * $Id$ - */ -final class Win32AWTGLCanvasPeerInfo extends Win32PeerInfo { - private final AWTGLCanvas canvas; - private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); - private final PixelFormat pixel_format; - private boolean has_pixel_format= false; - - public Win32AWTGLCanvasPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) { - this.canvas = canvas; - this.pixel_format = pixel_format; - } - - protected void doLockAndInitHandle() throws LWJGLException { - nInitHandle(awt_surface.lockAndGetHandle(canvas), getHandle()); - if (!has_pixel_format) { - // If we haven't applied a pixel format yet, do it now - choosePixelFormat(canvas.getX(), canvas.getY(), pixel_format, null, true, true, false, true); - has_pixel_format = true; - } - } - private static native void nInitHandle(ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException; - - protected void doUnlock() throws LWJGLException { - awt_surface.unlock(); - } -} Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/Win32CanvasImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Win32CanvasImplementation.java 2006-07-12 18:10:43 UTC (rev 2498) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Win32CanvasImplementation.java 2006-07-12 18:32:58 UTC (rev 2499) @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2002-2004 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; - -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; -import java.awt.Toolkit; -import java.security.PrivilegedAction; -import java.security.AccessController; - -import org.lwjgl.LWJGLException; -import org.lwjgl.LWJGLUtil; - -/** - * - * @author elias_naur <eli...@us...> - * @version $Revision$ - * $Id$ - */ -final class Win32CanvasImplementation implements AWTCanvasImplementation { - static { - // Make sure the awt stuff is properly initialised (the jawt library in particular) - Toolkit.getDefaultToolkit(); - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - try { - System.loadLibrary("jawt"); - } catch (UnsatisfiedLinkError e) { - /* It is probably already loaded, potentially by a different ClassLoader - * so just log the exception and continue - */ - LWJGLUtil.log("Failed to load jawt: " + e.getMessage()); - } - return null; - } - }); - } - - public PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException { - return new Win32AWTGLCanvasPeerInfo(canvas, pixel_format); - } - - /** - * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. - * - * @return The GraphicsConfiguration corresponding to a visual that matches the pixel format. - */ - public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { - /* - * It seems like the best way is to simply return null and - * use SetPixelFormat in JNI later. - */ - return null; - } -} Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/Win32ContextImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Win32ContextImplementation.java 2006-07-12 18:10:43 UTC (rev 2498) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Win32ContextImplementation.java 2006-07-12 18:32:58 UTC (rev 2499) @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2002-2004 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; - -import java.nio.ByteBuffer; - -import org.lwjgl.LWJGLException; - -/** - * - * @author elias_naur <eli...@us...> - * @version $Revision$ - * $Id$ - */ -final class Win32ContextImplementation implements ContextImplementation { - public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException { - ByteBuffer peer_handle = peer_info.lockAndGetHandle(); - try { - return nCreate(peer_handle, shared_context_handle); - } finally { - peer_info.unlock(); - } - } - private static native ByteBuffer nCreate(ByteBuffer peer_handle, ByteBuffer shared_context_handle) throws LWJGLException; - - public void swapBuffers() throws LWJGLException { - Context current_context = Context.getCurrentContext(); - if (current_context == null) - throw new IllegalStateException("No context is current"); - synchronized (current_context) { - PeerInfo current_peer_info = current_context.getPeerInfo(); - ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); - try { - nSwapBuffers(peer_handle); - } finally { - current_peer_info.unlock(); - } - } - } - private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException; - - public void releaseDrawable(ByteBuffer context_handle) throws LWJGLException { - } - - public void update(ByteBuffer context_handle) { - } - - public void releaseCurrentContext() throws LWJGLException { - nReleaseCurrentContext(); - } - private static native void nReleaseCurrentContext() throws LWJGLException; - - public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { - ByteBuffer peer_handle = peer_info.lockAndGetHandle(); - try { - nMakeCurrent(peer_handle, handle); - } finally { - peer_info.unlock(); - } - } - private static native void nMakeCurrent(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException; - - public boolean isCurrent(ByteBuffer handle) throws LWJGLException { - boolean result = nIsCurrent(handle); - return result; - } - private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; - - public void setSwapInterval(int value) { - Context current_context = Context.getCurrentContext(); - if (current_context == null) - throw new IllegalStateException("No context is current"); - synchronized (current_context) { - nSetSwapInterval(current_context.getHandle(), value); - } - } - private static native void nSetSwapInterval(ByteBuffer context_handle, int value); - - public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { - nDestroy(handle); - } - private static native void nDestroy(ByteBuffer context_handle) throws LWJGLException; -} Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java 2006-07-12 18:10:43 UTC (rev 2498) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java 2006-07-12 18:32:58 UTC (rev 2499) @@ -1,590 +0,0 @@ -/* - * Copyright (c) 2002-2004 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 Display implementation interface. Display delegates - * to implementors of this interface. There is one DisplayImplementation - * for each supported platform. - * @author elias_naur - */ - -import java.nio.ByteBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; - -import org.lwjgl.LWJGLException; -import org.lwjgl.LWJGLUtil; -import org.lwjgl.input.Cursor; - -final class Win32Display implements DisplayImplementation { - private final static int GAMMA_LENGTH = 256; - private final static int WM_MOUSEMOVE = 0x0200; - private final static int WM_LBUTTONDOWN = 0x0201; - private final static int WM_LBUTTONUP = 0x0202; - private final static int WM_LBUTTONDBLCLK = 0x0203; - private final static int WM_RBUTTONDOWN = 0x0204; - private final static int WM_RBUTTONUP = 0x0205; - private final static int WM_RBUTTONDBLCLK = 0x0206; - private final static int WM_MBUTTONDOWN = 0x0207; - private final static int WM_MBUTTONUP = 0x0208; - private final static int WM_MBUTTONDBLCLK = 0x0209; - private final static int WM_MOUSEWHEEL = 0x020A; - - private final static int WM_QUIT = 0x0012; - private final static int WM_SYSCOMMAND = 0x0112; - private final static int WM_PAINT = 0x000F; - - private final static int SC_SIZE = 0xF000; - private final static int SC_MOVE = 0xF010; - private final static int SC_MINIMIZE = 0xF020; - private final static int SC_MAXIMIZE = 0xF030; - private final static int SC_NEXTWINDOW = 0xF040; - private final static int SC_PREVWINDOW = 0xF050; - private final static int SC_CLOSE = 0xF060; - private final static int SC_VSCROLL = 0xF070; - private final static int SC_HSCROLL = 0xF080; - private final static int SC_MOUSEMENU = 0xF090; - private final static int SC_KEYMENU = 0xF100; - private final static int SC_ARRANGE = 0xF110; - private final static int SC_RESTORE = 0xF120; - private final static int SC_TASKLIST = 0xF130; - private final static int SC_SCREENSAVE = 0xF140; - private final static int SC_HOTKEY = 0xF150; - private final static int SC_DEFAULT = 0xF160; - private final static int SC_MONITORPOWER = 0xF170; - private final static int SC_CONTEXTHELP = 0xF180; - private final static int SC_SEPARATOR = 0xF00F; - - private final static int SM_CXCURSOR = 13; - - private final static int SIZE_RESTORED = 0; - private final static int SIZE_MINIMIZED = 1; - private final static int SIZE_MAXIMIZED = 2; - private final static int WM_SIZE = 0x0005; - private final static int WM_ACTIVATE = 0x0006; - private final static int WA_INACTIVE = 0; - private final static int WA_ACTIVE = 1; - private final static int WA_CLICKACTIVE = 2; - private final static int SW_SHOWMINNOACTIVE = 7; - private final static int SW_RESTORE = 9; - - private static Win32Display current_display; - - private Win32DisplayPeerInfo peer_info; - - private WindowsKeyboard keyboard; - private WindowsMouse mouse; - - private boolean close_requested; - private boolean is_dirty; - - private ByteBuffer current_gamma; - private ByteBuffer saved_gamma; - private DisplayMode current_mode; - - private boolean mode_set; - private boolean isFullscreen; - private boolean isMinimized; - private boolean isFocused; - private boolean did_maximize; - private boolean inAppActivate; - - public Win32Display() { - current_display = this; - } - - public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException { - close_requested = false; - is_dirty = false; - isFullscreen = fullscreen; - isMinimized = false; - isFocused = false; - did_maximize = false; - nCreateWindow(mode, fullscreen, x, y); - peer_info.initDC(); - } - private native void nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException; - - public void destroyWindow() { - nDestroyWindow(); - if (isFullscreen) - resetCursorClipping(); - } - private static native void nDestroyWindow(); - private static native void resetCursorClipping(); - private static native void setupCursorClipping(long hwnd) throws LWJGLException; - - public void switchDisplayMode(DisplayMode mode) throws LWJGLException { - nSwitchDisplayMode(mode); - current_mode = mode; - mode_set = true; - } - private static native void nSwitchDisplayMode(DisplayMode mode) throws LWJGLException; - - /* - * Called when the application is alt-tabbed to or from - */ - private void appActivate(boolean active) { - if (inAppActivate) { - return; - } - inAppActivate = true; - isFocused = active; - if (active) { - if (isFullscreen) { - restoreDisplayMode(); - } - showWindow(getHwnd(), SW_RESTORE); - setForegroundWindow(getHwnd()); - setFocus(getHwnd()); - did_maximize = true; - } else if (isFullscreen) { - showWindow(getHwnd(), SW_SHOWMINNOACTIVE); - resetDisplayMode(); - } - inAppActivate = false; - } - private static native void showWindow(long hwnd, int mode); - private static native void setForegroundWindow(long hwnd); - private static native void setFocus(long hwnd); - - private void restoreDisplayMode() { - try { - doSetGammaRamp(current_gamma); - } catch (LWJGLException e) { - LWJGLUtil.log("Failed to restore gamma: " + e.getMessage()); - } - - if (!mode_set) { - mode_set = true; - try { - nSwitchDisplayMode(current_mode); - } catch (LWJGLException e) { - LWJGLUtil.log("Failed to restore display mode: " + e.getMessage()); - } - } - } - - public void resetDisplayMode() { - try { - doSetGammaRamp(saved_gamma); - } catch (LWJGLException e) { - LWJGLUtil.log("Failed to reset gamma ramp: " + e.getMessage()); - } - current_gamma = saved_gamma; - if (mode_set) { - mode_set = false; - nResetDisplayMode(); - } - resetCursorClipping(); - } - private static native void nResetDisplayMode(); - - public int getGammaRampLength() { - return GAMMA_LENGTH; - } - - public void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException { - doSetGammaRamp(convertToNativeRamp(gammaRamp)); - } - private static native ByteBuffer convertToNativeRamp(FloatBuffer gamma_ramp) throws LWJGLException; - private static native ByteBuffer getCurrentGammaRamp() throws LWJGLException; - - private void doSetGammaRamp(ByteBuffer native_gamma) throws LWJGLException { - nSetGammaRamp(native_gamma); - current_gamma = native_gamma; - } - private static native void nSetGammaRamp(ByteBuffer native_ramp) throws LWJGLException; - - public String getAdapter() { - try { - String adapter_string = Win32Registry.queryRegistrationKey( - Win32Registry.HKEY_LOCAL_MACHINE, - "HARDWARE\\DeviceMap\\Video", - "\\Device\\Video0"); - String root_key = "\\registry\\machine\\"; - if (adapter_string.toLowerCase().startsWith(root_key)) { - String driver_value = Win32Registry.queryRegistrationKey( - Win32Registry.HKEY_LOCAL_MACHINE, - adapter_string.substring(root_key.length()), - "InstalledDisplayDrivers"); - return driver_value; - } - } catch (LWJGLException e) { - LWJGLUtil.log("Exception occurred while querying registry: " + e); - } - return null; - } - - public String getVersion() { - String driver = getAdapter(); - if (driver != null) - return nGetVersion(driver); - else - return null; - } - private native String nGetVersion(String driver); - - public DisplayMode init() throws LWJGLException { - current_gamma = saved_gamma = getCurrentGammaRamp(); - return current_mode = getCurrentDisplayMode(); - } - private static native DisplayMode getCurrentDisplayMode() throws LWJGLException; - - public native void setTitle(String title); - - public boolean isCloseRequested() { - boolean saved = close_requested; - close_requested = false; - return saved; - } - - public boolean isVisible() { - return !isMinimized; - } - - public boolean isActive() { - return isFocused; - } - - public boolean isDirty() { - boolean saved = is_dirty; - is_dirty = false; - return saved; - } - - public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { - peer_info = new Win32DisplayPeerInfo(pixel_format); - return peer_info; - } - public void update() { - nUpdate(); - if (did_maximize) { - did_maximize = false; - /** - * WORKAROUND: - * Making the context current (redundantly) when the window - * is maximized helps some gfx recover from fullscreen - */ - try { - if (Display.getContext().isCurrent()) - Display.getContext().makeCurrent(); - } catch (LWJGLException e) { - LWJGLUtil.log("Exception occurred while trying to make context current: " + e); - } - } - } - private static native void nUpdate(); - - public void reshape(int x, int y, int width, int height) { - if (!isFullscreen) - nReshape(getHwnd(), x, y, width, height); - } - private static native void nReshape(long hwnd, int x, int y, int width, int height); - public native DisplayMode[] getAvailableDisplayModes() throws LWJGLException; - - /* Mouse */ - public boolean hasWheel() { - return mouse.hasWheel(); - } - - public int getButtonCount() { - return mouse.getButtonCount(); - } - - public void createMouse() throws LWJGLException { - mouse = new WindowsMouse(createDirectInput(), getHwnd()); - } - - public void destroyMouse() { - mouse.destroy(); - mouse = null; - } - - public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) { - update(); - mouse.poll(coord_buffer, buttons); - } - - public void readMouse(ByteBuffer buffer) { - update(); - mouse.read(buffer); - } - - public void grabMouse(boolean grab) { - mouse.grab(grab); - } - - public int getNativeCursorCapabilities() { - return Cursor.CURSOR_ONE_BIT_TRANSPARENCY; - } - - public void setCursorPosition(int x, int y) { - nSetCursorPosition(x, y, isFullscreen); - } - private static native void nSetCursorPosition(int x, int y, boolean fullscreen); - - public native void setNativeCursor(Object handle) throws LWJGLException; - - public int getMinCursorSize() { - return getSystemMetrics(SM_CXCURSOR); - } - - public int getMaxCursorSize() { - return getSystemMetrics(SM_CXCURSOR); - } - - public native int getSystemMetrics(int index); - - private static native long getDllInstance(); - private static native long getHwnd(); - - /* Keyboard */ - public void createKeyboard() throws ... [truncated message content] |
|
From: <eli...@us...> - 2006-07-14 08:32:44
|
Revision: 2509 Author: elias_naur Date: 2006-07-14 01:32:01 -0700 (Fri, 14 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2509&view=rev Log Message: ----------- Added a Controllers applet test Modified Paths: -------------- trunk/LWJGL/applet/applet.html trunk/LWJGL/build.xml trunk/LWJGL/libs/jinput.jar Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/test/applet/ControllersTest.java Modified: trunk/LWJGL/applet/applet.html =================================================================== --- trunk/LWJGL/applet/applet.html 2006-07-13 18:56:19 UTC (rev 2508) +++ trunk/LWJGL/applet/applet.html 2006-07-14 08:32:01 UTC (rev 2509) @@ -1,6 +1,6 @@ <html> <body> - <applet code="org.lwjgl.test.applet.AppletTest" archive="lwjgl_applet.jar,lwjgl_util_applet.jar,lwjgl.jar,res.jar,lwjgl_util.jar,lwjgl_fmod3.jar,lwjgl_devil.jar,natives.jar" width="640" height="480"> + <applet code="org.lwjgl.test.applet.AppletTest" archive="lwjgl_applet.jar,lwjgl_util_applet.jar,lwjgl.jar,res.jar,lwjgl_util.jar,lwjgl_fmod3.jar,lwjgl_devil.jar,natives.jar,jinput.jar" width="640" height="480"> <param name="test" value="org.lwjgl.test.applet.OpenGL"> </applet> </body> Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-13 18:56:19 UTC (rev 2508) +++ trunk/LWJGL/build.xml 2006-07-14 08:32:01 UTC (rev 2509) @@ -359,7 +359,7 @@ <condition property="native_path" value="libs/macosx"> <os name="Mac OS X" /> </condition> - <java classname="${test.mainclass}" classpath="${lwjgl.lib}/lwjgl.jar:${lwjgl.lib}/lwjgl_util.jar:${lwjgl.lib}/lwjgl_test.jar" fork="true"> + <java classname="${test.mainclass}" classpath="${lwjgl.lib}/lwjgl.jar:${lwjgl.lib}/lwjgl_util.jar:${lwjgl.lib}/lwjgl_test.jar:${lwjgl.lib}/jinput.jar" fork="true"> <jvmarg value="-Dorg.lwjgl.util.Debug=true"/> <jvmarg value="-Djava.library.path=${native_path}"/> </java> @@ -416,10 +416,12 @@ <copy file="${lwjgl.lib}/lwjgl_util.jar" todir="applet"/> <copy file="${lwjgl.lib}/lwjgl_fmod3.jar" todir="applet"/> <copy file="${lwjgl.lib}/lwjgl_devil.jar" todir="applet"/> + <copy file="${lwjgl.lib}/jinput.jar" todir="applet"/> <zip destfile="applet/res.jar"> <zipfileset dir="${lwjgl.res}" includes="Footsteps.wav, ILtest.tga, Missing_you.mod"/> </zip> <signjar jar="applet/lwjgl.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> + <signjar jar="applet/jinput.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> <signjar jar="applet/lwjgl_util_applet.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> <signjar jar="applet/lwjgl_fmod3.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> <signjar jar="applet/lwjgl_devil.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> Modified: trunk/LWJGL/libs/jinput.jar =================================================================== (Binary files differ) Added: trunk/LWJGL/src/java/org/lwjgl/test/applet/ControllersTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/applet/ControllersTest.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/test/applet/ControllersTest.java 2006-07-14 08:32:01 UTC (rev 2509) @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2006 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.test.applet; + +import java.awt.Canvas; + +import org.lwjgl.LWJGLException; +import org.lwjgl.input.Controllers; + +public class ControllersTest extends Canvas implements Test { + public void start() { + try { + Controllers.create(); + } catch (LWJGLException e) { + e.printStackTrace(); + return; + } + System.out.println("Controllers.getControllerCount() = " + Controllers.getControllerCount()); + } + + public void stop() { + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-07-15 19:45:57
|
Revision: 2521 Author: elias_naur Date: 2006-07-15 12:45:36 -0700 (Sat, 15 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2521&view=rev Log Message: ----------- Windows: Moved NativeSysImplementation.java to WindowsSysImplementation.java and moved some native code to java. Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/src/java/org/lwjgl/Sys.java trunk/LWJGL/src/java/org/lwjgl/test/DisplayTest.java trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java Removed Paths: ------------- trunk/LWJGL/src/java/org/lwjgl/NativeSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/Win32SysImplementation.java Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-15 19:25:13 UTC (rev 2520) +++ trunk/LWJGL/build.xml 2006-07-15 19:45:36 UTC (rev 2521) @@ -514,7 +514,7 @@ <class name="org.lwjgl.opengl.WindowsPbufferPeerInfo" /> <class name="org.lwjgl.opengl.WindowsDisplay" /> <class name="org.lwjgl.opengl.WindowsRegistry" /> - <class name="org.lwjgl.NativeSysImplementation" /> + <class name="org.lwjgl.WindowsSysImplementation" /> <class name="org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo" /> <class name="org.lwjgl.opengl.WindowsPeerInfo" /> <class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" /> Deleted: trunk/LWJGL/src/java/org/lwjgl/NativeSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/NativeSysImplementation.java 2006-07-15 19:25:13 UTC (rev 2520) +++ trunk/LWJGL/src/java/org/lwjgl/NativeSysImplementation.java 2006-07-15 19:45:36 UTC (rev 2521) @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2004 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; - -/** - * A SysImplementation that uses native calls only. - * <p> - * @author $Author$ - * @version $Revision$ - * $Id$ - */ -class NativeSysImplementation extends DefaultSysImplementation { - - static { - Sys.initialize(); - } - - public native long getTimerResolution(); - - public native long getTime(); - - public native void alert(String title, String message); - - public native boolean openURL(String url); - - public native String getClipboard(); -} Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-07-15 19:25:13 UTC (rev 2520) +++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-07-15 19:45:36 UTC (rev 2521) @@ -57,7 +57,7 @@ private static final String VERSION = "1.0beta2"; /** Current version of the JNI library */ - static final int JNI_VERSION = 2; + static final int JNI_VERSION = 3; /** The implementation instance to delegate platform specific behavior to */ private final static SysImplementation implementation; @@ -114,7 +114,7 @@ class_name = "org.lwjgl.LinuxSysImplementation"; break; case LWJGLUtil.PLATFORM_WINDOWS: - class_name = "org.lwjgl.Win32SysImplementation"; + class_name = "org.lwjgl.WindowsSysImplementation"; break; case LWJGLUtil.PLATFORM_MACOSX: class_name = "org.lwjgl.MacOSXSysImplementation"; Deleted: trunk/LWJGL/src/java/org/lwjgl/Win32SysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Win32SysImplementation.java 2006-07-15 19:25:13 UTC (rev 2520) +++ trunk/LWJGL/src/java/org/lwjgl/Win32SysImplementation.java 2006-07-15 19:45:36 UTC (rev 2521) @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2002-2004 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; - -/** - * <p> - * Win32 SysImplementation. This is just a straightforward NativsSysImplementation. - * </p> - * @author $Author$ - * @version $Revision$ - * $Id$ - */ -class Win32SysImplementation extends NativeSysImplementation { -} Copied: trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java (from rev 2520, trunk/LWJGL/src/java/org/lwjgl/NativeSysImplementation.java) =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/WindowsSysImplementation.java 2006-07-15 19:45:36 UTC (rev 2521) @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2002-2004 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; + +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; +import java.security.PrivilegedActionException; + +/** + * <p> + * @author $Author$ + * @version $Revision$ + * $Id$ + */ +class WindowsSysImplementation extends DefaultSysImplementation { + static { + Sys.initialize(); + } + + public long getTimerResolution() { + return 1000; + } + + public native long getTime(); + + public native void alert(String title, String message); + + public boolean openURL(final String url) { + try { + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + Runtime.getRuntime().exec(new String[]{"rundll32", "url.dll,FileProtocolHandler", url}); + return null; + } + }); + return true; + } catch (PrivilegedActionException e) { + LWJGLUtil.log("Failed to open url (" + url + "): " + e.getCause().getMessage()); + return false; + } + } + + public native String getClipboard(); +} Modified: trunk/LWJGL/src/java/org/lwjgl/test/DisplayTest.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/test/DisplayTest.java 2006-07-15 19:25:13 UTC (rev 2520) +++ trunk/LWJGL/src/java/org/lwjgl/test/DisplayTest.java 2006-07-15 19:45:36 UTC (rev 2521) @@ -69,6 +69,7 @@ System.out.println("Info about current:"); System.out.println("Graphics card: " + Display.getAdapter() + ", version: " + Display.getVersion()); +System.exit(1); System.out.println("Resolution: " + Display.getDisplayMode().getWidth() + "x" + Display.getDisplayMode().getHeight() + "x" + Modified: trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c =================================================================== --- trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c 2006-07-15 19:25:13 UTC (rev 2520) +++ trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c 2006-07-15 19:45:36 UTC (rev 2521) @@ -41,48 +41,21 @@ #include "Window.h" #include "mmsystem.h" -#include "org_lwjgl_NativeSysImplementation.h" +#include "org_lwjgl_WindowsSysImplementation.h" #include "common_tools.h" #include <malloc.h> -/* - * Class: org_lwjgl_Sys - * Method: getTimerResolution - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_lwjgl_NativeSysImplementation_getTimerResolution - (JNIEnv * env, jobject ignored) -{ - return (jlong) 1000L; -} - -/* - * Class: org_lwjgl_Sys - * Method: ngetTime - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_lwjgl_NativeSysImplementation_getTime - (JNIEnv * env, jobject ignored) -{ - - MMRESULT result; +JNIEXPORT jlong JNICALL Java_org_lwjgl_WindowsSysImplementation_getTime(JNIEnv * env, jobject ignored) { DWORD time; - result = timeBeginPeriod(1); + timeBeginPeriod(1); time = timeGetTime(); - result = timeEndPeriod(1); + timeEndPeriod(1); return time; } -/* - * Class: org_lwjgl_Sys - * Method: alert - * Signature: (Ljava/lang/String;Ljava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_NativeSysImplementation_alert - (JNIEnv * env, jobject ignored, jstring title, jstring message) -{ +JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_alert(JNIEnv * env, jobject ignored, jstring title, jstring message) { char * eMessageText = GetStringNativeChars(env, message); char * cTitleBarText = GetStringNativeChars(env, title); MessageBox(getCurrentHWND(), eMessageText, cTitleBarText, MB_OK | MB_TOPMOST); @@ -93,56 +66,7 @@ free(cTitleBarText); } -/* - * Class: org_lwjgl_Sys - * Method: openURL - * Signature: (Ljava/lang/String;)V - */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_NativeSysImplementation_openURL - (JNIEnv * env, jobject ignored, jstring url) -{ -#define BUFFER_SIZE 1024 - const char *std_args = "rundll32 url.dll,FileProtocolHandler "; - STARTUPINFO si; - PROCESS_INFORMATION pi; - - char * urlString = GetStringNativeChars(env, url); - - char command[BUFFER_SIZE]; - strncpy_s(command, BUFFER_SIZE, "", 1); - strncat_s(command, BUFFER_SIZE, std_args, _TRUNCATE); - strncat_s(command, BUFFER_SIZE, urlString, _TRUNCATE); - free(urlString); - - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); - - // Start the child process. - if( !CreateProcess( NULL, // No module name (use command line). - command, // Command line. - NULL, // Process handle not inheritable. - NULL, // Thread handle not inheritable. - FALSE, // Set handle inheritance to FALSE. - 0, // No creation flags. - NULL, // Use parent's environment block. - NULL, // Use parent's starting directory. - &si, // Pointer to STARTUPINFO structure. - &pi ) // Pointer to PROCESS_INFORMATION structure. - ) - { - printfDebugJava(env, "Failed to open URL %s", urlString); - return JNI_FALSE; - } - - // Close process and thread handles. - CloseHandle( pi.hProcess ); - CloseHandle( pi.hThread ); - - return JNI_TRUE; -} - -JNIEXPORT jstring JNICALL Java_org_lwjgl_NativeSysImplementation_getClipboard +JNIEXPORT jstring JNICALL Java_org_lwjgl_WindowsSysImplementation_getClipboard (JNIEnv * env, jobject ignored) { // Check to see if there's text available in the clipboard This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sp...@us...> - 2006-07-25 15:31:50
|
Revision: 2536 Author: spasi Date: 2006-07-25 08:31:16 -0700 (Tue, 25 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2536&view=rev Log Message: ----------- Added SGIS_generate_mipmap & SGIS_texture_lod extensions Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c Added Paths: ----------- trunk/LWJGL/src/generated/org/lwjgl/opengl/SGISGenerateMipmap.java trunk/LWJGL/src/generated/org/lwjgl/opengl/SGISTextureLOD.java trunk/LWJGL/src/templates/org/lwjgl/opengl/SGIS_generate_mipmap.java trunk/LWJGL/src/templates/org/lwjgl/opengl/SGIS_texture_lod.java Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-22 21:30:31 UTC (rev 2535) +++ trunk/LWJGL/build.xml 2006-07-25 15:31:16 UTC (rev 2536) @@ -15,7 +15,7 @@ <property name="lwjgl.res" location="res" /> <property name="lwjgl.version" value="1.0beta2" /> - <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java"/> + <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java"/> <!-- ================================================================== --> <!-- Filesets used for targets --> <!-- ================================================================== --> Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java 2006-07-22 21:30:31 UTC (rev 2535) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java 2006-07-25 15:31:16 UTC (rev 2536) @@ -1,24 +1,24 @@ -/* MACHINE GENERATED FILE, DO NOT EDIT */ - -package org.lwjgl.opengl; - -import org.lwjgl.LWJGLException; -import org.lwjgl.BufferChecks; -import java.nio.*; - -public final class ATITextFragmentShader { - /** - * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, - * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, - * and GetDoublev, and by the <target> parameter of ProgramStringARB, - * BindProgramARB, ProgramEnvParameter4{d,dv,f,fv}ARB, - * ProgramLocalParameter4{d,dv,f,fv}ARB, - * GetProgramEnvParameter{dv,fv}ARB, GetProgramLocalParameter{dv,fv}ARB, - * GetProgramivARB, GetProgramfvATI, and GetProgramStringARB. - */ - public static final int GL_TEXT_FRAGMENT_SHADER_ATI = 0x8200; - - private ATITextFragmentShader() { - } - -} +/* MACHINE GENERATED FILE, DO NOT EDIT */ + +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.BufferChecks; +import java.nio.*; + +public final class ATITextFragmentShader { + /** + * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, + * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev, and by the <target> parameter of ProgramStringARB, + * BindProgramARB, ProgramEnvParameter4{d,dv,f,fv}ARB, + * ProgramLocalParameter4{d,dv,f,fv}ARB, + * GetProgramEnvParameter{dv,fv}ARB, GetProgramLocalParameter{dv,fv}ARB, + * GetProgramivARB, GetProgramfvATI, and GetProgramStringARB. + */ + public static final int GL_TEXT_FRAGMENT_SHADER_ATI = 0x8200; + + private ATITextFragmentShader() { + } + +} Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java 2006-07-22 21:30:31 UTC (rev 2535) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java 2006-07-25 15:31:16 UTC (rev 2536) @@ -144,6 +144,8 @@ public final boolean GL_NV_vertex_program2; public final boolean GL_NV_vertex_program2_option; public final boolean GL_NV_vertex_program3; + public final boolean GL_SGIS_generate_mipmap; + public final boolean GL_SGIS_texture_lod; public final boolean GL_SUN_slice_accum; long ARB_buffer_object_glBindBufferARB_pointer; @@ -2398,6 +2400,8 @@ this.GL_NV_vertex_program2 = supported_extensions.contains("GL_NV_vertex_program2"); this.GL_NV_vertex_program2_option = supported_extensions.contains("GL_NV_vertex_program2_option"); this.GL_NV_vertex_program3 = supported_extensions.contains("GL_NV_vertex_program3"); + this.GL_SGIS_generate_mipmap = supported_extensions.contains("GL_SGIS_generate_mipmap"); + this.GL_SGIS_texture_lod = supported_extensions.contains("GL_SGIS_texture_lod"); this.GL_SUN_slice_accum = supported_extensions.contains("GL_SUN_slice_accum"); } } Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java 2006-07-22 21:30:31 UTC (rev 2535) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java 2006-07-25 15:31:16 UTC (rev 2536) @@ -1,35 +1,35 @@ -/* MACHINE GENERATED FILE, DO NOT EDIT */ - -package org.lwjgl.opengl; - -import org.lwjgl.LWJGLException; -import org.lwjgl.BufferChecks; -import java.nio.*; - -public final class EXTTimerQuery { - /** - * Accepted by the <target> parameter of BeginQuery, EndQuery, and - * GetQueryiv: - */ - public static final int GL_TIME_ELAPSED_EXT = 0x88bf; - - private EXTTimerQuery() { - } - - - public static void glGetQueryObjectEXT(int id, int pname, LongBuffer params) { - long function_pointer = GLContext.getCapabilities().EXT_timer_query_glGetQueryObjecti64vEXT_pointer; - BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 1); - nglGetQueryObjecti64vEXT(id, pname, params, params.position(), function_pointer); - } - private static native void nglGetQueryObjecti64vEXT(int id, int pname, LongBuffer params, int params_position, long function_pointer); - - public static void glGetQueryObjectuEXT(int id, int pname, LongBuffer params) { - long function_pointer = GLContext.getCapabilities().EXT_timer_query_glGetQueryObjectui64vEXT_pointer; - BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 1); - nglGetQueryObjectui64vEXT(id, pname, params, params.position(), function_pointer); - } - private static native void nglGetQueryObjectui64vEXT(int id, int pname, LongBuffer params, int params_position, long function_pointer); -} +/* MACHINE GENERATED FILE, DO NOT EDIT */ + +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.BufferChecks; +import java.nio.*; + +public final class EXTTimerQuery { + /** + * Accepted by the <target> parameter of BeginQuery, EndQuery, and + * GetQueryiv: + */ + public static final int GL_TIME_ELAPSED_EXT = 0x88bf; + + private EXTTimerQuery() { + } + + + public static void glGetQueryObjectEXT(int id, int pname, LongBuffer params) { + long function_pointer = GLContext.getCapabilities().EXT_timer_query_glGetQueryObjecti64vEXT_pointer; + BufferChecks.checkFunctionAddress(function_pointer); + BufferChecks.checkBuffer(params, 1); + nglGetQueryObjecti64vEXT(id, pname, params, params.position(), function_pointer); + } + private static native void nglGetQueryObjecti64vEXT(int id, int pname, LongBuffer params, int params_position, long function_pointer); + + public static void glGetQueryObjectuEXT(int id, int pname, LongBuffer params) { + long function_pointer = GLContext.getCapabilities().EXT_timer_query_glGetQueryObjectui64vEXT_pointer; + BufferChecks.checkFunctionAddress(function_pointer); + BufferChecks.checkBuffer(params, 1); + nglGetQueryObjectui64vEXT(id, pname, params, params.position(), function_pointer); + } + private static native void nglGetQueryObjectui64vEXT(int id, int pname, LongBuffer params, int params_position, long function_pointer); +} Added: trunk/LWJGL/src/generated/org/lwjgl/opengl/SGISGenerateMipmap.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/SGISGenerateMipmap.java (rev 0) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/SGISGenerateMipmap.java 2006-07-25 15:31:16 UTC (rev 2536) @@ -0,0 +1,24 @@ +/* MACHINE GENERATED FILE, DO NOT EDIT */ + +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.BufferChecks; +import java.nio.*; + +public final class SGISGenerateMipmap { + /** + * Accepted by the <pname> parameter of TexParameteri, TexParameterf, + * TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv. + */ + public static final int GL_GENERATE_MIPMAP_SGIS = 0x8191; + /** + * Accepted by the <target> parameter of Hint, and by the <pname> + * parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev. + */ + public static final int GL_GENERATE_MIPMAP_HINT_SGIS = 0x8192; + + private SGISGenerateMipmap() { + } + +} Added: trunk/LWJGL/src/generated/org/lwjgl/opengl/SGISTextureLOD.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/SGISTextureLOD.java (rev 0) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/SGISTextureLOD.java 2006-07-25 15:31:16 UTC (rev 2536) @@ -0,0 +1,22 @@ +/* MACHINE GENERATED FILE, DO NOT EDIT */ + +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.BufferChecks; +import java.nio.*; + +public final class SGISTextureLOD { + /** + * Accepted by the <pname> parameter of TexParameteri, TexParameterf, + * TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv. + */ + public static final int GL_TEXTURE_MIN_LOD_SGIS = 0x813a; + public static final int GL_TEXTURE_MAX_LOD_SGIS = 0x813b; + public static final int GL_TEXTURE_BASE_LEVEL_SGIS = 0x813c; + public static final int GL_TEXTURE_MAX_LEVEL_SGIS = 0x813d; + + private SGISTextureLOD() { + } + +} Modified: trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c =================================================================== --- trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c 2006-07-22 21:30:31 UTC (rev 2535) +++ trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c 2006-07-25 15:31:16 UTC (rev 2536) @@ -1,20 +1,20 @@ -/* MACHINE GENERATED FILE, DO NOT EDIT */ - -#include <jni.h> -#include "extgl.h" - -typedef void (APIENTRY *glGetQueryObjecti64vEXTPROC) (GLuint id, GLenum pname, GLint64EXT * params); -typedef void (APIENTRY *glGetQueryObjectui64vEXTPROC) (GLuint id, GLenum pname, GLuint64EXT * params); - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTimerQuery_nglGetQueryObjecti64vEXT(JNIEnv *env, jclass clazz, jint id, jint pname, jobject params, jint params_position, jlong function_pointer) { - GLint64EXT *params_address = ((GLint64EXT *)(*env)->GetDirectBufferAddress(env, params)) + params_position; - glGetQueryObjecti64vEXTPROC glGetQueryObjecti64vEXT = (glGetQueryObjecti64vEXTPROC)((intptr_t)function_pointer); - glGetQueryObjecti64vEXT(id, pname, params_address); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTimerQuery_nglGetQueryObjectui64vEXT(JNIEnv *env, jclass clazz, jint id, jint pname, jobject params, jint params_position, jlong function_pointer) { - GLuint64EXT *params_address = ((GLuint64EXT *)(*env)->GetDirectBufferAddress(env, params)) + params_position; - glGetQueryObjectui64vEXTPROC glGetQueryObjectui64vEXT = (glGetQueryObjectui64vEXTPROC)((intptr_t)function_pointer); - glGetQueryObjectui64vEXT(id, pname, params_address); -} - +/* MACHINE GENERATED FILE, DO NOT EDIT */ + +#include <jni.h> +#include "extgl.h" + +typedef void (APIENTRY *glGetQueryObjecti64vEXTPROC) (GLuint id, GLenum pname, GLint64EXT * params); +typedef void (APIENTRY *glGetQueryObjectui64vEXTPROC) (GLuint id, GLenum pname, GLuint64EXT * params); + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTimerQuery_nglGetQueryObjecti64vEXT(JNIEnv *env, jclass clazz, jint id, jint pname, jobject params, jint params_position, jlong function_pointer) { + GLint64EXT *params_address = ((GLint64EXT *)(*env)->GetDirectBufferAddress(env, params)) + params_position; + glGetQueryObjecti64vEXTPROC glGetQueryObjecti64vEXT = (glGetQueryObjecti64vEXTPROC)((intptr_t)function_pointer); + glGetQueryObjecti64vEXT(id, pname, params_address); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTimerQuery_nglGetQueryObjectui64vEXT(JNIEnv *env, jclass clazz, jint id, jint pname, jobject params, jint params_position, jlong function_pointer) { + GLuint64EXT *params_address = ((GLuint64EXT *)(*env)->GetDirectBufferAddress(env, params)) + params_position; + glGetQueryObjectui64vEXTPROC glGetQueryObjectui64vEXT = (glGetQueryObjectui64vEXTPROC)((intptr_t)function_pointer); + glGetQueryObjectui64vEXT(id, pname, params_address); +} + Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/SGIS_generate_mipmap.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/SGIS_generate_mipmap.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/SGIS_generate_mipmap.java 2006-07-25 15:31:16 UTC (rev 2536) @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2004 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; + +import org.lwjgl.util.generator.*; + +public interface SGIS_generate_mipmap { + + /** + * Accepted by the <pname> parameter of TexParameteri, TexParameterf, + * TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv. + */ + int GL_GENERATE_MIPMAP_SGIS = 0x8191; + + /** + * Accepted by the <target> parameter of Hint, and by the <pname> + * parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev. + */ + int GL_GENERATE_MIPMAP_HINT_SGIS = 0x8192; + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/SGIS_texture_lod.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/SGIS_texture_lod.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/SGIS_texture_lod.java 2006-07-25 15:31:16 UTC (rev 2536) @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002-2004 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; + +import org.lwjgl.util.generator.*; + +@Extension(postfix = "SGIS", className = "SGISTextureLOD") +public interface SGIS_texture_lod { + + /** + * Accepted by the <pname> parameter of TexParameteri, TexParameterf, + * TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv. + */ + int GL_TEXTURE_MIN_LOD_SGIS = 0x813A; + int GL_TEXTURE_MAX_LOD_SGIS = 0x813B; + int GL_TEXTURE_BASE_LEVEL_SGIS = 0x813C; + int GL_TEXTURE_MAX_LEVEL_SGIS = 0x813D; +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-08-01 14:10:22
|
Revision: 2542 Author: elias_naur Date: 2006-08-01 07:10:17 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2542&view=rev Log Message: ----------- Mac OS X: Build fixes Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/platform_build/macosx_ant/build.xml Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-08-01 13:55:19 UTC (rev 2541) +++ trunk/LWJGL/build.xml 2006-08-01 14:10:17 UTC (rev 2542) @@ -711,7 +711,7 @@ <target name="-compile_native_macosx" if="lwjgl.platform.macosx"> <ant antfile="platform_build/macosx_ant/build.xml" inheritAll="false"/> - <copy file="${lwjgl.bin}/liblwjgl.jnilib" todir="${lwjgl.lib}/macosx"/> + <copy file="${lwjgl.bin}/lwjgl/liblwjgl.jnilib" todir="${lwjgl.lib}/macosx"/> </target> <!-- Compiles LWJGL on Mac OS X platforms --> Modified: trunk/LWJGL/platform_build/macosx_ant/build.xml =================================================================== --- trunk/LWJGL/platform_build/macosx_ant/build.xml 2006-08-01 13:55:19 UTC (rev 2541) +++ trunk/LWJGL/platform_build/macosx_ant/build.xml 2006-08-01 14:10:17 UTC (rev 2542) @@ -29,11 +29,11 @@ </target> <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 -framework AppKit -framework JavaVM -framework Carbon"/> + <apply dir="." 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 -framework AppKit -framework JavaVM -framework Carbon"/> <fileset dir="${objdir}" includes="*.o"/> </apply> - <apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true"> + <apply dir="." executable="strip" os="Mac OS X" failonerror="true"> <arg line="-S -X"/> <fileset dir="." file="${libname}"/> </apply> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-08-10 08:45:50
|
Revision: 2547 Author: elias_naur Date: 2006-08-10 01:45:10 -0700 (Thu, 10 Aug 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2547&view=rev Log Message: ----------- Update to beta3 Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/src/java/org/lwjgl/Sys.java trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java trunk/LWJGL/src/native/common/devil/extil.c trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-08-10 08:16:03 UTC (rev 2546) +++ trunk/LWJGL/build.xml 2006-08-10 08:45:10 UTC (rev 2547) @@ -13,7 +13,7 @@ <property name="lwjgl.docs" location="doc" /> <property name="lwjgl.temp" location="temp" /> <property name="lwjgl.res" location="res" /> - <property name="lwjgl.version" value="1.0beta2" /> + <property name="lwjgl.version" value="1.0beta3" /> <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java"/> <!-- ================================================================== --> Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-08-10 08:16:03 UTC (rev 2546) +++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-08-10 08:45:10 UTC (rev 2547) @@ -54,7 +54,7 @@ private static final String JNI_LIBRARY_NAME = "lwjgl"; /** Current version of library */ - private static final String VERSION = "1.0beta2"; + private static final String VERSION = "1.0beta3"; /** Current version of the JNI library */ static final int JNI_VERSION = 3; Modified: trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java 2006-08-10 08:16:03 UTC (rev 2546) +++ trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java 2006-08-10 08:45:10 UTC (rev 2547) @@ -53,7 +53,7 @@ private static String JNI_LIBRARY_NAME = "lwjgl-devil"; /** Version of IL */ - public static final String VERSION = "1.0beta2"; + public static final String VERSION = "1.0beta3"; private static void loadLibrary(final String lib_name) { AccessController.doPrivileged(new PrivilegedAction() { Modified: trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2006-08-10 08:16:03 UTC (rev 2546) +++ trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2006-08-10 08:45:10 UTC (rev 2547) @@ -193,7 +193,7 @@ private static String JNI_LIBRARY_NAME = "lwjgl-fmod3"; /** Version of FMOD */ - public static final String VERSION = "1.0beta2"; + public static final String VERSION = "1.0beta3"; static { initialize(); Modified: trunk/LWJGL/src/native/common/devil/extil.c =================================================================== --- trunk/LWJGL/src/native/common/devil/extil.c 2006-08-10 08:16:03 UTC (rev 2546) +++ trunk/LWJGL/src/native/common/devil/extil.c 2006-08-10 08:45:10 UTC (rev 2547) @@ -8,7 +8,7 @@ static void* devILhandle; #endif -static const char* VERSION = "1.0beta2"; +static const char* VERSION = "1.0beta3"; /* * Class: org_lwjgl_devil_ILNative Modified: trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c =================================================================== --- trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c 2006-08-10 08:16:03 UTC (rev 2546) +++ trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c 2006-08-10 08:45:10 UTC (rev 2547) @@ -33,7 +33,7 @@ #include "org_lwjgl_fmod3_FMOD.h" #include "extfmod3.h" -static const char* VERSION = "1.0beta2"; +static const char* VERSION = "1.0beta3"; /* * Class: org_lwjgl_fmod3_FMOD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <eli...@us...> - 2006-10-24 09:52:26
|
Revision: 2599
http://svn.sourceforge.net/java-game-lib/?rev=2599&view=rev
Author: elias_naur
Date: 2006-10-24 02:52:12 -0700 (Tue, 24 Oct 2006)
Log Message:
-----------
Linux: Moved more event handling logic to java
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxEvent.c
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2006-10-24 08:33:09 UTC (rev 2598)
+++ trunk/LWJGL/build.xml 2006-10-24 09:52:12 UTC (rev 2599)
@@ -494,6 +494,7 @@
<target name="headers" description="invokes javah on java classes" depends="compile">
<!-- platform specific classes -->
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes">
+ <class name="org.lwjgl.opengl.LinuxEvent" />
<class name="org.lwjgl.opengl.LinuxMouse" />
<class name="org.lwjgl.opengl.LinuxKeyboard" />
<class name="org.lwjgl.opengl.LinuxDisplay" />
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-24 08:33:09 UTC (rev 2598)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2006-10-24 09:52:12 UTC (rev 2599)
@@ -82,11 +82,15 @@
private static int display_connection_usage_count = 0;
+ /** Event buffer */
+ private final LinuxEvent event_buffer = new LinuxEvent();
+
/** Current mode swithcing API */
private int current_displaymode_extension = NONE;
/** Atom used for the pointer warp messages */
private long warp_atom;
+ private long delete_atom;
private PeerInfo peer_info;
@@ -268,8 +272,8 @@
}
}
- private static native long openDisplay() throws LWJGLException;
- private static native void closeDisplay(long display);
+ static native long openDisplay() throws LWJGLException;
+ static native void closeDisplay(long display);
private int getWindowMode(boolean fullscreen) throws LWJGLException {
if (fullscreen) {
@@ -552,6 +556,7 @@
lockAWT();
try {
warp_atom = getWarpAtom();
+ delete_atom = internAtom("WM_DELETE_WINDOW", false);
current_displaymode_extension = getBestDisplayModeExtension();
if (current_displaymode_extension == NONE)
throw new LWJGLException("No display mode extension is available");
@@ -629,18 +634,56 @@
return peer_info;
}
+ private void processEvents() {
+ while (LinuxEvent.getPending(getDisplay()) > 0) {
+ event_buffer.nextEvent(getDisplay());
+ long event_window = event_buffer.getWindow();
+ if (event_window != getWindow())
+ continue;
+ if (event_buffer.filterEvent(event_window))
+ continue;
+ switch (event_buffer.getType()) {
+ case LinuxEvent.ClientMessage:
+ if (event_buffer.getClientMessageType() == warp_atom) {
+ handleWarpEvent(event_buffer.getClientData(0), event_buffer.getClientData(1));
+ } else if ((event_buffer.getClientFormat() == 32) && (event_buffer.getClientData(0) == delete_atom))
+ handleCloseEvent();
+ break;
+ case LinuxEvent.MapNotify:
+ handleMapNotifyEvent();
+ break;
+ case LinuxEvent.UnmapNotify:
+ handleUnmapNotifyEvent();
+ break;
+ case LinuxEvent.Expose:
+ handleExposeEvent();
+ break;
+ case LinuxEvent.ButtonPress: /* Fall through */
+ case LinuxEvent.ButtonRelease:
+ handleButtonEvent(event_buffer.getButtonTime(), event_buffer.getButtonType(), event_buffer.getButtonButton(), event_buffer.getButtonState());
+ break;
+ case LinuxEvent.MotionNotify:
+ handlePointerMotionEvent(event_buffer.getButtonTime(), event_buffer.getButtonRoot(), event_buffer.getButtonXRoot(), event_buffer.getButtonYRoot(), event_buffer.getButtonX(), event_buffer.getButtonY(), event_buffer.getButtonState());
+ break;
+ case LinuxEvent.KeyPress: /* Fall through */
+ case LinuxEvent.KeyRelease:
+ handleKeyEvent(event_buffer.getKeyAddress(), event_buffer.getKeyTime(), event_buffer.getKeyType(), event_buffer.getKeyKeyCode(), event_buffer.getKeyState());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
public void update() {
lockAWT();
try {
- nUpdate(getDisplay(), getWindow(), warp_atom);
+ processEvents();
checkInput();
- } catch (LWJGLException e) {
- LWJGLUtil.log("Caught exception while processing messages: " + e);
} finally {
unlockAWT();
}
}
- private native void nUpdate(long display, long window, long warp_atom) throws LWJGLException;
public void reshape(int x, int y, int width, int height) {
lockAWT();
@@ -1023,7 +1066,6 @@
private static native void nSetWindowIcon(long display, long window, ByteBuffer icon, int icons_size, int width, int height);
- /* Callbacks from nUpdate() */
private void handleButtonEvent(long millis, int type, int button, int state) {
if (mouse != null)
mouse.handleButtonEvent(grab, millis, type, (byte)button);
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java 2006-10-24 09:52:12 UTC (rev 2599)
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2002-2004 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;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Wrapper class for X11 events.
+ *
+ * @author elias_naur <eli...@us...>
+ * @version $Revision: 2286 $
+ * $Id: LinuxPeerInfo.java 2286 2006-03-23 19:32:21Z matzon $
+ */
+final class LinuxEvent {
+ public final static int KeyPress = 2;
+ public final static int KeyRelease = 3;
+ public final static int ButtonPress = 4;
+ public final static int ButtonRelease = 5;
+ public final static int MotionNotify = 6;
+ public final static int UnmapNotify = 18;
+ public final static int MapNotify = 19;
+ public final static int Expose = 12;
+ public final static int ClientMessage = 33;
+
+ private final ByteBuffer event_buffer;
+
+ public LinuxEvent() {
+ this.event_buffer = createEventBuffer();
+ }
+ private static native ByteBuffer createEventBuffer();
+
+ public final static native int getPending(long display);
+
+ public final boolean filterEvent(long window) {
+ return nFilterEvent(event_buffer, window);
+ }
+ private static native boolean nFilterEvent(ByteBuffer event_buffer, long window);
+
+ public final void nextEvent(long display) {
+ nNextEvent(display, event_buffer);
+ }
+ private static native void nNextEvent(long display, ByteBuffer event_buffer);
+
+ public final int getType() {
+ return nGetType(event_buffer);
+ }
+ private static native int nGetType(ByteBuffer event_buffer);
+
+ public final long getWindow() {
+ return nGetWindow(event_buffer);
+ }
+ private static native long nGetWindow(ByteBuffer event_buffer);
+
+ /* ClientMessage methods */
+
+ public final long getClientMessageType() {
+ return nGetClientMessageType(event_buffer);
+ }
+ private static native long nGetClientMessageType(ByteBuffer event_buffer);
+
+ public final int getClientData(int index) {
+ return nGetClientData(event_buffer, index);
+ }
+ private static native int nGetClientData(ByteBuffer event_buffer, int index);
+
+ public final int getClientFormat() {
+ return nGetClientFormat(event_buffer);
+ }
+ private static native int nGetClientFormat(ByteBuffer event_buffer);
+
+ /* Button methods */
+
+ public final long getButtonTime() {
+ return nGetButtonTime(event_buffer);
+ }
+ private static native long nGetButtonTime(ByteBuffer event_buffer);
+
+ public final int getButtonState() {
+ return nGetButtonState(event_buffer);
+ }
+ private static native int nGetButtonState(ByteBuffer event_buffer);
+
+ public final int getButtonType() {
+ return nGetButtonType(event_buffer);
+ }
+ private static native int nGetButtonType(ByteBuffer event_buffer);
+
+ public final int getButtonButton() {
+ return nGetButtonButton(event_buffer);
+ }
+ private static native int nGetButtonButton(ByteBuffer event_buffer);
+
+ public final long getButtonRoot() {
+ return nGetButtonRoot(event_buffer);
+ }
+ private static native long nGetButtonRoot(ByteBuffer event_buffer);
+
+ public final int getButtonXRoot() {
+ return nGetButtonXRoot(event_buffer);
+ }
+ private static native int nGetButtonXRoot(ByteBuffer event_buffer);
+
+ public final int getButtonYRoot() {
+ return nGetButtonYRoot(event_buffer);
+ }
+ private static native int nGetButtonYRoot(ByteBuffer event_buffer);
+
+ public final int getButtonX() {
+ return nGetButtonX(event_buffer);
+ }
+ private static native int nGetButtonX(ByteBuffer event_buffer);
+
+ public final int getButtonY() {
+ return nGetButtonY(event_buffer);
+ }
+ private static native int nGetButtonY(ByteBuffer event_buffer);
+
+ /* Key methods */
+
+ public final long getKeyAddress() {
+ return nGetKeyAddress(event_buffer);
+ }
+ private static native int nGetKeyAddress(ByteBuffer event_buffer);
+
+ public final long getKeyTime() {
+ return nGetKeyTime(event_buffer);
+ }
+ private static native int nGetKeyTime(ByteBuffer event_buffer);
+
+ public final int getKeyType() {
+ return nGetKeyType(event_buffer);
+ }
+ private static native int nGetKeyType(ByteBuffer event_buffer);
+
+ public final int getKeyKeyCode() {
+ return nGetKeyKeyCode(event_buffer);
+ }
+ private static native int nGetKeyKeyCode(ByteBuffer event_buffer);
+
+ public final int getKeyState() {
+ return nGetKeyState(event_buffer);
+ }
+ private static native int nGetKeyState(ByteBuffer event_buffer);
+}
Modified: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2006-10-24 08:33:09 UTC (rev 2598)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c 2006-10-24 09:52:12 UTC (rev 2599)
@@ -69,7 +69,6 @@
static GLXWindow glx_window = None;
-static Atom delete_atom;
static Colormap cmap;
static int current_depth;
static Pixmap current_icon_pixmap;
@@ -158,73 +157,6 @@
return window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY;
}
-static void handleMessages(JNIEnv *env, jobject disp_obj, Display *disp, Window window, Atom warp_atom) {
- XEvent event;
- jclass disp_class = (*env)->GetObjectClass(env, disp_obj);
- if (disp_class == NULL)
- return;
- jmethodID handleKeyEvent_method = (*env)->GetMethodID(env, disp_class, "handleKeyEvent", "(JJIII)V");
- if (handleKeyEvent_method == NULL)
- return;
- jmethodID handleButtonEvent_method = (*env)->GetMethodID(env, disp_class, "handleButtonEvent", "(JIII)V");
- if (handleButtonEvent_method == NULL)
- return;
- jmethodID handlePointerMotionEvent_method = (*env)->GetMethodID(env, disp_class, "handlePointerMotionEvent", "(JJIIIII)V");
- if (handlePointerMotionEvent_method == NULL)
- return;
- jmethodID handleWarpEvent_method = (*env)->GetMethodID(env, disp_class, "handleWarpEvent", "(II)V");
- if (handleWarpEvent_method == NULL)
- return;
- jmethodID handleMapNotifyEvent_method = (*env)->GetMethodID(env, disp_class, "handleMapNotifyEvent", "()V");
- if (handleMapNotifyEvent_method == NULL)
- return;
- jmethodID handleUnmapNotifyEvent_method = (*env)->GetMethodID(env, disp_class, "handleUnmapNotifyEvent", "()V");
- if (handleUnmapNotifyEvent_method == NULL)
- return;
- jmethodID handleExposeEvent_method = (*env)->GetMethodID(env, disp_class, "handleExposeEvent", "()V");
- if (handleExposeEvent_method == NULL)
- return;
- jmethodID handleCloseEvent_method = (*env)->GetMethodID(env, disp_class, "handleCloseEvent", "()V");
- if (handleCloseEvent_method == NULL)
- return;
- while (!(*env)->ExceptionOccurred(env) && XPending(disp) > 0) {
- XNextEvent(disp, &event);
- if (XFilterEvent(&event, None) == True)
- continue;
- // Ignore events from old windows
- if (event.xany.window != window)
- continue;
- switch (event.type) {
- case ClientMessage:
- if (event.xclient.message_type == warp_atom) {
- (*env)->CallVoidMethod(env, disp_obj, handleWarpEvent_method, (jint)event.xclient.data.l[0], (jint)event.xclient.data.l[1]);
- } else if ((event.xclient.format == 32) && ((Atom)event.xclient.data.l[0] == delete_atom))
- (*env)->CallVoidMethod(env, disp_obj, handleCloseEvent_method);
- break;
- case MapNotify:
- (*env)->CallVoidMethod(env, disp_obj, handleMapNotifyEvent_method);
- break;
- case UnmapNotify:
- (*env)->CallVoidMethod(env, disp_obj, handleUnmapNotifyEvent_method);
- break;
- case Expose:
- (*env)->CallVoidMethod(env, disp_obj, handleExposeEvent_method);
- break;
- case ButtonPress: /* Fall through */
- case ButtonRelease:
- (*env)->CallVoidMethod(env, disp_obj, handleButtonEvent_method, (jlong)event.xbutton.time, (jint)event.xbutton.type, (jint)event.xbutton.button, (jint)event.xbutton.state);
- break;
- case MotionNotify:
- (*env)->CallVoidMethod(env, disp_obj, handlePointerMotionEvent_method, (jlong)event.xbutton.time, (jlong)event.xbutton.root, (jint)event.xbutton.x_root, (jint)event.xbutton.y_root, (jint)event.xbutton.x, (jint)event.xbutton.y, (jint)event.xbutton.state);
- break;
- case KeyPress:
- case KeyRelease:
- (*env)->CallVoidMethod(env, disp_obj, handleKeyEvent_method, (jlong)(intptr_t)&(event.xkey), (jlong)event.xkey.time, (jint)event.xkey.type, (jint)event.xkey.keycode, (jint)event.xkey.state);
- break;
- }
- }
-}
-
static void setWindowTitle(Display *disp, Window window, const char *title) {
XStoreName(disp, window, title);
}
@@ -356,7 +288,7 @@
size_hints->max_height = height;
XSetWMNormalHints(disp, win, size_hints);
XFree(size_hints);
- delete_atom = XInternAtom(disp, "WM_DELETE_WINDOW", False);
+ Atom delete_atom = XInternAtom(disp, "WM_DELETE_WINDOW", False);
XSetWMProtocols(disp, win, &delete_atom, 1);
if (window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM) {
Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False);
@@ -373,13 +305,6 @@
return win;
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUpdate(JNIEnv *env, jobject disp_obj, jlong display, jlong window_ptr, jlong warp_atom_ptr) {
- Display *disp = (Display *)(intptr_t)display;
- Window window = (Window)window_ptr;
- Atom warp_atom = (Atom)warp_atom_ptr;
- handleMessages(env, disp_obj, disp, window, warp_atom);
-}
-
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject mode, jint window_mode, jint x, jint y) {
Display *disp = (Display *)(intptr_t)display;
X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle);
Added: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxEvent.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxEvent.c (rev 0)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxEvent.c 2006-10-24 09:52:12 UTC (rev 2599)
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2002-2004 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: org_lwjgl_opengl_LinuxEvent.c 2598 2006-10-24 08:33:09Z elias_naur $
+ *
+ * @author elias_naur <eli...@us...>
+ * @version $Revision: 2598 $
+ */
+
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <jni.h>
+#include "common_tools.h"
+#include "org_lwjgl_opengl_LinuxEvent.h"
+
+JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxEvent_createEventBuffer(JNIEnv *env, jclass unused) {
+ return newJavaManagedByteBuffer(env, sizeof(XEvent));
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_getPending(JNIEnv *env, jclass unused, jlong display_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ return XPending(disp);
+}
+
+JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxEvent_nFilterEvent(JNIEnv *env, jclass unused, jobject event_buffer, jlong window_ptr) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ Window window = (Window)window_ptr;
+ return XFilterEvent(event, window) == True ? JNI_TRUE : JNI_FALSE;
+}
+
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxEvent_nNextEvent(JNIEnv *env, jclass unused, jlong display_ptr, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ XNextEvent(disp, event);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetType(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->type;
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetWindow(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xany.window;
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientMessageType(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xclient.message_type;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientData(JNIEnv *env, jclass unused, jobject event_buffer, jint index) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xclient.data.l[index];
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientFormat(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xclient.format;
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonTime(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xbutton.time;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonState(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xbutton.state;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonType(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xbutton.type;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonButton(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xbutton.button;
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonRoot(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xbutton.root;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonXRoot(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xbutton.x_root;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonYRoot(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xbutton.y_root;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonX(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xbutton.x;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonY(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xbutton.y;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyAddress(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return (jlong)(intptr_t)&(event->xkey);
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyTime(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xkey.time;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyType(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xkey.type;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyKeyCode(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xkey.keycode;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyState(JNIEnv *env, jclass unused, jobject event_buffer) {
+ XEvent *event = (XEvent *)(*env)->GetDirectBufferAddress(env, event_buffer);
+ return event->xkey.state;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-26 20:20:14
|
Revision: 2609
http://svn.sourceforge.net/java-game-lib/?rev=2609&view=rev
Author: elias_naur
Date: 2006-10-26 13:19:40 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Added org.lwjgl.opengl.AWTInputAdapter which enabled use of Mouse and
Keyboard with AWTGLCanvases. Programs can now avoid implementing AWT input processing and access the mouse grabbing features from both Display and AWTGLCanvas. See org.lwjgl.test.opengl.awt.AWTInputAdapterTest for an example.
Note: This commit is the linux and generic AWT imlementation and can still
change a lot while implementing windows and mac os x.
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/KeyboardEventQueue.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxPeerInfo.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxPeerInfo.c
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasInputImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTInputAdapter.java
trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractAWTInput.java
trunk/LWJGL/src/java/org/lwjgl/opengl/InputImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTInput.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTInputAdapterTest.java
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxAWTInput.c
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2006-10-26 19:41:15 UTC (rev 2608)
+++ trunk/LWJGL/build.xml 2006-10-26 20:19:40 UTC (rev 2609)
@@ -494,6 +494,7 @@
<target name="headers" description="invokes javah on java classes" depends="compile">
<!-- platform specific classes -->
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes">
+ <class name="org.lwjgl.opengl.LinuxAWTInput" />
<class name="org.lwjgl.opengl.LinuxEvent" />
<class name="org.lwjgl.opengl.LinuxMouse" />
<class name="org.lwjgl.opengl.LinuxKeyboard" />
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-10-26 19:41:15 UTC (rev 2608)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Keyboard.java 2006-10-26 20:19:40 UTC (rev 2609)
@@ -42,7 +42,7 @@
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.DisplayImplementation;
+import org.lwjgl.opengl.InputImplementation;
/**
* <br>
@@ -264,7 +264,7 @@
/** One time initialization */
private static boolean initialized;
- private static DisplayImplementation implementation;
+ private static InputImplementation implementation;
/**
* Keyboard cannot be constructed.
@@ -283,25 +283,33 @@
}
/**
- * "Create" the keyboard. The display must first have been created. The
- * reason for this is so the keyboard has a window to "focus" in.
+ * "Create" the keyboard with the given implementation. This is used
+ * reflectively from AWTInputAdapter.
*
* @throws LWJGLException if the keyboard could not be created for any reason
*/
- public static void create() throws LWJGLException {
- if (!Display.isCreated())
- throw new IllegalStateException("Display must be created before you can create Keyboard");
+ private static void create(InputImplementation impl) throws LWJGLException {
+ if (created)
+ throw new IllegalStateException("Destroy the Keyboard first.");
if (!initialized)
initialize();
- if (created)
- return;
- implementation = Mouse.getImplementation();
+ implementation = impl;
implementation.createKeyboard();
created = true;
readBuffer = ByteBuffer.allocate(EVENT_SIZE*BUFFER_SIZE);
reset();
}
+ /**
+ * "Create" the keyboard. The display must first have been created. The
+ * reason for this is so the keyboard has a window to "focus" in.
+ *
+ * @throws LWJGLException if the keyboard could not be created for any reason
+ */
+ public static void create() throws LWJGLException {
+ create(Mouse.createImplementation());
+ }
+
private static void reset() {
readBuffer.limit(0);
for (int i = 0; i < keyDownBuffer.remaining(); i++)
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-10-26 19:41:15 UTC (rev 2608)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Mouse.java 2006-10-26 20:19:40 UTC (rev 2609)
@@ -40,8 +40,8 @@
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
-import org.lwjgl.opengl.DisplayImplementation;
import org.lwjgl.opengl.Display;
+import org.lwjgl.opengl.InputImplementation;
import java.lang.reflect.Method;
import java.security.AccessController;
@@ -57,7 +57,7 @@
* n buttons supported, n being a native limit. A scrolly wheel is also
* supported, if one such is available. Movement is reported as delta from
* last position or as an absolute position. If the window has been created
- * the absolute position will be clamped to 0 - Display (width | height)
+ * the absolute position will be clamped to 0 - width | height.
*
* @author cix_foo <ci...@us...>
* @author elias_naur <eli...@us...>
@@ -134,10 +134,10 @@
private static boolean isGrabbed;
- private static DisplayImplementation implementation;
+ private static InputImplementation implementation;
- /** Whether we're running windows - which need to manually update cursor animation */
- private static final boolean isWindows = LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS;
+ /** Whether we're running windows - which need to manually update cursor animation */
+ private static final boolean isWindows = LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS;
/**
* Mouse cannot be constructed.
@@ -220,13 +220,19 @@
readBuffer.position(readBuffer.limit());
}
- static DisplayImplementation getImplementation() {
+ static InputImplementation getImplementation() {
+ return implementation;
+ }
+
+ static InputImplementation createImplementation() {
+ if (!Display.isCreated()) throw new IllegalStateException("Display must be created.");
+
/* Use reflection since we can't make Display.getImplementation
* public
*/
try {
- return (DisplayImplementation)AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws Exception{
+ return (InputImplementation)AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws Exception {
Method getImplementation_method = Display.class.getDeclaredMethod("getImplementation", null);
getImplementation_method.setAccessible(true);
return getImplementation_method.invoke(null, null);
@@ -238,19 +244,17 @@
}
/**
- * "Create" the mouse. The display must first have been created.
- * Initially, the mouse is not grabbed and the delta values are reported
- * with respect to the center of the display.
+ * "Create" the mouse with the given custom implementation. This is used
+ * reflectively by AWTInputAdapter.
*
* @throws LWJGLException if the mouse could not be created for any reason
*/
- public static void create() throws LWJGLException {
- if (!Display.isCreated()) throw new IllegalStateException("Display must be created prior to creating mouse");
-
+ private static void create(InputImplementation impl) throws LWJGLException {
+ if (created)
+ throw new IllegalStateException("Destroy the mouse first.");
if (!initialized)
initialize();
- if (created) return;
- implementation = getImplementation();
+ implementation = impl;
implementation.createMouse();
hasWheel = implementation.hasWheel();
created = true;
@@ -259,7 +263,7 @@
buttonCount = implementation.getButtonCount();
buttons = BufferUtils.createByteBuffer(buttonCount);
coord_buffer = BufferUtils.createIntBuffer(3);
- if (currentCursor != null)
+ if (currentCursor != null && implementation.getNativeCursorCapabilities() != 0)
setNativeCursor(currentCursor);
readBuffer = ByteBuffer.allocate(EVENT_SIZE * BUFFER_SIZE);
readBuffer.limit(0);
@@ -267,6 +271,17 @@
}
/**
+ * "Create" the mouse. The display must first have been created.
+ * Initially, the mouse is not grabbed and the delta values are reported
+ * with respect to the center of the display.
+ *
+ * @throws LWJGLException if the mouse could not be created for any reason
+ */
+ public static void create() throws LWJGLException {
+ create(createImplementation());
+ }
+
+ /**
* @return true if the mouse has been created
*/
public static boolean isCreated() {
@@ -327,8 +342,8 @@
x = poll_coord1;
y = poll_coord2;
}
- x = Math.min(Display.getDisplayMode().getWidth() - 1, Math.max(0, x));
- y = Math.min(Display.getDisplayMode().getHeight() - 1, Math.max(0, y));
+ x = Math.min(implementation.getWidth() - 1, Math.max(0, x));
+ y = Math.min(implementation.getHeight() - 1, Math.max(0, y));
dwheel += poll_dwheel;
read();
}
@@ -404,8 +419,8 @@
event_x = new_event_x;
event_y = new_event_y;
}
- event_x = Math.min(Display.getDisplayMode().getWidth() - 1, Math.max(0, event_x));
- event_y = Math.min(Display.getDisplayMode().getHeight() - 1, Math.max(0, event_y));
+ event_x = Math.min(implementation.getWidth() - 1, Math.max(0, event_x));
+ event_y = Math.min(implementation.getHeight() - 1, Math.max(0, event_y));
event_dwheel = readBuffer.getInt();
event_nanos = readBuffer.getLong();
return true;
@@ -476,8 +491,8 @@
}
/**
- * Retrieves the absolute position. If the Display has been created
- * x will be clamped to 0...width-1.
+ * Retrieves the absolute position. It will be clamped to
+ * 0...width-1.
*
* @return Absolute x axis position of mouse
*/
@@ -486,8 +501,8 @@
}
/**
- * Retrieves the absolute position. If the Display has been created
- * y will be clamped to 0...height-1.
+ * Retrieves the absolute position. It will be clamped to
+ * 0...height-1.
*
* @return Absolute y axis position of mouse
*/
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java 2006-10-26 19:41:15 UTC (rev 2608)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java 2006-10-26 20:19:40 UTC (rev 2609)
@@ -46,7 +46,7 @@
/**
* Return an opaque handle to the canvas peer information required to create a context from it.
*/
- public PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException;
+ PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException;
/**
* Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat.
@@ -54,5 +54,13 @@
* @return A GraphicsConfiguration matching the given GraphicsConfiguration and PixelFormat.
* @throws LWJGLException if no suitable configuration could be found.
*/
- public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException;
+ GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException;
+
+ /**
+ * Create an AWTCanvasInputImplementation for a specified AWTGLCanvas.
+ *
+ * @return A platform specific AWTCanvasInputImplementation.
+ * @param canvas An AWTGLCanvas
+ */
+ AWTCanvasInputImplementation createInput(AWTGLCanvas canvas) throws LWJGLException;
}
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasInputImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasInputImplementation.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasInputImplementation.java 2006-10-26 20:19:40 UTC (rev 2609)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2002-2006 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;
+
+import org.lwjgl.LWJGLException;
+
+/**
+ *
+ * @author elias_naur <eli...@us...>
+ * @version $Revision: 2286 $
+ * $Id: AWTCanvasImplementation.java 2286 2006-03-23 19:32:21Z matzon $
+ */
+interface AWTCanvasInputImplementation extends InputImplementation {
+ void processInput(PeerInfo peer_info);
+ void update();
+ void init();
+ void destroy();
+}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2006-10-26 19:41:15 UTC (rev 2608)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2006-10-26 20:19:40 UTC (rev 2609)
@@ -81,6 +81,9 @@
/** Tracks whether initGL() needs to be called */
private boolean first_run;
+ /** Track the input adapter, if any */
+ private volatile AWTCanvasInputImplementation awt_input;
+
static {
Sys.initialize();
String class_name;
@@ -109,7 +112,17 @@
}
}
+ /**
+ * Used from AWTInputAdapter
+ */
+ static AWTCanvasImplementation getImplementation() {
+ return implementation;
+ }
+ void setInput(AWTCanvasInputImplementation awt_input) {
+ this.awt_input = awt_input;
+ }
+
private void setUpdate() {
synchronized(SYNC_LOCK) {
update_context = true;
@@ -271,8 +284,9 @@
*/
public final void paint(Graphics g) {
try {
- if (peer_info == null)
+ if (peer_info == null) {
this.peer_info = implementation.createPeerInfo(this, pixel_format);
+ }
peer_info.lockAndGetHandle();
try {
if (context == null) {
@@ -288,6 +302,9 @@
context.update();
update_context = false;
}
+ AWTCanvasInputImplementation current_input = awt_input;
+ if (current_input != null)
+ current_input.processInput(peer_info);
if (first_run) {
first_run = false;
initGL();
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTInputAdapter.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTInputAdapter.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTInputAdapter.java 2006-10-26 20:19:40 UTC (rev 2609)
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2002-2006 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;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.input.Keyboard;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+
+import java.lang.reflect.Method;
+
+import java.awt.Canvas;
+
+/**
+ * This is the static class for using LWJGL input (Mouse and Keyboard)
+ * with an AWTGLCanvas.
+ *
+ * @author Elias Naur
+ * @version $Revision: 2286 $
+ * $Id: AWTCanvasImplementation.java 2286 2006-03-23 19:32:21Z matzon $
+ */
+public final class AWTInputAdapter {
+ private static AWTCanvasInputImplementation awt_input;
+
+ /**
+ * Create AWTInputAdapter with the specified AWTGLCanvas. Use
+ * update() to receive input.
+ *
+ * @param canvas The canvas to receive input from.
+ */
+ public static synchronized void create(AWTGLCanvas canvas) throws LWJGLException {
+ if (awt_input != null)
+ throw new IllegalStateException("You need to destroy() the adapter.");
+ awt_input = AWTGLCanvas.getImplementation().createInput(canvas);
+ // Invoke Mouse.create(awt_input) and Keyboard.create(awt_input)
+ try {
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ private void invokeCreate(Class input_class) throws Exception {
+ Method create_method = input_class.getDeclaredMethod("create", new Class[]{InputImplementation.class});
+ create_method.setAccessible(true);
+ create_method.invoke(null, new Object[]{awt_input});
+ }
+
+ public Object run() throws Exception {
+ invokeCreate(Mouse.class);
+ invokeCreate(Keyboard.class);
+ return null;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof LWJGLException)
+ throw (LWJGLException)cause;
+ else
+ throw new Error(cause);
+ }
+ awt_input.init();
+ }
+
+ public static synchronized void destroy() {
+ if (awt_input != null) {
+ awt_input.destroy();
+ awt_input = null;
+ }
+ }
+
+ public static synchronized void update() {
+ if (awt_input == null)
+ throw new IllegalStateException("You need to create() the adapter.");
+ awt_input.update();
+ Display.pollDevices();
+ }
+}
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractAWTInput.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractAWTInput.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractAWTInput.java 2006-10-26 20:19:40 UTC (rev 2609)
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2002-2004 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;
+
+import java.nio.IntBuffer;
+import java.nio.ByteBuffer;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+
+import java.awt.event.FocusListener;
+import java.awt.Cursor;
+
+/**
+ *
+ * @author elias_naur <eli...@us...>
+ * @version $Revision: 2586 $
+ * $Id: LinuxAWTGLCanvasPeerInfo.java 2586 2006-10-20 11:51:34Z elias_naur $
+ */
+abstract class AbstractAWTInput implements AWTCanvasInputImplementation {
+ private AWTGLCanvas canvas;
+
+ private volatile int current_height;
+ private volatile int current_width;
+ private KeyboardEventQueue keyboard_queue;
+ private MouseEventQueue mouse_queue;
+ private volatile boolean grab;
+
+ protected AbstractAWTInput(AWTGLCanvas canvas) throws LWJGLException {
+ this.canvas = canvas;
+ }
+
+ public synchronized void grabMouse(boolean grab) {
+ this.grab = grab;
+ if (mouse_queue != null)
+ mouse_queue.setGrabbed(grab);
+ }
+
+ protected boolean isGrabbed() {
+ return grab;
+ }
+
+ protected final AWTGLCanvas getCanvas() {
+ return canvas;
+ }
+
+ public final void init() {
+ canvas.setInput(this);
+ }
+
+ public synchronized void destroy() {
+ canvas.setInput(null);
+ canvas = null;
+ }
+
+ public final int getWidth() {
+ return current_width;
+ }
+
+ public final int getHeight() {
+ return current_height;
+ }
+
+ public synchronized void processInput(PeerInfo peer_info) {
+ current_width = canvas.getWidth();
+ current_height = canvas.getHeight();
+ }
+
+ public boolean hasWheel() {
+ return AWTUtil.hasWheel();
+ }
+
+ public int getButtonCount() {
+ return AWTUtil.getButtonCount();
+ }
+
+ public void createMouse() throws LWJGLException {
+ mouse_queue = new MouseEventQueue(canvas);
+ mouse_queue.register();
+ }
+
+ public void destroyMouse() {
+ mouse_queue.unregister();
+ }
+
+ public int getNativeCursorCapabilities() {
+ return AWTUtil.getNativeCursorCapabilities();
+ }
+
+ public void setCursorPosition(int x, int y) {
+ AWTUtil.setCursorPosition(canvas, x, y);
+ }
+
+ public void setNativeCursor(Object handle) throws LWJGLException {
+ canvas.setCursor((Cursor)handle);
+ }
+
+ public int getMinCursorSize() {
+ return AWTUtil.getMinCursorSize();
+ }
+
+ public int getMaxCursorSize() {
+ return AWTUtil.getMaxCursorSize();
+ }
+
+ public synchronized void createKeyboard() throws LWJGLException {
+ keyboard_queue = new KeyboardEventQueue(canvas);
+ keyboard_queue.register();
+ }
+
+ public synchronized void destroyKeyboard() {
+ if (keyboard_queue != null)
+ keyboard_queue.unregister();
+ }
+
+ public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
+ return AWTUtil.createCursor(width, height, xHotspot, yHotspot, numImages, images, delays);
+ }
+
+ public void destroyCursor(Object cursor_handle) {
+ }
+
+ public synchronized void readMouse(ByteBuffer buffer) {
+ mouse_queue.copyEvents(buffer);
+ }
+
+ public synchronized void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) {
+ mouse_queue.poll(coord_buffer, buttons);
+ }
+
+ public synchronized void readKeyboard(ByteBuffer buffer) {
+ keyboard_queue.copyEvents(buffer);
+ }
+
+ public synchronized void pollKeyboard(ByteBuffer keyDownBuffer) {
+ keyboard_queue.poll(keyDownBuffer);
+ }
+}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java 2006-10-26 19:41:15 UTC (rev 2608)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java 2006-10-26 20:19:40 UTC (rev 2609)
@@ -44,7 +44,7 @@
import org.lwjgl.LWJGLException;
-public interface DisplayImplementation {
+interface DisplayImplementation extends InputImplementation {
void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException;
@@ -124,88 +124,6 @@
*/
DisplayMode[] getAvailableDisplayModes() throws LWJGLException;
- /*
- * Mouse methods
- */
- /** Query of wheel support */
- boolean hasWheel();
-
- /** Query of button count */
- int getButtonCount();
-
- /**
- * Method to create the mouse.
- */
- void createMouse() throws LWJGLException;
-
- /**
- * Method the destroy the mouse
- */
- void destroyMouse();
-
- /**
- * Method to poll the mouse
- */
- void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons);
-
- /**
- * Method to read the keyboard buffer
- */
- void readMouse(ByteBuffer buffer);
-
- void grabMouse(boolean grab);
-
- /**
- * Function to determine native cursor support
- */
- int getNativeCursorCapabilities();
-
- /** Method to set the native cursor position */
- void setCursorPosition(int x, int y);
-
- /** Method to set the native cursor */
- void setNativeCursor(Object handle) throws LWJGLException;
-
- /** Method returning the minimum cursor size */
- int getMinCursorSize();
-
- /** Method returning the maximum cursor size */
- int getMaxCursorSize();
-
- /*
- * Keyboard methods
- */
-
- /**
- * Method to create the keyboard
- */
- void createKeyboard() throws LWJGLException;
-
- /**
- * Method to destroy the keyboard
- */
- void destroyKeyboard();
-
- /**
- * Method to poll the keyboard.
- *
- * @param keyDownBuffer the address of a 256-byte buffer to place
- * key states in.
- */
- void pollKeyboard(ByteBuffer keyDownBuffer);
-
- /**
- * Method to read the keyboard buffer
- */
- void readKeyboard(ByteBuffer buffer);
-
-// int isStateKeySet(int key);
-
- /** Native cursor handles */
- Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException;
-
- void destroyCursor(Object cursor_handle);
-
/* Pbuffer */
int getPbufferCapabilities();
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/InputImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/InputImplementation.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/InputImplementation.java 2006-10-26 20:19:40 UTC (rev 2609)
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2002-2004 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....
[truncated message content] |
|
From: <eli...@us...> - 2006-10-26 20:49:21
|
Revision: 2611
http://svn.sourceforge.net/java-game-lib/?rev=2611&view=rev
Author: elias_naur
Date: 2006-10-26 13:49:07 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Mac OS X: Moved mouse handling from MacOSXDisplay to MacOSXMouseEventQueue
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java
trunk/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.c
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2006-10-26 20:33:40 UTC (rev 2610)
+++ trunk/LWJGL/build.xml 2006-10-26 20:49:07 UTC (rev 2611)
@@ -524,6 +524,7 @@
</javah>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes">
+ <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: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2006-10-26 20:33:40 UTC (rev 2610)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2006-10-26 20:49:07 UTC (rev 2611)
@@ -69,7 +69,7 @@
private static final int GAMMA_LENGTH = 256;
private MacOSXFrame frame;
- private MouseEventQueue mouse_queue;
+ private MacOSXMouseEventQueue mouse_queue;
private KeyboardEventQueue keyboard_queue;
private java.awt.DisplayMode requested_mode;
@@ -256,20 +256,11 @@
GL11.glGetInteger(GL11.GL_VIEWPORT, current_viewport);
GL11.glViewport(current_viewport.get(0), current_viewport.get(1), current_viewport.get(2), current_viewport.get(3));
}
- if (frame.syncShouldWarpCursor()) {
- warpCursor();
+ if (frame.syncShouldWarpCursor() && mouse_queue != null) {
+ mouse_queue.warpCursor();
}
}
- private void warpCursor() {
- if (mouse_queue != null && mouse_queue.isGrabbed()) {
- Rectangle bounds = frame.syncGetBounds();
- int x = bounds.x + bounds.width/2;
- int y = bounds.y + bounds.height/2;
- nWarpCursor(x, y);
- }
- }
-
/**
* This is an interface to the native Carbon call
* SetSystemUIMode. It is used to hide the dock in a way
@@ -286,8 +277,6 @@
private native void nHideUI(boolean hide);
- native void getMouseDeltas(IntBuffer delta_buffer);
-
public void reshape(int x, int y, int width, int height) {
frame.resize(x, y, width, height);
}
@@ -323,14 +312,8 @@
public void grabMouse(boolean grab) {
mouse_queue.setGrabbed(grab);
- warpCursor();
- nGrabMouse(grab);
}
- private native void nWarpCursor(int x, int y);
-
- private native void nGrabMouse(boolean grab);
-
public int getNativeCursorCapabilities() {
return AWTUtil.getNativeCursorCapabilities();
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java 2006-10-26 20:33:40 UTC (rev 2610)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java 2006-10-26 20:49:07 UTC (rev 2611)
@@ -42,6 +42,7 @@
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.Component;
+import java.awt.Rectangle;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
@@ -55,16 +56,22 @@
super(component);
}
+ public void setGrabbed(boolean grab) {
+ super.setGrabbed(grab);
+ warpCursor();
+ nGrabMouse(grab);
+ }
+
protected void resetCursorToCenter() {
super.resetCursorToCenter();
/* Clear accumulated deltas */
- ((MacOSXDisplay)Display.getImplementation()).getMouseDeltas(delta_buffer);
+ getMouseDeltas(delta_buffer);
}
protected void updateDeltas(long nanos) {
super.updateDeltas(nanos);
synchronized ( this ) {
- ((MacOSXDisplay)Display.getImplementation()).getMouseDeltas(delta_buffer);
+ getMouseDeltas(delta_buffer);
int dx = delta_buffer.get(0);
int dy = -delta_buffer.get(1);
if ( dx != 0 || dy != 0 ) {
@@ -73,4 +80,19 @@
}
}
}
+
+ void warpCursor() {
+ if (isGrabbed()) {
+ Rectangle bounds = getComponent().getBounds();
+ int x = bounds.x + bounds.width/2;
+ int y = bounds.y + bounds.height/2;
+ nWarpCursor(x, y);
+ }
+ }
+
+ private static native void getMouseDeltas(IntBuffer delta_buffer);
+
+ private static native void nWarpCursor(int x, int y);
+
+ private static native void nGrabMouse(boolean grab);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java 2006-10-26 20:33:40 UTC (rev 2610)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MouseEventQueue.java 2006-10-26 20:49:07 UTC (rev 2611)
@@ -56,7 +56,6 @@
private boolean grabbed;
-
/** The accumulated mouse deltas returned by poll() */
private int accum_dx;
private int accum_dy;
@@ -93,6 +92,10 @@
component.removeMouseWheelListener(this);
}
+ protected Component getComponent() {
+ return component;
+ }
+
public synchronized void setGrabbed(boolean grabbed) {
this.grabbed = grabbed;
resetCursorToCenter();
Modified: trunk/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.c
===================================================================
--- trunk/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.c 2006-10-26 20:33:40 UTC (rev 2610)
+++ trunk/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.c 2006-10-26 20:49:07 UTC (rev 2611)
@@ -41,11 +41,12 @@
#include <jni.h>
#include <ApplicationServices/ApplicationServices.h>
+#include "org_lwjgl_opengl_MacOSXMouseEventQueue.h"
#include "common_tools.h"
static bool is_grabbed;
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGrabMouse(JNIEnv *env, jobject this, jboolean grab) {
+JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nGrabMouse(JNIEnv *env, jclass unused, jboolean grab) {
bool new_grabbed = grab == JNI_TRUE;
if (is_grabbed != new_grabbed) {
is_grabbed = new_grabbed;
@@ -57,14 +58,14 @@
}
}
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nWarpCursor(JNIEnv *env, jobject this, jint x, jint y) {
+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_MacOSXDisplay_getMouseDeltas(JNIEnv *env, jobject this, jobject delta_buffer) {
+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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-30 15:47:06
|
Revision: 2618
http://svn.sourceforge.net/java-game-lib/?rev=2618&view=rev
Author: elias_naur
Date: 2006-10-30 07:46:42 -0800 (Mon, 30 Oct 2006)
Log Message:
-----------
Windows: Implemented AWTInputAdapter.
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsPeerInfo.java
trunk/LWJGL/src/native/windows/context.h
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTInput.c
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2006-10-28 22:06:24 UTC (rev 2617)
+++ trunk/LWJGL/build.xml 2006-10-30 15:46:42 UTC (rev 2618)
@@ -508,6 +508,7 @@
</javah>
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows" force="yes">
+ <class name="org.lwjgl.opengl.WindowsAWTInput" />
<class name="org.lwjgl.opengl.WindowsKeyboard" />
<class name="org.lwjgl.opengl.WindowsDirectInput8" />
<class name="org.lwjgl.opengl.WindowsDirectInputDevice8" />
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java 2006-10-30 15:46:42 UTC (rev 2618)
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2002-2004 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;
+
+import java.nio.IntBuffer;
+import java.nio.ByteBuffer;
+
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+import org.lwjgl.BufferUtils;
+
+import java.awt.Cursor;
+import java.awt.Point;
+
+/**
+ *
+ * @author elias_naur <eli...@us...>
+ * @version $Revision: 2586 $
+ * $Id: LinuxAWTGLCanvasPeerInfo.java 2586 2006-10-20 11:51:34Z elias_naur $
+ */
+final class WindowsAWTInput extends AbstractAWTInput {
+ private final static int WS_CHILD = 0x40000000;
+ private final Cursor blank_cursor;
+ private Cursor cached_cursor;
+
+ private long cached_hwnd;
+ private WindowsMouse cached_mouse;
+ private boolean has_grabbed;
+
+ public WindowsAWTInput(AWTGLCanvas canvas) throws LWJGLException {
+ super(canvas);
+ int w = AWTUtil.getMinCursorSize();
+ int h = AWTUtil.getMinCursorSize();
+ blank_cursor = AWTUtil.createCursor(w, h, 0, 0, 1, BufferUtils.createIntBuffer(w*h), null);
+ }
+
+ public synchronized void destroy() {
+ super.destroy();
+ if (cached_mouse != null) {
+ grab(false);
+ cached_mouse.destroy();
+ }
+ }
+
+ public synchronized void processInput(PeerInfo peer_info) {
+ WindowsPeerInfo windows_peerinfo = (WindowsPeerInfo)peer_info;
+ long hwnd = windows_peerinfo.getHwnd();
+ try {
+ hwnd = findTopLevelWindow(hwnd);
+ if (cached_mouse == null || hwnd != cached_hwnd) {
+ has_grabbed = false;
+ cached_hwnd = hwnd;
+ if (cached_mouse != null)
+ cached_mouse.destroy();
+ cached_mouse = new WindowsMouse(WindowsDisplay.createDirectInput(), hwnd);
+ }
+ if (isGrabbed() && getCanvas().getCursor() != blank_cursor) {
+ cached_cursor = getCanvas().getCursor();
+ /**
+ * For some reason, DirectInput won't let us blank the cursor
+ * with the EXCLUSIVE access mode, so we'll work around it with a
+ * custom blank cursor
+ */
+ getCanvas().setCursor(blank_cursor);
+ }
+ grab(isGrabbed());
+ } catch (LWJGLException e) {
+ LWJGLUtil.log("Failed to create windows mouse: " + e);
+ }
+ }
+ private static native int getWindowStyles(long hwnd) throws LWJGLException;
+ private static native long getParentWindow(long hwnd);
+
+ private static long findTopLevelWindow(long hwnd) throws LWJGLException {
+ int window_styles = getWindowStyles(hwnd);
+ while ((window_styles & WS_CHILD) != 0) {
+ hwnd = getParentWindow(hwnd);
+ window_styles = getWindowStyles(hwnd);
+ }
+ return hwnd;
+ }
+
+ private void grab(boolean grab) {
+ if (has_grabbed != grab) {
+ cached_mouse.grab(grab);
+ has_grabbed = grab;
+ if (!grab)
+ getCanvas().setCursor(cached_cursor);
+ }
+ }
+
+ public synchronized void grabMouse(boolean grab) {
+ if (grab != isGrabbed()) {
+ super.grabMouse(grab);
+ /* Only ungrab since grabbing can only occur in processInput
+ * when the hwnd is guaranteed valid
+ */
+ if (cached_mouse != null && !grab)
+ grab(grab);
+ }
+ }
+
+ public void update() {
+ }
+
+ public synchronized void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) {
+ if (isGrabbed()) {
+ if (cached_mouse != null)
+ cached_mouse.poll(coord_buffer, buttons);
+ } else
+ super.pollMouse(coord_buffer, buttons);
+ }
+
+ public synchronized void readMouse(ByteBuffer buffer) {
+ if (isGrabbed()) {
+ if (cached_mouse != null)
+ cached_mouse.read(buffer);
+ } else
+ super.readMouse(buffer);
+ }
+}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java 2006-10-28 22:06:24 UTC (rev 2617)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java 2006-10-30 15:46:42 UTC (rev 2618)
@@ -66,7 +66,7 @@
}
public AWTCanvasInputImplementation createInput(AWTGLCanvas canvas) throws LWJGLException {
- throw new UnsupportedOperationException();
+ return new WindowsAWTInput(canvas);
}
public PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException {
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java 2006-10-28 22:06:24 UTC (rev 2617)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java 2006-10-30 15:46:42 UTC (rev 2618)
@@ -76,14 +76,14 @@
public void setDataFormat(int type) throws LWJGLException {
int ret = setDataFormat(di_device, type);
if (ret != WindowsDirectInput.DI_OK)
- throw new LWJGLException("Failed to set data format (" + ret + ")");
+ throw new LWJGLException("Failed to set data format (" + Integer.toHexString(ret) + ")");
}
protected abstract int setDataFormat(long di_device, int type);
public void setCooperateLevel(long hwnd, int flags) throws LWJGLException {
int ret = setCooperativeLevel(di_device, hwnd, flags);
if (ret != WindowsDirectInput.DI_OK)
- throw new LWJGLException("Failed to set cooperative level (" + ret + ")");
+ throw new LWJGLException("Failed to set cooperative level (" + Integer.toHexString(ret) + ")");
}
protected abstract int setCooperativeLevel(long di_device, long hwnd, int flags);
@@ -95,7 +95,7 @@
public void setBufferSize(int buffer_size) throws LWJGLException {
int ret = setBufferSize(di_device, buffer_size);
if (ret != WindowsDirectInput.DI_OK && ret != WindowsDirectInput.DI_PROPNOEFFECT && ret != WindowsDirectInput.DI_POLLEDDEVICE)
- throw new LWJGLException("Failed to set buffer size (" + ret + ")");
+ throw new LWJGLException("Failed to set buffer size (" + Integer.toHexString(ret) + ")");
int event_buffer_size = getEventSize()*buffer_size;
event_buffer = BufferUtils.createByteBuffer(event_buffer_size);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2006-10-28 22:06:24 UTC (rev 2617)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2006-10-30 15:46:42 UTC (rev 2618)
@@ -289,6 +289,7 @@
peer_info = new WindowsDisplayPeerInfo(pixel_format);
return peer_info;
}
+
public void update() {
nUpdate();
if (did_maximize) {
@@ -581,7 +582,7 @@
}
}
- private static WindowsDirectInput createDirectInput() throws LWJGLException {
+ static WindowsDirectInput createDirectInput() throws LWJGLException {
try {
return new WindowsDirectInput8(getDllInstance());
} catch (LWJGLException e) {
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsPeerInfo.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsPeerInfo.java 2006-10-28 22:06:24 UTC (rev 2617)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsPeerInfo.java 2006-10-30 15:46:42 UTC (rev 2618)
@@ -52,4 +52,9 @@
nChoosePixelFormat(getHandle(), origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, support_window, support_pbuffer, double_buffered);
}
private static native void nChoosePixelFormat(ByteBuffer peer_info_handle, int origin_x, int origin_y, PixelFormat pixel_format, IntBuffer pixel_format_caps, boolean use_hdc_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException;
+
+ public final long getHwnd() {
+ return nGetHwnd(getHandle());
+ }
+ private static native long nGetHwnd(ByteBuffer handle);
}
Modified: trunk/LWJGL/src/native/windows/context.h
===================================================================
--- trunk/LWJGL/src/native/windows/context.h 2006-10-28 22:06:24 UTC (rev 2617)
+++ trunk/LWJGL/src/native/windows/context.h 2006-10-30 15:46:42 UTC (rev 2618)
@@ -47,12 +47,15 @@
#include "extgl_wgl.h"
typedef struct {
- struct {
- HPBUFFERARB pbuffer;
- // Contains the function pointers that
- // created the pbuffer
- WGLExtensions extensions;
- } pbuffer;
+ union {
+ HWND hwnd;
+ struct {
+ HPBUFFERARB pbuffer;
+ // Contains the function pointers that
+ // created the pbuffer
+ WGLExtensions extensions;
+ } pbuffer;
+ } u;
HDC drawable_hdc;
} WindowsPeerInfo;
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c 2006-10-28 22:06:24 UTC (rev 2617)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Pbuffer.c 2006-10-30 15:46:42 UTC (rev 2618)
@@ -169,23 +169,23 @@
throwException(env, "Could not get Pbuffer DC");
return;
}
- peer_info->pbuffer.extensions = extensions;
- peer_info->pbuffer.pbuffer = Pbuffer;
+ peer_info->u.pbuffer.extensions = extensions;
+ peer_info->u.pbuffer.pbuffer = Pbuffer;
peer_info->drawable_hdc = Pbuffer_dc;
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nDestroy
(JNIEnv *env, jclass clazz, jobject peer_info_handle) {
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
- peer_info->pbuffer.extensions.wglReleasePbufferDCARB(peer_info->pbuffer.pbuffer, peer_info->drawable_hdc);
- peer_info->pbuffer.extensions.wglDestroyPbufferARB(peer_info->pbuffer.pbuffer);
+ peer_info->u.pbuffer.extensions.wglReleasePbufferDCARB(peer_info->u.pbuffer.pbuffer, peer_info->drawable_hdc);
+ peer_info->u.pbuffer.extensions.wglDestroyPbufferARB(peer_info->u.pbuffer.pbuffer);
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nIsBufferLost
(JNIEnv *env, jclass clazz, jobject peer_info_handle) {
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
BOOL buffer_lost;
- peer_info->pbuffer.extensions.wglQueryPbufferARB(peer_info->pbuffer.pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost);
+ peer_info->u.pbuffer.extensions.wglQueryPbufferARB(peer_info->u.pbuffer.pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost);
return buffer_lost ? JNI_TRUE : JNI_FALSE;
}
@@ -198,17 +198,17 @@
attribs[1] = value;
attribs[2] = 0;
- peer_info->pbuffer.extensions.wglSetPbufferAttribARB(peer_info->pbuffer.pbuffer, attribs);
+ peer_info->u.pbuffer.extensions.wglSetPbufferAttribARB(peer_info->u.pbuffer.pbuffer, attribs);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nBindTexImageToPbuffer
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) {
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
- peer_info->pbuffer.extensions.wglBindTexImageARB(peer_info->pbuffer.pbuffer, buffer);
+ peer_info->u.pbuffer.extensions.wglBindTexImageARB(peer_info->u.pbuffer.pbuffer, buffer);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nReleaseTexImageFromPbuffer
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) {
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
- peer_info->pbuffer.extensions.wglReleaseTexImageARB(peer_info->pbuffer.pbuffer, buffer);
+ peer_info->u.pbuffer.extensions.wglReleaseTexImageARB(peer_info->u.pbuffer.pbuffer, buffer);
}
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c 2006-10-28 22:06:24 UTC (rev 2617)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c 2006-10-30 15:46:42 UTC (rev 2618)
@@ -51,4 +51,5 @@
AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle);
JAWT_Win32DrawingSurfaceInfo *win32_dsi = (JAWT_Win32DrawingSurfaceInfo *)surface->dsi->platformInfo;
peer_info->drawable_hdc = win32_dsi->hdc;
+ peer_info->u.hwnd = win32_dsi->hwnd;
}
Added: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTInput.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTInput.c (rev 0)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTInput.c 2006-10-30 15:46:42 UTC (rev 2618)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2002-2004 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: org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c 2575 2006-09-19 14:17:13Z elias_naur $
+ *
+ * @author elias_naur <eli...@us...>
+ * @version $Revision: 2575 $
+ */
+
+#include <jni.h>
+#include "context.h"
+#include "org_lwjgl_opengl_WindowsAWTInput.h"
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsAWTInput_getWindowStyles(JNIEnv *env, jclass unused, jlong hwnd_ptr) {
+ HWND hwnd = (HWND)(intptr_t)hwnd_ptr;
+ WINDOWINFO window_info;
+ if (!GetWindowInfo(hwnd, &window_info)) {
+ throwFormattedException(env, "Failed to get window info (%d).", GetLastError());
+ return 0;
+ }
+ return window_info.dwStyle;
+}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsAWTInput_getParentWindow(JNIEnv *env, jclass unused, jlong hwnd_ptr) {
+ HWND hwnd = (HWND)(intptr_t)hwnd_ptr;
+ return (intptr_t)GetParent(hwnd);
+}
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c 2006-10-28 22:06:24 UTC (rev 2617)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c 2006-10-30 15:46:42 UTC (rev 2618)
@@ -47,4 +47,5 @@
(JNIEnv *env, jclass clazz, jobject peer_info_handle) {
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
peer_info->drawable_hdc = getCurrentHDC();
+ peer_info->u.hwnd = getCurrentHWND();
}
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c 2006-10-28 22:06:24 UTC (rev 2617)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c 2006-10-30 15:46:42 UTC (rev 2618)
@@ -58,3 +58,8 @@
// Let it throw
applyPixelFormat(env, peer_info->drawable_hdc, pixel_format_id);
}
+
+JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd(JNIEnv *env, jclass unused, jobject peer_info_handle) {
+ WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
+ return peer_info->u.hwnd;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-11-09 11:04:25
|
Revision: 2622
http://svn.sourceforge.net/java-game-lib/?rev=2622&view=rev
Author: elias_naur
Date: 2006-11-09 03:03:55 -0800 (Thu, 09 Nov 2006)
Log Message:
-----------
Add applettest ant target for easy LWJGL applet testing in appletviewer
Modified Paths:
--------------
trunk/LWJGL/build.xml
Added Paths:
-----------
trunk/LWJGL/applet/appletviewer.policy
Added: trunk/LWJGL/applet/appletviewer.policy
===================================================================
--- trunk/LWJGL/applet/appletviewer.policy (rev 0)
+++ trunk/LWJGL/applet/appletviewer.policy 2006-11-09 11:03:55 UTC (rev 2622)
@@ -0,0 +1,5 @@
+keystore "lwjglkeystore";
+
+grant SignedBy "lwjgl" {
+ permission java.security.AllPermission;
+};
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2006-11-07 15:14:31 UTC (rev 2621)
+++ trunk/LWJGL/build.xml 2006-11-09 11:03:55 UTC (rev 2622)
@@ -345,6 +345,13 @@
</jar>
</target>
+ <target name="applettest" depends="applet">
+ <exec executable="appletviewer">
+ <arg value="-J-Djava.security.policy=applet/appletviewer.policy"/>
+ <arg path="applet/applet.html"/>
+ </exec>
+ </target>
+
<target name="runtest" depends="all">
<fail message="test.mainclass is not set. Use 'ant -Dtest.mainclass=<main-class> runtest'" unless="test.mainclass"/>
<condition property="native_path" value="libs/win32">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2006-11-18 22:22:44
|
Revision: 2655
http://svn.sourceforge.net/java-game-lib/?rev=2655&view=rev
Author: matzon
Date: 2006-11-18 14:22:41 -0800 (Sat, 18 Nov 2006)
Log Message:
-----------
beta4
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/src/java/org/lwjgl/Sys.java
trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java
trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java
trunk/LWJGL/src/native/common/devil/extil.c
trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2006-11-18 22:03:02 UTC (rev 2654)
+++ trunk/LWJGL/build.xml 2006-11-18 22:22:41 UTC (rev 2655)
@@ -13,7 +13,7 @@
<property name="lwjgl.docs" location="doc" />
<property name="lwjgl.temp" location="temp" />
<property name="lwjgl.res" location="res" />
- <property name="lwjgl.version" value="1.0beta3" />
+ <property name="lwjgl.version" value="1.0beta4" />
<property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java"/>
<!-- ================================================================== -->
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-11-18 22:03:02 UTC (rev 2654)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-11-18 22:22:41 UTC (rev 2655)
@@ -54,7 +54,7 @@
private static final String JNI_LIBRARY_NAME = "lwjgl";
/** Current version of library */
- private static final String VERSION = "1.0beta3";
+ private static final String VERSION = "1.0beta4";
/** Current version of the JNI library */
static final int JNI_VERSION = 5;
Modified: trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java 2006-11-18 22:03:02 UTC (rev 2654)
+++ trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java 2006-11-18 22:22:41 UTC (rev 2655)
@@ -53,7 +53,7 @@
private static String JNI_LIBRARY_NAME = "lwjgl-devil";
/** Version of IL */
- public static final String VERSION = "1.0beta3";
+ public static final String VERSION = "1.0beta4";
/** Current version of the JNI library */
static final int JNI_VERSION = 1;
Modified: trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2006-11-18 22:03:02 UTC (rev 2654)
+++ trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2006-11-18 22:22:41 UTC (rev 2655)
@@ -193,7 +193,7 @@
private static String JNI_LIBRARY_NAME = "lwjgl-fmod3";
/** Version of FMOD */
- public static final String VERSION = "1.0beta3";
+ public static final String VERSION = "1.0beta4";
/** Current version of the JNI library */
static final int JNI_VERSION = 1;
Modified: trunk/LWJGL/src/native/common/devil/extil.c
===================================================================
--- trunk/LWJGL/src/native/common/devil/extil.c 2006-11-18 22:03:02 UTC (rev 2654)
+++ trunk/LWJGL/src/native/common/devil/extil.c 2006-11-18 22:22:41 UTC (rev 2655)
@@ -10,9 +10,7 @@
#endif
#include "org_lwjgl_devil_ILNative.h";
-static const char* VERSION = "1.0beta3";
-
-/*
+ /*
* Class: org_lwjgl_devil_ILNative
* Method: getNativeLibraryVersion
* Signature: ()I
Modified: trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c
===================================================================
--- trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c 2006-11-18 22:03:02 UTC (rev 2654)
+++ trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c 2006-11-18 22:22:41 UTC (rev 2655)
@@ -33,8 +33,6 @@
#include "org_lwjgl_fmod3_FMOD.h"
#include "extfmod3.h"
-static const char* VERSION = "1.0beta3";
-
/*
* Class: org_lwjgl_fmod3_FMOD
* Method: getNativeLibraryVersion
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2006-12-18 18:27:16
|
Revision: 2695
http://svn.sourceforge.net/java-game-lib/?rev=2695&view=rev
Author: matzon
Date: 2006-12-18 10:27:15 -0800 (Mon, 18 Dec 2006)
Log Message:
-----------
1.0-rc1 version string
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/src/java/org/lwjgl/Sys.java
trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java
trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2006-12-12 21:44:46 UTC (rev 2694)
+++ trunk/LWJGL/build.xml 2006-12-18 18:27:15 UTC (rev 2695)
@@ -13,7 +13,7 @@
<property name="lwjgl.docs" location="doc" />
<property name="lwjgl.temp" location="temp" />
<property name="lwjgl.res" location="res" />
- <property name="lwjgl.version" value="1.0beta4" />
+ <property name="lwjgl.version" value="1.0-rc1" />
<property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java"/>
<!-- ================================================================== -->
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-12-12 21:44:46 UTC (rev 2694)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-12-18 18:27:15 UTC (rev 2695)
@@ -54,7 +54,7 @@
private static final String JNI_LIBRARY_NAME = "lwjgl";
/** Current version of library */
- private static final String VERSION = "1.0beta4";
+ private static final String VERSION = "1.0-rc1";
/** Current version of the JNI library */
static final int JNI_VERSION = 6;
Modified: trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java 2006-12-12 21:44:46 UTC (rev 2694)
+++ trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java 2006-12-18 18:27:15 UTC (rev 2695)
@@ -53,7 +53,7 @@
private static String JNI_LIBRARY_NAME = "lwjgl-devil";
/** Version of IL */
- static final String VERSION = "1.0beta4";
+ static final String VERSION = "1.0-rc1";
/** Current version of the JNI library */
static final int JNI_VERSION = 2;
Modified: trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2006-12-12 21:44:46 UTC (rev 2694)
+++ trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2006-12-18 18:27:15 UTC (rev 2695)
@@ -193,7 +193,7 @@
private static String JNI_LIBRARY_NAME = "lwjgl-fmod3";
/** Version of FMOD */
- private static final String VERSION = "1.0beta4";
+ private static final String VERSION = "1.0-rc1";
/** Current version of the JNI library */
static final int JNI_VERSION = 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-02-03 12:22:58
|
Revision: 2736
http://svn.sourceforge.net/java-game-lib/?rev=2736&view=rev
Author: matzon
Date: 2007-02-03 04:22:25 -0800 (Sat, 03 Feb 2007)
Log Message:
-----------
1.0 version string
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/src/java/org/lwjgl/Sys.java
trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java
trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2007-01-31 14:07:20 UTC (rev 2735)
+++ trunk/LWJGL/build.xml 2007-02-03 12:22:25 UTC (rev 2736)
@@ -13,7 +13,7 @@
<property name="lwjgl.docs" location="doc" />
<property name="lwjgl.temp" location="temp" />
<property name="lwjgl.res" location="res" />
- <property name="lwjgl.version" value="1.0-rc1" />
+ <property name="lwjgl.version" value="1.0" />
<property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java"/>
<!-- ================================================================== -->
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2007-01-31 14:07:20 UTC (rev 2735)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2007-02-03 12:22:25 UTC (rev 2736)
@@ -54,7 +54,7 @@
private static final String JNI_LIBRARY_NAME = "lwjgl";
/** Current version of library */
- private static final String VERSION = "1.0-rc2";
+ private static final String VERSION = "1.0";
/** Current version of the JNI library */
static final int JNI_VERSION = 8;
Modified: trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java 2007-01-31 14:07:20 UTC (rev 2735)
+++ trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java 2007-02-03 12:22:25 UTC (rev 2736)
@@ -53,7 +53,7 @@
private static String JNI_LIBRARY_NAME = "lwjgl-devil";
/** Version of IL */
- static final String VERSION = "1.0-rc2";
+ static final String VERSION = "1.0";
/** Current version of the JNI library */
static final int JNI_VERSION = 2;
Modified: trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2007-01-31 14:07:20 UTC (rev 2735)
+++ trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2007-02-03 12:22:25 UTC (rev 2736)
@@ -193,7 +193,7 @@
private static String JNI_LIBRARY_NAME = "lwjgl-fmod3";
/** Version of FMOD */
- private static final String VERSION = "1.0-rc2";
+ private static final String VERSION = "1.0";
/** Current version of the JNI library */
static final int JNI_VERSION = 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|