You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
1
(2) |
2
(2) |
3
(2) |
4
|
5
(2) |
|
6
(5) |
7
(22) |
8
(4) |
9
(5) |
10
(6) |
11
(5) |
12
(7) |
|
13
(11) |
14
(1) |
15
(1) |
16
|
17
|
18
(3) |
19
(1) |
|
20
(10) |
21
(3) |
22
(7) |
23
|
24
(2) |
25
(2) |
26
(2) |
|
27
(1) |
28
(1) |
29
(4) |
30
(9) |
|
|
|
|
From: <ma...@us...> - 2008-04-10 21:02:32
|
Revision: 3004
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3004&view=rev
Author: matzon
Date: 2008-04-10 14:02:04 -0700 (Thu, 10 Apr 2008)
Log Message:
-----------
support for prepending host to cache path (defaults to true)
Modified Paths:
--------------
trunk/LWJGL/applet/appletloader.html
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/applet/appletloader.html
===================================================================
--- trunk/LWJGL/applet/appletloader.html 2008-04-10 20:47:29 UTC (rev 3003)
+++ trunk/LWJGL/applet/appletloader.html 2008-04-10 21:02:04 UTC (rev 3004)
@@ -50,6 +50,9 @@
<!-- whether to run in debug mode -->
<!-- <param name="al_debug" value="false"> -->
+ <!-- whether to prepend host to cache path - defaults to true -->
+ <param name="al_prepend_host" value="false">
+
<!-- main applet specific params -->
<param name="test" value="org.lwjgl.test.opengl.awt.AWTGearsCanvas">
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2008-04-10 20:47:29 UTC (rev 3003)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2008-04-10 21:02:04 UTC (rev 3004)
@@ -183,6 +183,9 @@
/** whether we're running in debug mode */
protected boolean debugMode;
+ /** whether to prepend host to cache path */
+ protected boolean prependHost;
+
/** String to display as a subtask */
protected String subtaskMessage = "";
@@ -221,6 +224,9 @@
// whether to run in debug mode
debugMode = getBooleanParameter("al_debug", false);
+ // whether to prepend host to cache path
+ prependHost = getBooleanParameter("al_prepend_host", true);
+
// get colors of applet
bgColor = getColor("al_bgcolor", Color.white);
setBackground(bgColor);
@@ -486,7 +492,17 @@
// get path where applet will be stored
String path = (String) AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws Exception {
- return System.getProperty("java.io.tmpdir") + File.separator + getParameter("al_title") + File.separator;
+
+ // we append the code base to avoid naming collisions with al_title
+ String codebase = "";
+ if(prependHost) {
+ codebase = getCodeBase().getHost();
+ if(codebase == null || codebase.length() == 0) {
+ codebase = "localhost";
+ }
+ codebase += File.separator;
+ }
+ return System.getProperty("java.io.tmpdir") + File.separator + codebase + getParameter("al_title") + File.separator;
}
});
@@ -494,7 +510,7 @@
// create directory
if (!dir.exists()) {
- dir.mkdir();
+ dir.mkdirs();
}
dir = new File(dir, "version");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-10 20:47:39
|
Revision: 3003
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3003&view=rev
Author: elias_naur
Date: 2008-04-10 13:47:29 -0700 (Thu, 10 Apr 2008)
Log Message:
-----------
Windows: Removed directinput files, since they are now unused. Fixed headers build.xml target
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/platform_build/windows_ant/build.xml
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
Removed 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/WindowsDirectInputMouse.java
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInput3.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInput8.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInputDevice3.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInputDevice8.c
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/build.xml 2008-04-10 20:47:29 UTC (rev 3003)
@@ -435,7 +435,6 @@
<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" />
@@ -450,12 +449,7 @@
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows" force="yes">
<!-- OpenGL -->
- <class name="org.lwjgl.opengl.WindowsAWTInput" />
<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.WindowsPbufferPeerInfo" />
<class name="org.lwjgl.opengl.WindowsDisplay" />
<class name="org.lwjgl.opengl.WindowsRegistry" />
Modified: trunk/LWJGL/platform_build/windows_ant/build.xml
===================================================================
--- trunk/LWJGL/platform_build/windows_ant/build.xml 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/platform_build/windows_ant/build.xml 2008-04-10 20:47:29 UTC (rev 3003)
@@ -4,7 +4,7 @@
<property name="native" location="../../src/native"/>
<property environment="env"/>
<property name="dxhome" location="${env.DXSDK_DIR}"/>
- <property name="sdkhome" location="${env.MSSdk}"/>
+ <property name="sdkhome" location="${env.MSSDK}"/>
<property name="program_files" location="${env.ProgramFiles}"/>
<property name="alhome" location="${program_files}\OpenAL 1.1 with EFX SDK"/>
<property name="dllname" value="lwjgl.dll"/>
@@ -53,6 +53,9 @@
</target>
<target name="compile">
+ <echo message="${dxhome}"/>
+ <echo message="${sdkhome}"/>
+ <echo message="${program_files}"/>
<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"/>
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput.java 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput.java 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-/**
- * This is the 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_POLLEDDEVICE = 0x00000002;
-
- 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);
-}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput3.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput3.java 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput3.java 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-/**
- * This is the 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);
-}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput8.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput8.java 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInput8.java 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-/**
- * This is the 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);
-}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice.java 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-/**
- * This is the 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;
-
- public final static int DATA_SIZE = 3;
-
- 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 (" + 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 (" + Integer.toHexString(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_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 (" + Integer.toHexString(ret) + ")");
- int event_buffer_size = getEventSize()*buffer_size;
- event_buffer = BufferUtils.createByteBuffer(event_buffer_size);
- }
- protected abstract int setBufferSize(long di_device, int buffer_size);
-
- public int getDeviceData(IntBuffer buffer) {
- int events_remaining = buffer.remaining()/DATA_SIZE;
- if (event_buffer == null || events_remaining > event_buffer.remaining()/getEventSize())
- event_buffer = BufferUtils.createByteBuffer(events_remaining*getEventSize());
- return getDeviceData(di_device, event_buffer, event_buffer.capacity(), buffer, buffer.position(), buffer.remaining());
- }
- protected abstract int getDeviceData(long di_device, ByteBuffer event_buffer, int event_buffer_size, IntBuffer buffer, int position, int size);
-
- /**
- * Device data is returned in tuples of the form <dwOfs, dwData>.
- * buffer position() is moved accordingly to number of events.
- */
- public int getDeviceState(ByteBuffer buffer) {
- return getDeviceState(di_device, buffer, buffer.position(), buffer.remaining());
- }
- protected abstract int getDeviceState(long di_device, ByteBuffer buffer, int position, int size);
-
- public void unacquire() {
- unacquire(di_device);
- }
- protected abstract int unacquire(long di_device);
-
- public int enumObjects(WindowsDirectInputDeviceObjectCallback enumerator) {
- return enumObjects(di_device, enumerator);
- }
- protected abstract int enumObjects(long di_device, WindowsDirectInputDeviceObjectCallback enumerator);
-
- protected abstract int getEventSize();
-}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice3.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice3.java 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice3.java 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-/**
- * This is the DirectInputDevice3 interface
- * @author elias_naur
- */
-
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
-
-final class WindowsDirectInputDevice3 extends WindowsDirectInputDevice {
- /** Re-declare to get the constants into the native headers */
- public final static int GUID_XAxis = WindowsDirectInputDevice.GUID_XAxis;
- public final static int GUID_YAxis = WindowsDirectInputDevice.GUID_YAxis;
- public final static int GUID_ZAxis = WindowsDirectInputDevice.GUID_ZAxis;
- public final static int GUID_Button = WindowsDirectInputDevice.GUID_Button;
- public final static int GUID_Unknown = WindowsDirectInputDevice.GUID_Unknown;
-
- public final static int DATA_SIZE = WindowsDirectInputDevice.DATA_SIZE;
-
- public WindowsDirectInputDevice3(long di_device) {
- super(di_device);
- }
-
- protected native int setDataFormat(long di_device, int type);
-
- protected native int setCooperativeLevel(long di_device, long hwnd, int flags);
-
- protected native int acquire(long di_device);
-
- protected native int getDeviceState(long di_device, ByteBuffer buffer, int position, int size);
-
- protected native int getDeviceData(long di_device, ByteBuffer event_buffer, int event_buffer_size, IntBuffer buffer, int position, int size);
-
- protected native int unacquire(long di_device);
-
- protected int poll(long di_device) {
- return WindowsDirectInput.DI_OK;
- }
-
- protected native int setBufferSize(long di_device, int buffer_size);
- protected native int getEventSize();
-
- protected native void release(long di_device);
-
- protected native int enumObjects(long di_device, WindowsDirectInputDeviceObjectCallback enumerator);
-}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice8.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice8.java 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDevice8.java 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-/**
- * This is the DirectInputDevice3 interface
- * @author elias_naur
- */
-
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
-
-final class WindowsDirectInputDevice8 extends WindowsDirectInputDevice {
- /** Re-declare to get the constants into the native headers */
- public final static int GUID_XAxis = WindowsDirectInputDevice.GUID_XAxis;
- public final static int GUID_YAxis = WindowsDirectInputDevice.GUID_YAxis;
- public final static int GUID_ZAxis = WindowsDirectInputDevice.GUID_ZAxis;
- public final static int GUID_Button = WindowsDirectInputDevice.GUID_Button;
- public final static int GUID_Unknown = WindowsDirectInputDevice.GUID_Unknown;
-
- public final static int DATA_SIZE = WindowsDirectInputDevice.DATA_SIZE;
-
- public WindowsDirectInputDevice8(long di_device) {
- super(di_device);
- }
-
- protected native int setDataFormat(long di_device, int type);
-
- protected native int setCooperativeLevel(long di_device, long hwnd, int flags);
-
- protected native int acquire(long di_device);
-
- protected native int getDeviceState(long di_device, ByteBuffer buffer, int position, int size);
-
- protected native int getDeviceData(long di_device, ByteBuffer event_buffer, int event_buffer_size, IntBuffer buffer, int position, int size);
-
- protected native int unacquire(long di_device);
-
- protected native int poll(long di_device);
-
- protected native int setBufferSize(long di_device, int buffer_size);
- protected native int getEventSize();
-
- protected native void release(long di_device);
-
- protected native int enumObjects(long di_device, WindowsDirectInputDeviceObjectCallback enumerator);
-}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDeviceObjectCallback.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDeviceObjectCallback.java 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputDeviceObjectCallback.java 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-/**
- * This is the DirectInputDevice callback interface
- * @author elias_naur
- */
-
-interface WindowsDirectInputDeviceObjectCallback {
- public boolean nextObject(int type, String name);
-}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputMouse.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputMouse.java 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDirectInputMouse.java 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,352 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-/**
- * This is the Windows implementation of the Mouse.
- * @author elias_naur
- */
-
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
-
-import org.lwjgl.BufferUtils;
-import org.lwjgl.LWJGLException;
-import org.lwjgl.LWJGLUtil;
-import org.lwjgl.input.Mouse;
-
-final class WindowsDirectInputMouse {
- private final static int BUFFER_SIZE = 50;
- private final static int BUTTON_STATES_SIZE = 7;
-
- private final static int DIMOFS_X = 0;
- private final static int DIMOFS_Y = 4;
- private final static int DIMOFS_Z = 8;
- private final static int DIMOFS_BUTTON0 = 12;
- private final static int DIMOFS_BUTTON1 = 13;
- private final static int DIMOFS_BUTTON2 = 14;
- private final static int DIMOFS_BUTTON3 = 15;
-
- private final long hwnd;
- private final WindowsDirectInput dinput;
- private final WindowsDirectInputDevice mouse;
-
- private final int mouse_button_count;
- private final boolean has_wheel;
-
- private final EventQueue event_queue = new EventQueue(Mouse.EVENT_SIZE);
- /* Buffer to hold a DIMOUSESTATE */
- private final ByteBuffer mouse_state;
- private final IntBuffer temp_data_buffer;
-
- private final ByteBuffer mouse_event = ByteBuffer.allocate(Mouse.EVENT_SIZE);
-
- private boolean mouse_grabbed;
- private byte[] win32_message_button_states = new byte[BUTTON_STATES_SIZE];
- private int accum_dwheel;
- private int last_x;
- private int last_y;
-
- public WindowsDirectInputMouse(WindowsDirectInput dinput, long hwnd) throws LWJGLException {
- this.hwnd = hwnd;
- this.dinput = dinput;
- try {
- mouse = dinput.createDevice(WindowsDirectInput.MOUSE_TYPE);
- try {
- mouse.setDataFormat(WindowsDirectInput.MOUSE_TYPE);
- mouse.setBufferSize(BUFFER_SIZE);
- if (!acquireNonExclusive())
- throw new LWJGLException("Failed to acquire mouse non-exclusive");
- } catch (LWJGLException e) {
- mouse.release();
- throw e;
- }
- } catch (LWJGLException e) {
- dinput.release();
- throw e;
- }
- MouseEnumerator enumerator = new MouseEnumerator();
- mouse.enumObjects(enumerator);
- this.mouse_button_count = Math.min(enumerator.getButtonCount(), 4);
- this.has_wheel = enumerator.hasWheel();
- mouse_state = BufferUtils.createByteBuffer(3*4 + 4);
- temp_data_buffer = BufferUtils.createIntBuffer(BUFFER_SIZE*WindowsDirectInputDevice.DATA_SIZE);
- }
-
- public boolean hasWheel() {
- return has_wheel;
- }
-
- public int getButtonCount() {
- return mouse_button_count;
- }
-
- private boolean acquire(int flags) {
- try {
- mouse.setCooperateLevel(hwnd, flags);
- mouse.acquire();
- return true;
- } catch (LWJGLException e) {
- LWJGLUtil.log("Failed to acquire mouse: " + e);
- return false;
- }
- }
-
- private boolean acquireNonExclusive() {
- return acquire(WindowsDirectInputDevice.DISCL_NONEXCLUSIVE | WindowsDirectInputDevice.DISCL_FOREGROUND) ||
- acquire(WindowsDirectInputDevice.DISCL_NONEXCLUSIVE | WindowsDirectInputDevice.DISCL_BACKGROUND);
- }
-
- public void destroy() {
- mouse.unacquire();
- mouse.release();
- dinput.release();
- }
-
- public void poll(IntBuffer coord_buffer, ByteBuffer buttons) {
- int ret = mouse.acquire();
- if (ret != WindowsDirectInput.DI_OK && ret != WindowsDirectInput.DI_NOEFFECT)
- return;
- mouse.poll();
- for (int i = 0; i < coord_buffer.remaining(); i++)
- coord_buffer.put(coord_buffer.position() + i, 0);
- mouse_state.clear();
- ret = mouse.getDeviceState(mouse_state);
- int mouse_state_lx = mouse_state.getInt();
- int mouse_state_ly = mouse_state.getInt();
- int mouse_state_lz = mouse_state.getInt();
- int num_buttons = mouse_button_count;
- if (mouse_grabbed || ret == WindowsDirectInput.DI_OK) {
- if (ret != WindowsDirectInput.DI_OK) {
- LWJGLUtil.log("Error getting mouse state: (0x" + Integer.toHexString(ret) + ")");
- return;
- }
-
- coord_buffer.put(coord_buffer.position() + 2, mouse_state_lz);
- if (num_buttons > buttons.remaining())
- num_buttons = buttons.remaining();
- for (int j = 0; j < num_buttons; j++) {
- byte button_state = (mouse_state.get() & 0x80) != 0 ? (byte)1 : (byte)0;
- buttons.put(buttons.position() + j, button_state);
- // track the button state in the windows message buffer state array
- // to get accurate button information when releasing a grab
- win32_message_button_states[j] = button_state;
- }
- } else {
- coord_buffer.put(coord_buffer.position() + 2, accum_dwheel);
- if (num_buttons > win32_message_button_states.length)
- num_buttons = win32_message_button_states.length;
- for (int j = 0; j < num_buttons; j++) {
- buttons.put(buttons.position() + j, win32_message_button_states[j]);
- }
- }
- accum_dwheel = 0;
- if (mouse_grabbed) {
- coord_buffer.put(coord_buffer.position() + 0, mouse_state_lx);
- coord_buffer.put(coord_buffer.position() + 1, -mouse_state_ly);
- } else {
- coord_buffer.put(coord_buffer.position() + 0, last_x);
- coord_buffer.put(coord_buffer.position() + 1, last_y);
- }
- }
-
- private void putMouseEventWithCoords(byte button, byte state, int coord1, int coord2, int dz, long nanos) {
- mouse_event.clear();
- mouse_event.put(button).put(state).putInt(coord1).putInt(coord2).putInt(dz).putLong(nanos);
- mouse_event.flip();
- event_queue.putEvent(mouse_event);
- }
-
- private void putMouseEvent(byte button, byte state, int dz, long nanos) {
- if (mouse_grabbed)
- putMouseEventWithCoords(button, state, 0, 0, dz, nanos);
- else
- putMouseEventWithCoords(button, state, last_x, last_y, dz, nanos);
- }
-
- private void copyDXEvents(IntBuffer buffer) {
- int buffer_index = 0;
- int dx = 0, dy = 0, dwheel = 0;
- byte button_state;
- int i;
- long nanos = 0;
- while (buffer.hasRemaining()) {
- int dwOfs = buffer.get();
- int dwData = buffer.get();
- long dwTimeStamp = ((long)buffer.get()) & 0xFFFFFFFF;
- nanos = dwTimeStamp*1000000;
- button_state = (dwData & 0x80) != 0 ? (byte)1 : (byte)0;
- switch (dwOfs) {
- case DIMOFS_BUTTON0:
- putMouseEventWithCoords((byte)0, button_state, dx, -dy, dwheel, nanos);
- dx = dy = dwheel = 0;
- break;
- case DIMOFS_BUTTON1:
- putMouseEventWithCoords((byte)1, button_state, dx, -dy, dwheel, nanos);
- dx = dy = dwheel = 0;
- break;
- case DIMOFS_BUTTON2:
- putMouseEventWithCoords((byte)2, button_state, dx, -dy, dwheel, nanos);
- dx = dy = dwheel = 0;
- break;
- case DIMOFS_BUTTON3:
- putMouseEventWithCoords((byte)3, button_state, dx, -dy, dwheel, nanos);
- dx = dy = dwheel = 0;
- break;
- case DIMOFS_X:
- dx += dwData;
- break;
- case DIMOFS_Y:
- dy += dwData;
- break;
- case DIMOFS_Z:
- dwheel += dwData;
- break;
- }
- }
- if (dx != 0 || dy != 0 || dwheel != 0)
- putMouseEventWithCoords((byte)-1, (byte)0, dx, -dy, dwheel, nanos);
- }
-
- private void readDXBuffer() {
- int ret = mouse.acquire();
- if (ret != WindowsDirectInput.DI_OK && ret != WindowsDirectInput.DI_NOEFFECT)
- return;
- mouse.poll();
- temp_data_buffer.clear();
- ret = mouse.getDeviceData(temp_data_buffer);
-
- switch (ret) {
- case WindowsDirectInput.DI_OK:
- break;
- case WindowsDirectInput.DI_BUFFEROVERFLOW:
- LWJGLUtil.log("Mouse buffer overflowed");
- break;
- case WindowsDirectInput.DIERR_INPUTLOST:
- LWJGLUtil.log("Mouse input lost");
- break;
- case WindowsDirectInput.DIERR_NOTACQUIRED:
- LWJGLUtil.log("Mouse not acquired");
- break;
- default:
- LWJGLUtil.log("unknown mouse error (" + Integer.toHexString(ret) + ")");
- break;
- }
- }
-
- public final void flush() {
- readDXBuffer();
- temp_data_buffer.clear();
- }
-
- public void read(ByteBuffer buffer) {
- readDXBuffer();
- if (mouse_grabbed) {
- temp_data_buffer.flip();
- copyDXEvents(temp_data_buffer);
- }
- event_queue.copyEvents(buffer);
- }
-
- public void grab(boolean grab) {
- if(grab) {
- if (!mouse_grabbed) {
- flush();
- mouse_grabbed = true;
- mouse.unacquire();
- if (!acquire(WindowsDirectInputDevice.DISCL_EXCLUSIVE | WindowsDirectInputDevice.DISCL_FOREGROUND))
- LWJGLUtil.log("Failed to reset cooperative mode");
- }
- } else {
- if (mouse_grabbed) {
- mouse_grabbed = false;
- mouse.unacquire();
- acquireNonExclusive();
- }
- }
- event_queue.clearEvents();
- }
-
- public void handleMouseScrolled(int event_dwheel, long millis) {
- accum_dwheel += event_dwheel;
- putMouseEvent((byte)-1, (byte)0, event_dwheel, millis*1000000);
- }
-
- public void handleMouseMoved(int x, int y, long millis) {
- int dx;
- int dy;
- dx = x - last_x;
- dy = y - last_y;
- last_x = x;
- last_y = y;
- long nanos = millis*1000000;
- if (mouse_grabbed) {
- putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0, nanos);
- } else {
- putMouseEventWithCoords((byte)-1, (byte)0, x, y, 0, nanos);
- }
- }
-
- public void handleMouseButton(byte button, byte state, long millis) {
- putMouseEvent(button, state, 0, millis*1000000);
- if (button < BUTTON_STATES_SIZE)
- win32_message_button_states[button] = state != 0 ? (byte)1 : (byte)0;
- }
-
- private static class MouseEnumerator implements WindowsDirectInputDeviceObjectCallback {
- private int button_count;
- private boolean has_wheel;
-
- public int getButtonCount() {
- return button_count;
- }
-
- public boolean hasWheel() {
- return has_wheel;
- }
-
- public boolean nextObject(int type, String name) {
- LWJGLUtil.log("Found mouse object: " + name);
- switch (type) {
- case WindowsDirectInputDevice.GUID_ZAxis:
- has_wheel = true;
- break;
- case WindowsDirectInputDevice.GUID_Button:
- button_count++;
- break;
- default:
- break;
- }
- return true;
- }
- }
-}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-04-10 20:47:29 UTC (rev 3003)
@@ -205,15 +205,6 @@
rect.offset(offset_x, offset_y);
}
- 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());
- }
- }
-
static void setupCursorClipping(long hwnd) throws LWJGLException {
cursor_clipped = true;
getGlobalClientRect(hwnd, rect);
Deleted: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInput3.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInput3.c 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInput3.c 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * $Id: org_lwjgl_input_Keyboard.c 2385 2006-06-23 16:45:21Z elias_naur $
- *
- * @author elias_naur <eli...@us...>
- * @version $Revision: 2385 $
- */
-
-#undef DIRECTINPUT_VERSION
-#define DIRECTINPUT_VERSION 0x0300
-#include "Window.h"
-#include <dinput.h>
-#include <jni.h>
-#include "org_lwjgl_opengl_WindowsDirectInput3.h"
-
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDirectInput3_createDirectInput(JNIEnv *env, jobject unused, jlong hinst_int) {
- HINSTANCE hinst = (HINSTANCE)(LONG_PTR)hinst_int;
- LPDIRECTINPUT lpdi;
- HRESULT ret;
-
- ret = DirectInputCreate(hinst, DIRECTINPUT_VERSION, &lpdi, NULL);
- if (ret != DI_OK) {
- throwFormattedException(env, "Failed to create DirectInput (%x)", ret);
- return (LONG_PTR)NULL;
- }
- return (LONG_PTR)lpdi;
-}
-
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDirectInput3_nCreateDevice(JNIEnv *env, jclass unused, jlong di_interface, jint type) {
- LPDIRECTINPUT lpdi = (LPDIRECTINPUT)(LONG_PTR)di_interface;
- LPDIRECTINPUTDEVICE lpdevice;
- GUID device_guid;
- HRESULT ret;
-
- switch (type) {
- case org_lwjgl_opengl_WindowsDirectInput3_KEYBOARD_TYPE:
- device_guid = GUID_SysKeyboard;
- break;
- case org_lwjgl_opengl_WindowsDirectInput3_MOUSE_TYPE:
- device_guid = GUID_SysMouse;
- break;
- default:
- throwFormattedException(env, "Unknown device type (%d)", type);
- return (LONG_PTR)NULL;
- }
- ret = IDirectInput_CreateDevice(lpdi, &device_guid, &lpdevice, NULL);
- if (ret != DI_OK) {
- throwFormattedException(env, "Failed to create keyboard (%x).", ret);
- return (LONG_PTR)NULL;
- }
- return (LONG_PTR)lpdevice;
-}
-
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDirectInput3_release(JNIEnv *env, jobject unused, jlong di_interface) {
- LPDIRECTINPUT lpdi = (LPDIRECTINPUT)(LONG_PTR)di_interface;
- IDirectInput_Release(lpdi);
-}
Deleted: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInput8.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInput8.c 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInput8.c 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * $Id: org_lwjgl_input_Keyboard.c 2385 2006-06-23 16:45:21Z elias_naur $
- *
- * @author elias_naur <eli...@us...>
- * @version $Revision: 2385 $
- */
-
-#undef DIRECTINPUT_VERSION
-#define DIRECTINPUT_VERSION 0x0800
-#include "Window.h"
-#include <dinput.h>
-#include <jni.h>
-#include "org_lwjgl_opengl_WindowsDirectInput8.h"
-
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDirectInput8_createDirectInput(JNIEnv *env, jobject unused, jlong hinst_int) {
- HINSTANCE hinst = (HINSTANCE)(LONG_PTR)hinst_int;
- LPDIRECTINPUT8 lpdi;
- HRESULT ret;
-
- ret = CoInitialize(NULL);
- if (ret != S_OK && ret != S_FALSE) {
- throwFormattedException(env, "CoInitialize failed (%x)", ret);
- return (LONG_PTR)NULL;
- }
- ret = CoCreateInstance(&CLSID_DirectInput8, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectInput8, (void *)&lpdi);
- if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION) {
- throwFormattedException(env, "Failed to create DirectInput (%x)", ret);
- return (LONG_PTR)NULL;
- }
-
- ret = IDirectInput8_Initialize(lpdi, hinst, DIRECTINPUT_VERSION);
- if (FAILED(ret)) {
- throwFormattedException(env, "Failed to initialize DirectInput (%x)", ret);
- IDirectInput8_Release(lpdi);
- return (LONG_PTR)NULL;
- }
- return (LONG_PTR)lpdi;
-}
-
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDirectInput8_nCreateDevice(JNIEnv *env, jclass unused, jlong di_interface, jint type) {
- LPDIRECTINPUT8 lpdi = (LPDIRECTINPUT8)(LONG_PTR)di_interface;
- LPDIRECTINPUTDEVICE8 lpdevice;
- GUID device_guid;
- HRESULT ret;
-
- switch (type) {
- case org_lwjgl_opengl_WindowsDirectInput8_KEYBOARD_TYPE:
- device_guid = GUID_SysKeyboard;
- break;
- case org_lwjgl_opengl_WindowsDirectInput8_MOUSE_TYPE:
- device_guid = GUID_SysMouse;
- break;
- default:
- throwFormattedException(env, "Unknown device type (%d)", type);
- return (LONG_PTR)NULL;
- }
- ret = IDirectInput8_CreateDevice(lpdi, &device_guid, &lpdevice, NULL);
- if (ret != DI_OK) {
- throwFormattedException(env, "Failed to create keyboard (%x).", ret);
- return (LONG_PTR)NULL;
- }
- return (LONG_PTR)lpdevice;
-}
-
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDirectInput8_release(JNIEnv *env, jobject unused, jlong di_interface) {
- LPDIRECTINPUT8 lpdi = (LPDIRECTINPUT8)(LONG_PTR)di_interface;
- IDirectInput8_Release(lpdi);
- CoUninitialize();
-}
Deleted: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInputDevice3.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInputDevice3.c 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInputDevice3.c 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * $Id: org_lwjgl_input_Keyboard.c 2385 2006-06-23 16:45:21Z elias_naur $
- *
- * @author elias_naur <eli...@us...>
- * @version $Revision: 2385 $
- */
-
-#undef DIRECTINPUT_VERSION
-#define DIRECTINPUT_VERSION 0x0300
-#include "Window.h"
-#include "dinputhelper.h"
-#include <dinput.h>
-#include <jni.h>
-#include "org_lwjgl_opengl_WindowsDirectInput3.h"
-#include "org_lwjgl_opengl_WindowsDirectInputDevice3.h"
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice3_unacquire(JNIEnv *env, jobject unused, jlong di_device) {
- LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
- return IDirectInputDevice_Unacquire(lpdevice);
-}
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice3_setDataFormat(JNIEnv *env, jobject unused, jlong di_device, jint type) {
- LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
- LPCDIDATAFORMAT format;
-
- switch (type) {
- case org_lwjgl_opengl_WindowsDirectInput3_KEYBOARD_TYPE:
- format = &c_dfDIKeyboard;
- break;
- case org_lwjgl_opengl_WindowsDirectInput3_MOUSE_TYPE:
- format = &c_dfDIMouse;
- break;
- default:
- throwFormattedException(env, "Unknown device type (%d)", type);
- return DIERR_INVALIDPARAM;
- }
- return IDirectInputDevice_SetDataFormat(lpdevice, format);
-}
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice3_getDeviceState(JNIEnv *env, jobject unused, jlong di_device, jobject buffer_obj, jint pos, jint size) {
- LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
- jbyte *buffer = pos + (jbyte *)(*env)->GetDirectBufferAddress(env, buffer_obj);
- return IDirectInputDevice_GetDeviceState(lpdevice, size, buffer);
-}
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice3_getEventSize(JNIEnv *env, jobject unused) {
- return sizeof(DIDEVICEOBJECTDATA);
-}
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice3_getDeviceData(JNIEnv *env, jobject unused, jlong di_device, jobject event_buffer_obj, jint event_buffer_size, jobject buffer_obj, jint buffer_pos, jint buffer_size) {
- LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
- jint *buffer = buffer_pos + (jint *)(*env)->GetDirectBufferAddress(env, buffer_obj);
- DIDEVICEOBJECTDATA *event_buffer = (*env)->GetDirectBufferAddress(env, event_buffer_obj);
- DIDEVICEOBJECTDATA *current_event;
- DWORD num_events = event_buffer_size/sizeof(DIDEVICEOBJECTDATA);
- HRESULT ret = IDirectInputDevice_GetDeviceData(lpdevice, sizeof(DIDEVICEOBJECTDATA), event_buffer, &num_events, 0);
- jint num_buffer_events = buffer_size/org_lwjgl_opengl_WindowsDirectInputDevice3_DATA_SIZE;
- jint i;
- if (ret != DI_OK && ret != DI_BUFFEROVERFLOW)
- return ret;
-
- if (num_buffer_events < num_events) {
- num_events = num_buffer_events;
- ret = DI_BUFFEROVERFLOW;
- }
- for (i = 0; i < num_events; i++) {
- current_event = event_buffer + i;
- buffer[buffer_pos++] = current_event->dwOfs;
- buffer[buffer_pos++] = current_event->dwData;
- buffer[buffer_pos++] = current_event->dwTimeStamp;
- }
- positionBuffer(env, buffer_obj, buffer_pos);
- return ret;
-}
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice3_acquire(JNIEnv *env, jobject unused, jlong di_device) {
- LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
- return IDirectInputDevice_Acquire(lpdevice);
-}
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice3_setBufferSize(JNIEnv *env, jobject unused, jlong di_device, jint buffer_size) {
- LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
- DIPROPDWORD dipropdw;
- dipropdw.diph.dwSize = sizeof(DIPROPDWORD);
- dipropdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- dipropdw.diph.dwObj = 0;
- dipropdw.diph.dwHow = DIPH_DEVICE;
- dipropdw.dwData = buffer_size;
- return IDirectInputDevice_SetProperty(lpdevice, DIPROP_BUFFERSIZE, &dipropdw.diph);
-}
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice3_setCooperativeLevel(JNIEnv *env, jobject unused, jlong di_device, jlong hwnd_int, jint flags) {
- LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
- HWND hwnd = (HWND)(LONG_PTR)hwnd_int;
- return IDirectInputDevice_SetCooperativeLevel(lpdevice, hwnd, flags);
-}
-
-JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice3_release(JNIEnv *env, jobject unused, jlong di_device) {
- LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
- IDirectInputDevice_Release(lpdevice);
-}
-
-static BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) {
- enum_context_t *enum_context = (enum_context_t *)pvRef;
- jint object_type;
-
- if (IsEqualGUID(&lpddoi->guidType, &GUID_Button)) {
- object_type = org_lwjgl_opengl_WindowsDirectInputDevice3_GUID_Button;
- } else if(IsEqualGUID(&lpddoi->guidType, &GUID_XAxis)) {
- object_type = org_lwjgl_opengl_WindowsDirectInputDevice3_GUID_XAxis;
- } else if(IsEqualGUID(&lpddoi->guidType, &GUID_YAxis)) {
- object_type = org_lwjgl_opengl_WindowsDirectInputDevice3_GUID_YAxis;
- } else if(IsEqualGUID(&lpddoi->guidType, &GUID_ZAxis)) {
- object_type = org_lwjgl_opengl_WindowsDirectInputDevice3_GUID_ZAxis;
- } else {
- object_type = org_lwjgl_opengl_WindowsDirectInputDevice3_GUID_Unknown;
- }
-
- return objectCallback(enum_context->env, enum_context->enumerator, object_type, lpddoi->tszName) ? DIENUM_CONTINUE : DIENUM_STOP;
-}
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice3_enumObjects(JNIEnv *env, jobject unused, jlong di_device, jobject enumerator) {
- LPDIRECTINPUTDEVICE lpdevice = (LPDIRECTINPUTDEVICE)(LONG_PTR)di_device;
- enum_context_t enum_context;
- enum_context.env = env;
- enum_context.enumerator = enumerator;
- return IDirectInputDevice_EnumObjects(lpdevice, EnumMouseObjectsCallback, &enum_context, DIDFT_ALL);
-}
Deleted: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInputDevice8.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInputDevice8.c 2008-04-10 20:25:54 UTC (rev 3002)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsDirectInputDevice8.c 2008-04-10 20:47:29 UTC (rev 3003)
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * $Id: org_lwjgl_input_Keyboard.c 2385 2006-06-23 16:45:21Z elias_naur $
- *
- * @author elias_naur <eli...@us...>
- * @version $Revision: 2385 $
- */
-
-#undef DIRECTINPUT_VERSION
-#define DIRECTINPUT_VERSION 0x0800
-#include "Window.h"
-#include "dinputhelper.h"
-#include <dinput.h>
-#include <jni.h>
-#include "org_lwjgl_opengl_WindowsDirectInput8.h"
-#include "org_lwjgl_opengl_WindowsDirectInputDevice8.h"
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice8_unacquire(JNIEnv *env, jobject unused, jlong di_device) {
- LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
- return IDirectInputDevice8_Unacquire(lpdevice);
-}
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice8_poll(JNIEnv *env, jobject unused, jlong di_device) {
- LPDIRECTINPUTDEVICE8 lpdevice = (LPDIRECTINPUTDEVICE8)(LONG_PTR)di_device;
- return IDirectInputDevice8_Poll(lpdevice);
-}
-
-JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDirectInputDevice8_setDataFormat(JNIEnv *env, jobject unused, jlong di_device, jint type) {
- LPDIRECTINPUTDEVI...
[truncated message content] |
|
From: <eli...@us...> - 2008-04-10 20:26:02
|
Revision: 3002
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3002&view=rev
Author: elias_naur
Date: 2008-04-10 13:25:54 -0700 (Thu, 10 Apr 2008)
Log Message:
-----------
Removed AWTInputAdapter, since Display.setParent() works much betterdiff
Modified Paths:
--------------
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/LinuxCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/AppletLoaderTest.java
trunk/LWJGL/src/java/org/lwjgl/test/applet/OpenGL.java
Removed 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/LinuxAWTInput.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXAWTInput.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTInputAdapterTest.java
trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxAWTInput.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTInput.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -56,12 +56,4 @@
* @throws LWJGLException if no suitable configuration could be found.
*/
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;
}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasInputImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasInputImplementation.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTCanvasInputImplementation.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-
-/**
- *
- * @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 init();
- void destroy();
-}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -81,9 +81,6 @@
/** 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();
implementation = createImplementation();
@@ -102,17 +99,6 @@
}
}
- /**
- * 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;
@@ -297,9 +283,6 @@
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();
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTInputAdapter.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTInputAdapter.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTInputAdapter.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import org.lwjgl.LWJGLException;
-import org.lwjgl.input.Keyboard;
-import org.lwjgl.input.Mouse;
-
-/**
- * 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 (isCreated())
- 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 boolean isCreated() {
- return awt_input != null;
- }
-
- public static synchronized void destroy() {
- if (isCreated()) {
- Mouse.destroy();
- Keyboard.destroy();
- awt_input.destroy();
- awt_input = null;
- }
- }
-}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractAWTInput.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractAWTInput.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AbstractAWTInput.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -1,178 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-import java.awt.Cursor;
-import java.awt.Robot;
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
-
-import org.lwjgl.LWJGLException;
-
-/**
- *
- * @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 Robot robot;
-
- private KeyboardEventQueue keyboard_queue;
- private MouseEventQueue mouse_queue;
- private volatile boolean grab;
-
- protected AbstractAWTInput(AWTGLCanvas canvas) {
- this.canvas = canvas;
- }
-
- protected MouseEventQueue getMouseEventQueue() {
- return mouse_queue;
- }
-
- protected KeyboardEventQueue getKeyboardEventQueue() {
- return keyboard_queue;
- }
-
- 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 canvas.getWidth();
- }
-
- public final int getHeight() {
- return canvas.getHeight();
- }
-
- public boolean hasWheel() {
- return AWTUtil.hasWheel();
- }
-
- public int getButtonCount() {
- return AWTUtil.getButtonCount();
- }
-
- public void createMouse() throws LWJGLException {
- mouse_queue = createMouseQueue();
- mouse_queue.register();
- }
-
- protected MouseEventQueue createMouseQueue() {
- return new MouseEventQueue(getCanvas());
- }
-
- public synchronized void destroyMouse() {
- if (mouse_queue != null) {
- mouse_queue.unregister();
- mouse_queue = null;
- }
- }
-
- public int getNativeCursorCapabilities() {
- return AWTUtil.getNativeCursorCapabilities();
- }
-
- public void setCursorPosition(int x, int y) {
- if (robot == null)
- robot = AWTUtil.createRobot(canvas);
- AWTUtil.setCursorPosition(canvas, robot, 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();
- keyboard_queue = null;
- }
- }
-
- 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);
- }
-}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTInput.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTInput.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxAWTInput.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -1,229 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-import java.nio.IntBuffer;
-import java.nio.ByteBuffer;
-
-import org.lwjgl.LWJGLException;
-import org.lwjgl.LWJGLUtil;
-
-/**
- *
- * @author elias_naur <eli...@us...>
- * @version $Revision: 2586 $
- * $Id: LinuxAWTGLCanvasPeerInfo.java 2586 2006-10-20 11:51:34Z elias_naur $
- */
-final class LinuxAWTInput extends AbstractAWTInput {
- private final long display;
- private final long input_window;
- private final LinuxEvent event = new LinuxEvent();
-
- private long cached_window;
- private LinuxMouse cached_mouse;
-// private LinuxKeyboard cached_keyboard;
- private long blank_cursor = LinuxDisplay.None;
- private boolean input_grabbed;
- private boolean input_released;
-
- public LinuxAWTInput(AWTGLCanvas canvas) throws LWJGLException {
- super(canvas);
- LinuxDisplay.lockAWT();
- try {
- this.display = LinuxDisplay.openDisplay();
- this.input_window = createInputOnlyWindow(display, LinuxDisplay.nGetDefaultScreen(display));
- } finally {
- LinuxDisplay.unlockAWT();
- }
- }
- private static native long createInputOnlyWindow(long display, int screen);
-
- public synchronized void destroy() {
- super.destroy();
- LinuxDisplay.lockAWT();
- try {
- destroyCursor();
- LinuxDisplay.nDestroyWindow(display, input_window);
- LinuxDisplay.closeDisplay(display);
- } finally {
- LinuxDisplay.unlockAWT();
- }
- }
-
- private void ungrabInputLocked() {
- LinuxDisplay.lockAWT();
- try {
- ungrabInput();
- } finally {
- LinuxDisplay.unlockAWT();
- }
- }
-
- private void ungrabInput() {
- if (input_grabbed) {
-// LinuxDisplay.nUngrabKeyboard(display);
- LinuxDisplay.nUngrabPointer(display);
- input_grabbed = false;
- }
- }
-
- private void grabInput(long window) {
- if (!input_grabbed) {
-// int res1 = LinuxDisplay.nGrabKeyboard(display, window);
- int res2 = LinuxDisplay.nGrabPointer(display, window, blank_cursor);
- if (/*res1 == LinuxDisplay.GrabSuccess && */res2 == LinuxDisplay.GrabSuccess)
- input_grabbed = true;
- }
- }
-
- private final void destroyCursor() {
- if (blank_cursor != LinuxDisplay.None)
- LinuxDisplay.nDestroyCursor(display, blank_cursor);
- }
-
- public synchronized void processInput(PeerInfo peer_info) {
- LinuxDisplay.lockAWT();
- try {
- LinuxPeerInfo linux_peer_info = (LinuxPeerInfo)peer_info;
- long new_window = linux_peer_info.getDrawable();
- if (cached_mouse == null || new_window != cached_window) {
- ungrabInput();
- cached_window = new_window;
- try {
- cached_mouse = new LinuxMouse(display, new_window, input_window);
-// cached_keyboard = new LinuxKeyboard(display, new_window);
- } catch (LWJGLException e) {
- LWJGLUtil.log("Failed to create input devices: " + e);
- }
- destroyCursor();
- this.blank_cursor = LinuxDisplay.nCreateBlankCursor(display, new_window);
- }
- checkFocus();
- if (!input_grabbed && shouldGrab())
- grabInput(new_window);
- update();
- } finally {
- LinuxDisplay.unlockAWT();
- }
- }
-
- public void destroyMouse() {
- ungrabInputLocked();
- super.destroyMouse();
- }
-
- private void checkFocus() {
- if (getCanvas().isFocusOwner()) {
- input_released = false;
- } else {
- input_released = true;
- ungrabInput();
- }
- }
-
- private boolean shouldGrab() {
- return !input_released && isGrabbed() && getMouseEventQueue() != null;
- }
-
- private void update() {
- while (LinuxEvent.getPending(display) > 0) {
- event.nextEvent(display);
- if (shouldGrab()) {
- long event_window = event.getWindow();
- boolean processed = event.filterEvent(event_window) ||
- cached_mouse.filterEvent(isGrabbed(), shouldGrab(), event);/* ||
- cached_keyboard.filterEvent(event) */
- }
- }
- }
-
- public synchronized void grabMouse(boolean grab) {
- if (grab != isGrabbed()) {
- if (cached_mouse != null)
- cached_mouse.changeGrabbed(grab, shouldGrab());
- ungrabInputLocked();
- super.grabMouse(grab);
- }
- }
-
-/* public synchronized void pollKeyboard(ByteBuffer keyDownBuffer) {
- if (isGrabbed()) {
- LinuxDisplay.lockAWT();
- try {
- if (cached_keyboard != null)
- cached_keyboard.poll(keyDownBuffer);
- } finally {
- LinuxDisplay.unlockAWT();
- }
- } else
- super.pollKeyboard(keyDownBuffer);
- }
-
- public synchronized void readKeyboard(ByteBuffer buffer) {
- if (isGrabbed()) {
- LinuxDisplay.lockAWT();
- try {
- if (cached_keyboard != null)
- cached_keyboard.read(buffer);
- } finally {
- LinuxDisplay.unlockAWT();
- }
- } else
- super.readKeyboard(buffer);
- }
-*/
- public synchronized void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) {
- if (isGrabbed()) {
- LinuxDisplay.lockAWT();
- try {
- if (cached_mouse != null)
- cached_mouse.poll(isGrabbed(), coord_buffer, buttons);
- } finally {
- LinuxDisplay.unlockAWT();
- }
- } else
- super.pollMouse(coord_buffer, buttons);
- }
-
- public synchronized void readMouse(ByteBuffer buffer) {
- if (isGrabbed()) {
- LinuxDisplay.lockAWT();
- try {
- if (cached_mouse != null)
- cached_mouse.read(buffer);
- } finally {
- LinuxDisplay.unlockAWT();
- }
- } else
- super.readMouse(buffer);
- }
-}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -120,8 +120,4 @@
}
}
private static native int nFindVisualIDFromFormat(long display, int screen, PixelFormat pixel_format) throws LWJGLException;
-
- public AWTCanvasInputImplementation createInput(AWTGLCanvas canvas) throws LWJGLException {
- return new LinuxAWTInput(canvas);
- }
}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXAWTInput.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXAWTInput.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXAWTInput.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-
-/**
- *
- * @author elias_naur <eli...@us...>
- * @version $Revision: 2586 $
- * $Id: LinuxAWTGLCanvasPeerInfo.java 2586 2006-10-20 11:51:34Z elias_naur $
- */
-final class MacOSXAWTInput extends AbstractAWTInput {
- private boolean had_focus;
-
- MacOSXAWTInput(AWTGLCanvas canvas) {
- super(canvas);
- }
-
- protected MouseEventQueue createMouseQueue() {
- return new MacOSXMouseEventQueue(getCanvas());
- }
-
- public synchronized void processInput(PeerInfo peer_info) {
- boolean has_focus = getCanvas().isFocusOwner();
- if (!had_focus && has_focus)
- ((MacOSXMouseEventQueue)getMouseEventQueue()).warpCursor();
- had_focus = has_focus;
- }
-
- public synchronized void destroyMouse() {
- if (getMouseEventQueue() != null)
- getMouseEventQueue().setGrabbed(false);
- super.destroyMouse();
- }
-}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasImplementation.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXCanvasImplementation.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -63,8 +63,4 @@
*/
return null;
}
-
- public AWTCanvasInputImplementation createInput(AWTGLCanvas canvas) throws LWJGLException {
- return new MacOSXAWTInput(canvas);
- }
}
Deleted: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsAWTInput.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.opengl;
-
-import java.awt.Cursor;
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
-
-import org.lwjgl.BufferUtils;
-import org.lwjgl.LWJGLException;
-import org.lwjgl.LWJGLUtil;
-
-/**
- *
- * @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 WindowsDirectInputMouse cached_mouse;
-// private WindowsKeyboard cached_keyboard;
- 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 destroyMouse() {
- if (cached_mouse != null) {
- grab(false);
- cached_mouse.destroy();
- cached_mouse = null;
- }
- super.destroyMouse();
- }
-
-/* public synchronized void destroyKeyboard() {
- if (cached_keyboard != null) {
- cached_keyboard.destroy();
- cached_keyboard = null;
- }
- super.destroyKeyboard();
- }
-*/
- 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();
- }
-/* if (cached_keyboard != null) {
- cached_keyboard.destroy();
- }*/
- WindowsDirectInput dinput = WindowsDisplay.createDirectInput();
- cached_mouse = new WindowsDirectInputMouse(dinput, hwnd);
-// cached_keyboard = new WindowsKeyboard(dinput, hwnd);
- }
- if (isGrabbed()) {
- /**
- * DirectInput won't always stop the cursor from moving on top of the
- * task bar and clicking on it. So we'll use ClipCursor to
- * contain it while the cursor is grabbed.
- */
- WindowsDisplay.setupCursorClipping(hwnd); // Just clip it to a fullscreen window
- if (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);
- }
- } else
- WindowsDisplay.resetCursorClipping();
- 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);
-// cached_keyboard.grab(grab);
- has_grabbed = grab;
- cached_mouse.flush();
-// cached_keyboard.flush();
- getMouseEventQueue().clearEvents();
-// getKeyboardEventQueue().clearEvents();
- if (!grab) {
- getCanvas().setCursor(cached_cursor);
- }
- }
- }
-
- public synchronized void grabMouse(boolean grab) {
- if (grab != isGrabbed()) {
- /* Only ungrab since grabbing can only occur in processInput
- * when the hwnd is guaranteed valid
- */
- if (cached_mouse != null && !grab)
- grab(grab);
- super.grabMouse(grab);
- }
- }
-
- 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);
- }
-
-/* public synchronized void readKeyboard(ByteBuffer buffer) {
- if (isGrabbed()) {
- if (cached_keyboard != null)
- cached_keyboard.read(buffer);
- } else
- super.readKeyboard(buffer);
- }
-
- public synchronized void pollKeyboard(ByteBuffer keyDownBuffer) {
- if (isGrabbed()) {
- if (cached_keyboard != null)
- cached_keyboard.poll(keyDownBuffer);
- } else
- super.pollKeyboard(keyDownBuffer);
- }*/
-}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -66,10 +66,6 @@
});
}
- public AWTCanvasInputImplementation createInput(AWTGLCanvas canvas) throws LWJGLException {
- return new WindowsAWTInput(canvas);
- }
-
public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format) throws LWJGLException {
return new WindowsAWTGLCanvasPeerInfo(component, pixel_format);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/test/applet/AppletLoaderTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/applet/AppletLoaderTest.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/test/applet/AppletLoaderTest.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -35,8 +35,6 @@
import java.awt.BorderLayout;
import java.awt.Canvas;
-import org.lwjgl.opengl.AWTInputAdapter;
-
public class AppletLoaderTest extends Applet {
Test test = null;
@@ -44,7 +42,6 @@
public void destroy() {
super.destroy();
System.out.println("*** destroy ***");
- AWTInputAdapter.destroy();
}
public void start() {
Modified: trunk/LWJGL/src/java/org/lwjgl/test/applet/OpenGL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/applet/OpenGL.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/test/applet/OpenGL.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -35,7 +35,6 @@
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.AWTGLCanvas;
-import org.lwjgl.opengl.AWTInputAdapter;
import org.lwjgl.opengl.GL11;
public class OpenGL extends AWTGLCanvas implements Test {
@@ -55,11 +54,6 @@
y = 240;
GL11.glMatrixMode(GL11.GL_MODELVIEW_MATRIX);
setVSyncEnabled(true);
- try {
- AWTInputAdapter.create(this);
- } catch (LWJGLException e) {
- e.printStackTrace();
- }
}
public void paintGL() {
@@ -93,9 +87,6 @@
String key_name = Keyboard.getKeyName(Keyboard.getEventKey());
if (Keyboard.getEventKeyState()) {
switch (Keyboard.getEventKey()) {
- case Keyboard.KEY_H:
- AWTInputAdapter.destroy();
- break;
case Keyboard.KEY_G:
Mouse.setGrabbed(!Mouse.isGrabbed());
break;
Deleted: trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTInputAdapterTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTInputAdapterTest.java 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTInputAdapterTest.java 2008-04-10 20:25:54 UTC (rev 3002)
@@ -1,384 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package org.lwjgl.test.opengl.awt;
-
-import java.awt.Frame;
-import java.awt.Color;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.nio.FloatBuffer;
-
-import org.lwjgl.BufferUtils;
-import org.lwjgl.LWJGLException;
-import org.lwjgl.input.Mouse;
-import org.lwjgl.input.Keyboard;
-import org.lwjgl.opengl.ARBTransposeMatrix;
-import org.lwjgl.opengl.AWTGLCanvas;
-import org.lwjgl.opengl.AWTInputAdapter;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GLContext;
-
-/**
- * <p>
- * Gears demo using AWTInputAdapter input
- * <p>
- * @version $Revision$
- * @author Brian Matzon <br...@ma...>
- * @author Elias Naur <eli...@us...>
- * $Id$
- */
-public class AWTInputAdapterTest extends Frame {
- /** AWT GL canvas */
- private AWTGLCanvas canvas0;
-
- private float view_rotx = 20.0f;
-
- private float view_roty = 30.0f;
-
- private float view_rotz = 0.0f;
-
- private int gear1;
-
- private int gear2;
-
- private int gear3;
-
- private float angle = 0.0f;
-
- /**
- * C'tor
- */
- public AWTInputAdapterTest() throws LWJGLException {
- setTitle("Gears");
- setSize(300, 300);
- setBackground(Color.BLACK);
- add(canvas0 = new AWTGLCanvas() {
- long startTime = 0;
- long fps = 0;
- int current_width;
- int current_height;
- public void paintGL() {
-
- if(startTime == 0) {
- setup();
- startTime = System.currentTimeMillis() + 5000;
- }
-
- try {
- angle += 2.0f;
- if (getWidth() != current_width || getHeight() != current_height) {
- current_width = getWidth();
- current_height = getHeight();
- GL11.glViewport(0, 0, current_width, current_height);
- }
- GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
-
- GL11.glPushMatrix();
- GL11.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
- GL11.glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
- GL11.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
-
- GL11.glPushMatrix();
- GL11.glTranslatef(-3.0f, -2.0f, 0.0f);
- GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
- GL11.glCallList(gear1);
- GL11.glPopMatrix();
-
- GL11.glPushMatrix();
- GL11.glTranslatef(3.1f, -2.0f, 0.0f);
- GL11.glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
- GL11.glCallList(gear2);
- GL11.glPopMatrix();
-
- GL11.glPushMatrix();
- GL11.glTranslatef(-3.1f, 4.2f, 0.0f);
- GL11.glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
- GL11.glCallList(gear3);
- GL11.glPopMatrix();
-
- GL11.glPopMatrix();
- swapBuffers();
- repaint();
- } catch (LWJGLException e) {
- throw new RuntimeException(e);
- }
- if (startTime > System.currentTimeMillis()) {
- fps++;
- } else {
- long timeUsed = 5000 + (startTime - System.currentTimeMillis());
- startTime = System.currentTimeMillis() + 5000;
- System.out.println(fps + " frames in " + (float) (timeUsed / 1000f) + " seconds = "
- + (fps / (timeUsed / 1000f)));
- fps = 0;
- }
- if (Mouse.isCreated()) {
- Mouse.poll();
- while (Mouse.next()) {
- view_roty += Mouse.getEventDX()*.1;
- view_rotx -= Mouse.getEventDY()*.1;
- }
- }
- if (Keyboard.isCreated()) {
- Keyboard.poll();
- }
- while (Keyboard.isCreated() && Keyboard.next()) {
- if (Keyboard.getEventKey() != Keyboard.KEY_NONE) {
- String key_name = Keyboard.getKeyName(Keyboard.getEventKey());
- if (Keyboard.getEventKeyState()) {
- switch (Keyboard.getEventKey()) {
- case Keyboard.KEY_ESCAPE:
- System.exit(0);
- break;
- case Keyboard.KEY_H:
- AWTInputAdapter.destroy();
- break;
- case Keyboard.KEY_G:
- Mouse.setGrabbed(!Mouse.isGrabbed());
- break;
- default:
- break;
- }
- System.out.println("Pressed: " + key_name);
- } else
- System.out.println("Released: " + key_name);
- }
- if (Keyboard.getEventCharacter() != Keyboard.CHAR_NONE)
- System.out.println("Typed: " + Keyboard.getEventCharacter());
- }
- if (Keyboard.isCreated()) {
- if (Keyboard.isKeyDown(Keyboard.KEY_UP))
- view_rotx -= .1;
- else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN))
- view_rotx += .1;
- if (Keyboard.isKeyDown(Keyboard.KEY_LEFT))
- view_roty -= .1;
- else if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT))
- view_roty += .1;
- }
- }
- });
- addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- dispose();
- System.exit(0);
- }
- });
- AWTInputAdapter.create(canvas0);
- canvas0.setFocusable(true);
- canvas0.requestFocus();
- setResizable(true);
- setVisible(true);
- }
-
- private void setup() {
- // setup ogl
- FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f});
- FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f});
- FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f});
- FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f});
- pos.flip();
- red.flip();
- green.flip();
- blue.flip();
-
- GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, pos);
- GL11.glEnable(GL11.GL_CULL_FACE);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glEnable(GL11.GL_LIGHT0);
- GL11.glEnable(GL11.GL_DEPTH_TEST);
-
- /* make the gears */
- gear1 = GL11.glGenLists(1);
- GL11.glNewList(gear1, GL11.GL_COMPILE);
- GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, red);
- gear(1.0f, 4.0f, 1.0f, 20, 0.7f);
- GL11.glEndList();
-
- gear2 = GL11.glGenLists(1);
- GL11.glNewList(gear2, GL11.GL_COMPILE);
- GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, green);
- gear(0.5f, 2.0f, 2.0f, 10, 0.7f);
- GL11.glEndList();
-
- gear3 = GL11.glGenLists(1);
- GL11.glNewList(gear3, GL11.GL_COMPILE);
- GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE, blue);
- gear(1.3f, 2.0f, 0.5f, 10, 0.7f);
- GL11.glEndList();
-
- GL11.glEnable(GL11.GL_NORMALIZE);
-
- GL11.glMatrixMode(GL11.GL_PROJECTION);
-
- System.err.println("Use the arrow keys and the mouse to rotate the gears. Press 'G' to toggle mouse grabbing. Press 'H' to destroy the AWTInputAdapter.");
- System.err.println("GL_VENDOR: " + GL11.glGetString(GL11.GL_VENDOR));
- System.err.println("GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER));
- System.err.println("GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));
- System.err.println();
- System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix);
- if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) {
- // --- not using extensions
- GL11.glLoadIdentity();
- } else {
- // --- using extensions
- final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put(
- new float[] { 1, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 1});
- identityTranspose.flip();
- ARBTransposeMatrix.glLoadTransposeMatrixARB(identityTranspose);
- }
-
- float h = (float) 300 / (float) 300;
- GL11.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glLoadIdentity();
- GL11.glTranslatef(0.0f, 0.0f, -40.0f);
- }
-
- /**
- * Draw a gear wheel. You'll probably want to call this function when
- * building a display list since we do a lot of trig here.
- *
- * @param inner_radius radius of hole at center
- * @param outer_radius radius at center of teeth
- * @param width width of gear
- * @param teeth number of teeth
- * @param tooth_depth depth of tooth
- */
- private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) {
- int i;
- float r0, r1, r2;
- float angle, da;
- float u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth / 2.0f;
- r2 = outer_radius + tooth_depth / 2.0f;
-
- da = 2.0f * (float) Math.PI / teeth / 4.0f;
-
- GL11.glShadeModel(GL11.GL_FLAT);
-
- GL11.glNormal3f(0.0f, 0.0f, 1.0f);
-
- /* draw front face */
- GL11.glBegin(GL11.GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
- GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
- if (i < teeth) {
- GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
- GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
- width * 0.5f);
- }
- }
- GL11.glEnd();
-
- /* draw front sides of teeth */
- GL11.glBegin(GL11.GL_QUADS);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
- GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
- GL11.glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
- GL11.glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
- }
- GL11.glEnd();
-
- /* draw back face */
- GL11.glBegin(GL11.GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
- GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
- GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
- GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
- }
- GL11.glEnd();
-
- /* draw back sides of teeth */
- GL11.glBegin(GL11.GL_QUADS);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
- GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
- GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
- GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
- }
- GL11.glEnd();
-
- /* draw outward faces of teeth */
- GL11.glBegin(GL11.GL_QUAD_STRIP);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
- GL11.glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
- u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle);
- v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle);
- len = (float) Math.sqrt(u * u + v * v);
- u /= len;
- v /= len;
- GL11.glNormal3f(v, -u, 0.0f);
- GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
- GL11.glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
- GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
- GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
- GL11.glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
- u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da);
- v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da);
- GL11.glNormal3f(v, -u, 0.0f);
- GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
- GL11.glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
- GL11.glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
- }
- GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
- GL11.glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
- GL11.glEnd();
-
- GL11.glShadeModel(GL11.GL_SMOOTH);
-
- /* draw inside radius cylinder */
- GL11.glBegin(GL11.GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0f * (float) Math.PI / teeth;
- GL11.glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
- GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
- GL11.glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
- }
- GL11.glEnd();
- }
-
- public static void main(String[] args) throws LWJGLException {
- new AWTInputAdapterTest();
- }
-}
Deleted: trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxAWTInput.c
===================================================================
--- trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxAWTInput.c 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxAWTInput.c 2008-04-10 20:25:54 UTC (rev 3002)
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * $Id: 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_LinuxAWTInput.h"
-
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxAWTInput_createInputOnlyWindow(JNIEnv *env, jclass unused, jlong display_ptr, jint screen) {
- Display *disp = (Display *)(intptr_t)display_ptr;
- Window window = XCreateWindow(disp, RootWindow(disp, screen), 0, 0, 1, 1, 0, CopyFromParent, InputOnly, CopyFromParent, 0, NULL);
- return window;
-}
Deleted: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTInput.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTInput.c 2008-04-10 20:14:15 UTC (rev 3001)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsAWTInput.c 2008-04-10 20:25:54 UTC (rev 3002)
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2002-2008 LWJGL Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * $Id: 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);
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-10 20:15:52
|
Revision: 3001
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3001&view=rev
Author: elias_naur
Date: 2008-04-10 13:14:15 -0700 (Thu, 10 Apr 2008)
Log Message:
-----------
Mac OS X: Fixed potential NPE in AWTUtil.getPointerLocation
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java 2008-04-09 23:40:18 UTC (rev 3000)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/AWTUtil.java 2008-04-10 20:14:15 UTC (rev 3001)
@@ -39,6 +39,7 @@
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GraphicsDevice;
+import java.awt.GraphicsConfiguration;
import java.awt.IllegalComponentStateException;
import java.awt.Point;
import java.awt.Robot;
@@ -115,12 +116,15 @@
final Method getLocation_method = PointerInfo_class.getMethod("getLocation", null);
return (Point)AccessController.doPrivileged(new PrivilegedExceptionAction() {
public final Object run() throws Exception {
- Object pointer_info = getPointerInfo_method.invoke(null, null);
- GraphicsDevice device = (GraphicsDevice)getDevice_method.invoke(pointer_info, null);
- if (device == component.getGraphicsConfiguration().getDevice()) {
- return (Point)getLocation_method.invoke(pointer_info, null);
- } else
- return null;
+ GraphicsConfiguration config = component.getGraphicsConfiguration();
+ if (config != null) {
+ Object pointer_info = getPointerInfo_method.invoke(null, null);
+ GraphicsDevice device = (GraphicsDevice)getDevice_method.invoke(pointer_info, null);
+ if (device == config.getDevice()) {
+ return (Point)getLocation_method.invoke(pointer_info, null);
+ }
+ }
+ return null;
}
});
} catch (PrivilegedActionException e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Kimmy <Kim...@KA...> - 2008-04-10 07:54:09
|
Lead a healthy lovemaking life with our revolutionary new product http://www.Gervaine.com/ |
|
From: Kuramoto <umu...@Cl...> - 2008-04-10 06:19:34
|
Be a real man - visit our website to find out more http://www.nufettil.com/ |