Merge remote-tracking branch 'origin/master' into issue5

This commit is contained in:
Endolf 2018-05-22 22:43:00 +01:00
commit f4876067c1
27 changed files with 636 additions and 725 deletions

385
build.xml
View file

@ -1,385 +0,0 @@
<?xml version="1.0"?>
<project name="Sun Games Initiative Client Technologies" basedir="." default="all" xmlns:artifact="urn:maven-artifact-ant">
<property name="api.version" value="2.0.8"/>
<property name="mvn.version" value="${api.version}-SNAPSHOT"/>
<property name="maven-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<property name="maven-repository-id" value="sonatype-nexus-staging" />
<target name="init">
<!-- If we are running in windows, set dx8 property to true -->
<condition property="windows" >
<os family="windows" />
</condition>
<!-- If we are running in linux, set linux property to true -->
<condition property="linux" >
<!--<os family="unix" />-->
<os name="linux" />
</condition>
<!-- If we are running in Mac OS X, set osx property to true -->
<condition property="osx" >
<and>
<os family="mac" />
<os family="unix" />
</and>
</condition>
<delete file="lib/jutils.jar"/>
<copy tofile="lib/jutils.jar">
<fileset dir="lib" includes="jutils-*-SNAPSHOT.jar"></fileset>
</copy>
</target>
<target name="runtest" depends="dist">
<java classname="${mainclass}"
fork="true" failonerror="true" dir=".">
<classpath>
<pathelement location="dist/jinput.jar"/>
<pathelement location="dist/jinput-test.jar"/>
</classpath>
<jvmarg value="-Djava.library.path=dist"/>
</java>
</target>
<target name="texttest">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.ControllerTextTest"/>
</antcall>
</target>
<target name="readtest" depends="init,all" description="Try running it.">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.ControllerReadTest"/>
</antcall>
</target>
<target name="eventtest" depends="init,all" description="Try running it.">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.ControllerEventTest"/>
</antcall>
</target>
<target name="rumbletest" depends="init,all" description="Try running it.">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.RumbleTest"/>
</antcall>
</target>
<target name="versiontest" depends="init,all" description="Try running it.">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.VersionTest"/>
</antcall>
</target>
<macrodef name="iterate">
<attribute name="target"/>
<sequential>
<subant target="@{target}">
<property name="api.version" value="${api.version}"/>
<fileset file="coreAPI/build.xml"/>
<fileset file="plugins/linux/build.xml"/>
<fileset file="plugins/windows/build.xml"/>
<fileset file="plugins/wintab/build.xml"/>
<fileset file="plugins/OSX/build.xml"/>
<fileset file="plugins/awt/build.xml"/>
</subant>
</sequential>
</macrodef>
<target name="clean">
<iterate target="clean"/>
<delete dir="dist" failonerror="no"/>
</target>
<target name="all" depends="dist">
</target>
<target name="javadoc" depends="init">
<iterate target="javadoc"/>
</target>
<target name="pluginTest" depends="dist" description="Build plugin version">
<mkdir dir="dist"/>
<mkdir dir="dist/controller"/>
<copy todir="dist">
<fileset file="coreAPI/bin/jinput-core.jar"/>
<fileset file="coreAPI/bin/jinput-test.jar"/>
<fileset file="plugins/DX8/lib/jutils.jar"/>
</copy>
<copy todir="dist/controller">
<fileset dir="plugins/awt/bin"/>
<fileset dir="plugins/linux/bin"/>
<fileset dir="plugins/OSX/bin"/>
<fileset dir="plugins/windows/bin"/>
<fileset dir="plugins/wintab/bin"/>
</copy>
</target>
<target name="dist" depends="init" description="Build the distribution file for this system">
<iterate target="all"/>
<mkdir dir="dist"/>
<jar jarfile="dist/jinput.jar" compress="true" duplicate="preserve">
<fileset dir="coreAPI/classes">
<include name="**/*.class"/>
<exclude name="**/test/*.class"/>
<exclude name="**/example/*.class"/>
</fileset>
<fileset dir="plugins/linux/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/OSX/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/awt/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/windows/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/wintab/classes">
<include name="**/*.class"/>
</fileset>
<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<iterate target="javadoc"/>
<copy todir="dist">
<fileset file="coreAPI/bin/jinput-test.jar"/>
<fileset dir="plugins/linux/bin" includes="*so"/>
<fileset dir="plugins/OSX/bin" includes="*jnilib"/>
<fileset dir="plugins/windows/bin" includes="*dll"/>
<fileset dir="plugins/wintab/bin" includes="*dll"/>
</copy>
</target>
<target name="simple_dist" depends="dist,simple_windows,simple_wintab,simple_linux,simple_osx" description="Build the simple jars for each platform"/>
<target name="simple_linux" depends="dist" description="Build the simple linux jar" if="linux">
<jar jarfile="dist/jinput-linux.jar" compress="true">
<fileset dir="coreAPI/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/linux/classes">
<include name="**/*.class"/>
</fileset>
<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<tar destfile="dist/jinput_linux.tgz" compression="gzip">
<tarfileset dir=".">
<include name="dist/jinput-linux.jar"/>
</tarfileset>
<tarfileset dir="plugins/linux/bin">
<include name="*.so"/>
</tarfileset>
</tar>
</target>
<target name="simple_windows" depends="dist" description="Build the simple windows jar" if="windows">
<jar jarfile="dist/jinput-windows.jar" compress="true">
<fileset dir="coreAPI/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/windows/classes">
<include name="**/*.class"/>
</fileset>
<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<zip destfile="dist/jinput_windows.zip">
<zipfileset dir=".">
<include name="dist/jinput-windows.jar"/>
</zipfileset>
<zipfileset dir="plugins/windows/bin">
<include name="*.dll"/>
</zipfileset>
</zip>
</target>
<target name="simple_wintab" depends="dist" description="Build the simple windows jar" if="windows">
<jar jarfile="dist/jinput-wintab.jar" compress="true">
<fileset dir="coreAPI/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/wintab/classes">
<include name="**/*.class"/>
</fileset>
<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<zip destfile="dist/jinput_wintab.zip">
<zipfileset dir=".">
<include name="dist/jinput-wintab.jar"/>
</zipfileset>
<zipfileset dir="plugins/wintab/bin">
<include name="*.dll"/>
</zipfileset>
</zip>
</target>
<target name="simple_osx" depends="dist" description="Build the simple osx jar" if="osx">
<jar jarfile="dist/jinput-osx.jar" compress="true">
<fileset dir="coreAPI/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/OSX/classes">
<include name="**/*.class"/>
</fileset>
<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<tar destfile="dist/jinput_osx.tgz" compression="gzip">
<tarfileset dir=".">
<include name="dist/jinput-osx.jar"/>
</tarfileset>
<tarfileset dir="plugins/OSX/bin">
<include name="*.jnilib"/>
</tarfileset>
</tar>
</target>
<target name="install" description="Installs jinput in to local mvn repo">
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
classpathref="maven-ant-tasks.classpath"/>
<filter token="VERSION" value="${mvn.version}"/>
<copy tofile="dist/jinput-${mvn.version}.pom" filtering="true">
<fileset file="jinput.pom"/>
</copy>
<copy tofile="dist/jinput-${mvn.version}-platform.pom" filtering="true">
<fileset file="jinput-platform.pom"/>
</copy>
<artifact:pom id="jinputpomfile" file="dist/jinput-${mvn.version}.pom" />
<artifact:pom id="jinputplatformpomfile" file="dist/jinput-${mvn.version}-platform.pom" />
<delete file="dist/jinput-natives-windows.zip" failonerror="false"/>
<zip destfile="dist/jinput-natives-windows.zip">
<fileset dir="dist/">
<include name="**/*.dll"/>
</fileset>
</zip>
<delete file="dist/jinput-natives-linux.zip" failonerror="false"/>
<zip destfile="dist/jinput-natives-linux.zip">
<fileset dir="dist/">
<include name="**/*.so"/>
</fileset>
</zip>
<delete file="dist/jinput-natives-osx.zip" failonerror="false"/>
<zip destfile="dist/jinput-natives-osx.zip" >
<fileset dir="dist/">
<include name="**/*.jnilib"/>
</fileset>
</zip>
<delete file="dist/jinput-javadoc.zip" failonerror="false"/>
<zip destfile="dist/jinput-javadoc.zip">
<fileset dir="coreAPI/apidocs/"/>
</zip>
<delete file="dist/jinput-sources.zip" failonerror="false"/>
<zip destfile="dist/jinput-sources.zip">
<fileset dir=".">
<include name="**/*.java"/>
<include name="**/*.h"/>
<include name="**/*.c"/>
</fileset>
</zip>
<zip destfile="dist/jinput-${mvn.version}.jar">
<zipfileset src="dist/jinput.jar">
<exclude name="net/java/games/util/**"/>
</zipfileset>
</zip>
<artifact:install file="dist/jinput-${mvn.version}.jar">
<pom refid="jinputpomfile" />
<attach file="dist/jinput-javadoc.zip" classifier="javadoc" type="jar"/>
<attach file="dist/jinput-sources.zip" classifier="sources" type="jar"/>
</artifact:install>
<artifact:install file="dist/jinput=${mvn.version}-platform.pom">
<pom refid="jinputplatformpomfile" />
<attach file="dist/jinput-natives-windows.zip" classifier="natives-windows" type="jar"/>
<attach file="dist/jinput-natives-linux.zip" classifier="natives-linux" type="jar"/>
<attach file="dist/jinput-natives-osx.zip" classifier="natives-osx" type="jar"/>
</artifact:install>
</target>
<target name="mvndeploy" depends="install" description="Installs jinput in to local mvn repo">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}.pom" />
<arg value="-Dfile=dist/jinput-${mvn.version}.jar" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}.pom" />
<arg value="-Dfile=dist/jinput-javadoc.zip" />
<arg value="-Dpackaging=jar"/>
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}.pom" />
<arg value="-Dfile=dist/jinput-sources.zip" />
<arg value="-Dpackaging=jar"/>
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}-platform.pom" />
<arg value="-Dfile=dist/jinput-natives-windows.zip" />
<arg value="-Dpackaging=jar"/>
<arg value="-Dclassifier=natives-windows" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}-platform.pom" />
<arg value="-Dfile=dist/jinput-natives-linux.zip" />
<arg value="-Dpackaging=jar"/>
<arg value="-Dclassifier=natives-linux" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}-platform.pom" />
<arg value="-Dfile=dist/jinput-natives-osx.zip" />
<arg value="-Dpackaging=jar"/>
<arg value="-Dclassifier=natives-osx" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
</project>

View file

@ -17,6 +17,22 @@
<artifactId>coreapi</artifactId>
<version>${project.version}</version>
</dependency>
<!--
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>windows-plugin</artifactId>
<version>${project.version}</version>
<classifier>natives-windows</classifier>
</dependency>
-->
<!--
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>osx-plugin</artifactId>
<version>${project.version}</version>
<classifier>natives-osx</classifier>
</dependency>
-->
</dependencies>
<build>
@ -27,6 +43,128 @@
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.googlecode.mavennatives</groupId>
<artifactId>maven-nativedependencies-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>linux</id>
<activation>
<os>
<family>linux</family>
</os>
</activation>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>linux-plugin</artifactId>
<version>${project.version}</version>
<classifier>natives-linux</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>linux-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>osx</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>osx-plugin</artifactId>
<version>${project.version}</version>
<classifier>natives-osx</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>osx-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>windows-plugin</artifactId>
<version>${project.version}</version>
<classifier>natives-windows</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>windows-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>wintab</id>
<activation>
<os>
<family>windows</family>
</os>
<property>
<name>env.WINTABSDKDIR</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>wintab-plugin</artifactId>
<version>${project.version}</version>
<classifier>natives-wintab</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>wintab-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>ReadAllEvents</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>-Djava.library.path=${project.build.directory}/natives</argument>
<argument>net.java.games.input.example.ReadAllEvents</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -1,27 +0,0 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-platform</artifactId>
<packaging>pom</packaging>
<name>JInput natives</name>
<version>@VERSION@</version>
<description>Library for access to input devices.</description>
<url>https://github.com/jinput/jinput</url>
<licenses>
<license>
<name>BSD</name>
<url>http://www.opensource.org/licenses/bsd-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>Members</id>
<url>https://github.com/jinput/jinput/graphs/contributors</url>
</developer>
</developers>
<scm>
<url>https://github.com/jinput/jinput</url>
<connection>scm:git:git@github.com:jinput/jinput.git</connection>
</scm>
</project>

View file

@ -1,55 +0,0 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>net.java.jinput</groupId>
<artifactId>jinput</artifactId>
<packaging>jar</packaging>
<name>JInput</name>
<version>@VERSION@</version>
<description>Library for access to input devices.</description>
<url>https://github.com/jinput/jinput</url>
<licenses>
<license>
<name>BSD</name>
<url>http://www.opensource.org/licenses/bsd-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>Members</id>
<url>https://github.com/jinput/jinput/graphs/contributors</url>
</developer>
</developers>
<scm>
<url>https://github.com/jinput/jinput</url>
<connection>https://github.com/jinput/jinput</connection>
</scm>
<dependencies>
<dependency>
<groupId>net.java.jutils</groupId>
<artifactId>jutils</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-platform</artifactId>
<version>@VERSION@</version>
<classifier>natives-linux</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-platform</artifactId>
<version>@VERSION@</version>
<classifier>natives-windows</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-platform</artifactId>
<version>@VERSION@</version>
<classifier>natives-osx</classifier>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>

View file

@ -3,15 +3,15 @@
<description>OSX JInput Native Plugin</description>
<target name="init">
<mkdir dir="target/natives"/>
<mkdir dir="target/natives/x86_64"/>
</target>
<target name="compile">
<apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}">
<arg line="${cflags} -O2 -Wall -c -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I../../../../common/src/native -I.."/>
<arg line="${cflags} -O2 -Wall -c -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I../../../../common/src/native -I../../generated-sources/natives/"/>
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="." includes="*.c"/>
<fileset dir="../../../common/src/native" includes="*.c"/>
<fileset dir="src/main/native" includes="*.c"/>
<fileset dir="../common/src/native" includes="*.c"/>
</apply>
</target>
@ -27,55 +27,25 @@
</target>
<target name="compileNativeJinputLib" depends="init">
<property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.3.9.sdk"/>
<property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/>
<property name="x86_64_sdkroot" location="/Developer/SDKs/MacOSX10.5.sdk"/>
<property name="ppc_flags" value="-isysroot ${universal_sdkroot} -arch ppc -mmacosx-version-min=10.3"/>
<property name="universal_flags" value="-isysroot ${universal_sdkroot} -arch i386 -mmacosx-version-min=10.4"/>
<property name="x86_64_sdkroot" location="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk"/>
<property name="x86_64_flags" value="-isysroot ${x86_64_sdkroot} -arch x86_64 -mmacosx-version-min=10.5"/>
<antcall target="compile">
<param name="dstdir" location="target/natives/ppc"/>
<param name="compiler" value="gcc-4.0"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
<param name="cflags" value="${ppc_flags}"/>
</antcall>
<antcall target="link">
<param name="objdir" location="target/natives/ppc"/>
<param name="libname" value="libjinput-osx-ppc.jnilib"/>
<param name="linker" value="gcc-4.0"/>
<param name="linkerflags" value="${ppc_flags}"/>
</antcall>
<antcall target="compile">
<param name="dstdir" location="target/natives/i386"/>
<param name="compiler" value="gcc-4.0"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
<param name="cflags" value="${universal_flags}"/>
</antcall>
<antcall target="link">
<param name="objdir" location="target/natives/i386"/>
<param name="libname" value="libjinput-osx-i386.jnilib"/>
<param name="linker" value="gcc-4.0"/>
<param name="linkerflags" value="${universal_flags}"/>
</antcall>
<antcall target="compile">
<param name="dstdir" location="target/natives/x86_64"/>
<param name="compiler" value="gcc-4.0"/>
<param name="compiler" value="gcc"/>
<param name="sdkroot" location="${x86_64_sdkroot}"/>
<param name="cflags" value="${x86_64_flags}"/>
</antcall>
<antcall target="link">
<param name="objdir" location="target/natives/x86_64"/>
<param name="libname" value="libjinput-osx-x86_64.jnilib"/>
<param name="linker" value="gcc-4.0"/>
<param name="linker" value="gcc"/>
<param name="linkerflags" value="${x86_64_flags}"/>
</antcall>
<apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" >
<apply dir="target/natives" parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" >
<arg value="-create"/>
<srcfile/>
<arg value="-output"/>
<arg path="libjinput-osx.jnilib"/>
<fileset file="target/natives/ppc/libjinput-osx-ppc.jnilib"/>
<fileset file="target/natives/i386/libjinput-osx-i386.jnilib"/>
<arg path="target/natives/libjinput-osx.jnilib"/>
<fileset file="target/natives/x86_64/libjinput-osx-x86_64.jnilib"/>
</apply>
</target>

View file

@ -1,3 +0,0 @@
/net_java_games_input_OSXHIDDevice.h
/net_java_games_input_OSXHIDDeviceIterator.h
/net_java_games_input_OSXHIDQueue.h

View file

@ -42,7 +42,7 @@
<id>OSX</id>
<activation>
<os>
<family>macos</family>
<family>mac</family>
</os>
</activation>
<modules>
@ -50,10 +50,18 @@
</modules>
</profile>
<profile>
<id>Wintab</id>
<id>wintab</id>
<activation>
<os>
<family>windows</family>
</os>
<property>
<name>env.WINTABSDKDIR</name>
</property>
</activation>
<modules>
<module>wintab</module>
</modules>
</profile>
</profiles>
</project>
</project>

View file

@ -1 +0,0 @@
/net_java_games_input_DummyWindow.h

View file

@ -1,3 +0,0 @@
/net_java_games_input_IDirectInput.h
/net_java_games_input_IDirectInputDevice.h
/net_java_games_input_IDirectInputEffect.h

View file

@ -1,4 +0,0 @@
/net_java_games_input_RawDevice.h
/net_java_games_input_RawInputEnvironmentPlugin.h
/net_java_games_input_RawInputEventQueue_QueueThread.h
/net_java_games_input_RawInputEventQueue.h

View file

@ -1,76 +0,0 @@
<?xml version="1.0"?>
<project name="WinTab Input Plugin" basedir="." default="all">
<target name="init">
<mkdir dir="classes"/>
<mkdir dir="bin"/>
<condition property="wintab" >
<os family="Windows" arch="x86"/>
</condition>
</target>
<target name="compile" depends="init">
<javac srcdir="../windows/src/java" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4">
<include name="**/DummyWindow.java"/>
</javac>
<javac srcdir="src/java" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4">
<!-- To add something to the classpath: -->
<classpath>
<pathelement location="../../coreAPI/bin/jinput-core.jar"/>
<pathelement location="../../lib/jutils.jar"/>
</classpath>
</javac>
</target>
<target depends="init,compile" name="create_jniheaders">
<javah destdir="src/native">
<classpath>
<pathelement path="classes"/>
<pathelement location="../../coreAPI/classes"/>
</classpath>
<class name="net.java.games.input.DummyWindow"/>
<class name="net.java.games.input.WinTabContext"/>
<class name="net.java.games.input.WinTabDevice"/>
<class name="net.java.games.input.WinTabComponent"/>
</javah>
</target>
<target name="compile_native" depends="init,create_jniheaders" if="wintab">
<ant dir="src/native" target="compile"/>
<copy todir="bin">
<fileset dir="src/native" includes="*.dll"/>
</copy>
</target>
<target name="jar" depends="init,compile">
<jar jarfile="bin/wintab.jar" compress="true" basedir="classes">
<include name="**/*.class"/>
</jar>
</target>
<target name="all" depends="compile,compile_native,jar" description="Build everything.">
</target>
<target name="javadoc" depends="init" description="Javadoc for my API.">
<mkdir dir="apidocs"/>
<javadoc packagenames="net.*"
destdir="apidocs"
additionalparam="-source 1.4">
<sourcepath>
<pathelement location="src/java"/>
</sourcepath>
<classpath>
<pathelement location="../windows/src/java"/>
<pathelement location="../../bin/jinput-core.jar"/>
<pathelement location="../../lib/jutils.jar"/>
</classpath>
</javadoc>
</target>
<target name="clean" depends="init" description="Clean all build products.">
<delete dir="classes" failonerror="no"/>
<delete dir="bin" failonerror="no"/>
<delete dir="apidocs" failonerror="no"/>
<ant inheritAll="false" antfile="src/native/build.xml" target="clean"/>
</target>
</project>

75
plugins/wintab/pom.xml Normal file
View file

@ -0,0 +1,75 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>wintab-plugin</artifactId>
<packaging>jar</packaging>
<name>JInput - Wintab Plugin</name>
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.8-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>net.java.jinput</groupId>
<artifactId>windows-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-h</arg>
<arg>${project.build.directory}/generated-sources/natives</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<target>
<ant dir="${project.build.sourceDirectory}/../native"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classesDirectory>${project.build.directory}/natives</classesDirectory>
<classifier>natives-wintab</classifier>
<includes>
<include>*.dll</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -33,14 +33,6 @@ import java.util.List;
public class WinTabComponent extends AbstractComponent {
public final static int XAxis = 1;
public final static int YAxis = 2;
public final static int ZAxis = 3;
public final static int NPressureAxis = 4;
public final static int TPressureAxis = 5;
public final static int OrientationAxis = 6;
public final static int RotationAxis = 7;
private int min;
private int max;
protected float lastKnownValue;
@ -77,27 +69,27 @@ public class WinTabComponent extends AbstractComponent {
List components = new ArrayList();
Identifier id;
switch(axisId) {
case XAxis:
case WinTabDevice.XAxis:
id = Identifier.Axis.X;
components.add(new WinTabComponent(context, parentDevice, id.getName(), id, axisRanges[0], axisRanges[1]));
break;
case YAxis:
case WinTabDevice.YAxis:
id = Identifier.Axis.Y;
components.add(new WinTabComponent(context, parentDevice, id.getName(), id, axisRanges[0], axisRanges[1]));
break;
case ZAxis:
case WinTabDevice.ZAxis:
id = Identifier.Axis.Z;
components.add(new WinTabComponent(context, parentDevice, id.getName(), id, axisRanges[0], axisRanges[1]));
break;
case NPressureAxis:
case WinTabDevice.NPressureAxis:
id = Identifier.Axis.X_FORCE;
components.add(new WinTabComponent(context, parentDevice, id.getName(), id, axisRanges[0], axisRanges[1]));
break;
case TPressureAxis:
case WinTabDevice.TPressureAxis:
id = Identifier.Axis.Y_FORCE;
components.add(new WinTabComponent(context, parentDevice, id.getName(), id, axisRanges[0], axisRanges[1]));
break;
case OrientationAxis:
case WinTabDevice.OrientationAxis:
id = Identifier.Axis.RX;
components.add(new WinTabComponent(context, parentDevice, id.getName(), id, axisRanges[0], axisRanges[1]));
id = Identifier.Axis.RY;
@ -105,7 +97,7 @@ public class WinTabComponent extends AbstractComponent {
id = Identifier.Axis.RZ;
components.add(new WinTabComponent(context, parentDevice, id.getName(), id, axisRanges[4], axisRanges[5]));
break;
case RotationAxis:
case WinTabDevice.RotationAxis:
id = Identifier.Axis.RX;
components.add(new WinTabComponent(context, parentDevice, id.getName(), id, axisRanges[0], axisRanges[1]));
id = Identifier.Axis.RY;

View file

@ -30,6 +30,14 @@ import java.util.ArrayList;
import java.util.List;
public class WinTabDevice extends AbstractController {
public final static int XAxis = 1;
public final static int YAxis = 2;
public final static int ZAxis = 3;
public final static int NPressureAxis = 4;
public final static int TPressureAxis = 5;
public final static int OrientationAxis = 6;
public final static int RotationAxis = 7;
private WinTabContext context;
private List eventList = new ArrayList();
@ -74,60 +82,60 @@ public class WinTabDevice extends AbstractController {
WinTabEnvironmentPlugin.logln("Device " + deviceIndex + ", name: " + name);
List componentsList = new ArrayList();
int[] axisDetails = nGetAxisDetails(deviceIndex, WinTabComponent.XAxis);
int[] axisDetails = nGetAxisDetails(deviceIndex, XAxis);
if(axisDetails.length==0) {
WinTabEnvironmentPlugin.logln("ZAxis not supported");
} else {
WinTabEnvironmentPlugin.logln("Xmin: " + axisDetails[0] + ", Xmax: " + axisDetails[1]);
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, WinTabComponent.XAxis, axisDetails));
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, XAxis, axisDetails));
}
axisDetails = nGetAxisDetails(deviceIndex, WinTabComponent.YAxis);
axisDetails = nGetAxisDetails(deviceIndex, YAxis);
if(axisDetails.length==0) {
WinTabEnvironmentPlugin.logln("YAxis not supported");
} else {
WinTabEnvironmentPlugin.logln("Ymin: " + axisDetails[0] + ", Ymax: " + axisDetails[1]);
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, WinTabComponent.YAxis, axisDetails));
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, YAxis, axisDetails));
}
axisDetails = nGetAxisDetails(deviceIndex, WinTabComponent.ZAxis);
axisDetails = nGetAxisDetails(deviceIndex, ZAxis);
if(axisDetails.length==0) {
WinTabEnvironmentPlugin.logln("ZAxis not supported");
} else {
WinTabEnvironmentPlugin.logln("Zmin: " + axisDetails[0] + ", Zmax: " + axisDetails[1]);
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, WinTabComponent.ZAxis, axisDetails));
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, ZAxis, axisDetails));
}
axisDetails = nGetAxisDetails(deviceIndex, WinTabComponent.NPressureAxis);
axisDetails = nGetAxisDetails(deviceIndex, NPressureAxis);
if(axisDetails.length==0) {
WinTabEnvironmentPlugin.logln("NPressureAxis not supported");
} else {
WinTabEnvironmentPlugin.logln("NPressMin: " + axisDetails[0] + ", NPressMax: " + axisDetails[1]);
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, WinTabComponent.NPressureAxis, axisDetails));
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, NPressureAxis, axisDetails));
}
axisDetails = nGetAxisDetails(deviceIndex, WinTabComponent.TPressureAxis);
axisDetails = nGetAxisDetails(deviceIndex, TPressureAxis);
if(axisDetails.length==0) {
WinTabEnvironmentPlugin.logln("TPressureAxis not supported");
} else {
WinTabEnvironmentPlugin.logln("TPressureAxismin: " + axisDetails[0] + ", TPressureAxismax: " + axisDetails[1]);
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, WinTabComponent.TPressureAxis, axisDetails));
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, TPressureAxis, axisDetails));
}
axisDetails = nGetAxisDetails(deviceIndex, WinTabComponent.OrientationAxis);
axisDetails = nGetAxisDetails(deviceIndex, OrientationAxis);
if(axisDetails.length==0) {
WinTabEnvironmentPlugin.logln("OrientationAxis not supported");
} else {
WinTabEnvironmentPlugin.logln("OrientationAxis mins/maxs: " + axisDetails[0] + "," + axisDetails[1] + ", " + axisDetails[2] + "," + axisDetails[3] + ", " + axisDetails[4] + "," + axisDetails[5]);
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, WinTabComponent.OrientationAxis, axisDetails));
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, OrientationAxis, axisDetails));
}
axisDetails = nGetAxisDetails(deviceIndex, WinTabComponent.RotationAxis);
axisDetails = nGetAxisDetails(deviceIndex, RotationAxis);
if(axisDetails.length==0) {
WinTabEnvironmentPlugin.logln("RotationAxis not supported");
} else {
WinTabEnvironmentPlugin.logln("RotationAxis is supported (by the device, not by this plugin)");
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, WinTabComponent.RotationAxis, axisDetails));
componentsList.addAll(WinTabComponent.createComponents(context, deviceIndex, RotationAxis, axisDetails));
}
String[] cursorNames = nGetCursorNames(deviceIndex);

View file

@ -0,0 +1,167 @@
/*----------------------------------------------------------------------------
NAME
Utils.c
PURPOSE
Some general-purpose functions for the WinTab demos.
COPYRIGHT
Copyright (c) Wacom Company, Ltd. 2014 All Rights Reserved
All rights reserved.
The text and information contained in this file may be freely used,
copied, or distributed without compensation or licensing restrictions.
---------------------------------------------------------------------------- */
#include "WinTabUtils.h"
#ifdef WACOM_DEBUG
void WacomTrace( char *lpszFormat, ...);
#define WACOM_ASSERT( x ) assert( x )
#define WACOM_TRACE(...) WacomTrace(__VA_ARGS__)
#else
#define WACOM_TRACE(...)
#define WACOM_ASSERT( x )
#endif // WACOM_DEBUG
//////////////////////////////////////////////////////////////////////////////
HINSTANCE ghWintab = NULL;
WTINFOA gpWTInfoA = NULL;
WTOPENA gpWTOpenA = NULL;
WTGETA gpWTGetA = NULL;
WTSETA gpWTSetA = NULL;
WTCLOSE gpWTClose = NULL;
WTPACKET gpWTPacket = NULL;
WTENABLE gpWTEnable = NULL;
WTOVERLAP gpWTOverlap = NULL;
WTSAVE gpWTSave = NULL;
WTCONFIG gpWTConfig = NULL;
WTRESTORE gpWTRestore = NULL;
WTEXTSET gpWTExtSet = NULL;
WTEXTGET gpWTExtGet = NULL;
WTQUEUESIZESET gpWTQueueSizeSet = NULL;
WTDATAPEEK gpWTDataPeek = NULL;
WTPACKETSGET gpWTPacketsGet = NULL;
// TODO - add more wintab32 function pointers as needed
#define GETPROCADDRESS(type, func) \
gp##func = (type)GetProcAddress(ghWintab, #func); \
if (!gp##func){ WACOM_ASSERT(FALSE); UnloadWintab(); return FALSE; }
//////////////////////////////////////////////////////////////////////////////
// Purpose
// Find wintab32.dll and load it.
// Find the exported functions we need from it.
//
// Returns
// TRUE on success.
// FALSE on failure.
//
BOOL LoadWintab( void )
{
ghWintab = LoadLibraryA( "Wintab32.dll" );
if ( !ghWintab )
{
DWORD err = GetLastError();
WACOM_TRACE("LoadLibrary error: %i\n", err);
return FALSE;
}
// Explicitly find the exported Wintab functions in which we are interested.
// We are using the ASCII, not unicode versions (where applicable).
GETPROCADDRESS( WTOPENA, WTOpenA );
GETPROCADDRESS( WTINFOA, WTInfoA );
GETPROCADDRESS( WTGETA, WTGetA );
GETPROCADDRESS( WTSETA, WTSetA );
GETPROCADDRESS( WTPACKET, WTPacket );
GETPROCADDRESS( WTCLOSE, WTClose );
GETPROCADDRESS( WTENABLE, WTEnable );
GETPROCADDRESS( WTOVERLAP, WTOverlap );
GETPROCADDRESS( WTSAVE, WTSave );
GETPROCADDRESS( WTCONFIG, WTConfig );
GETPROCADDRESS( WTRESTORE, WTRestore );
GETPROCADDRESS( WTEXTSET, WTExtSet );
GETPROCADDRESS( WTEXTGET, WTExtGet );
GETPROCADDRESS( WTQUEUESIZESET, WTQueueSizeSet );
GETPROCADDRESS( WTDATAPEEK, WTDataPeek );
GETPROCADDRESS( WTPACKETSGET, WTPacketsGet );
// TODO - don't forget to NULL out pointers in UnloadWintab().
return TRUE;
}
//////////////////////////////////////////////////////////////////////////////
// Purpose
// Uninitializes use of wintab32.dll
//
// Returns
// Nothing.
//
void UnloadWintab( void )
{
WACOM_TRACE( "UnloadWintab()\n" );
if ( ghWintab )
{
FreeLibrary( ghWintab );
ghWintab = NULL;
}
gpWTOpenA = NULL;
gpWTClose = NULL;
gpWTInfoA = NULL;
gpWTPacket = NULL;
gpWTEnable = NULL;
gpWTOverlap = NULL;
gpWTSave = NULL;
gpWTConfig = NULL;
gpWTGetA = NULL;
gpWTSetA = NULL;
gpWTRestore = NULL;
gpWTExtSet = NULL;
gpWTExtGet = NULL;
gpWTQueueSizeSet = NULL;
gpWTDataPeek = NULL;
gpWTPacketsGet = NULL;
}
#ifdef WACOM_DEBUG
//////////////////////////////////////////////////////////////////////////////
void WacomTrace( char *lpszFormat, ...)
{
char szTraceMessage[ 128 ];
int nBytesWritten;
va_list args;
WACOM_ASSERT( lpszFormat );
va_start( args, lpszFormat );
nBytesWritten = _vsnprintf( szTraceMessage, sizeof( szTraceMessage ) - 1,
lpszFormat, args );
if ( nBytesWritten > 0 )
{
OutputDebugStringA( szTraceMessage );
}
va_end( args );
}
#endif // WACOM_DEBUG

View file

@ -0,0 +1,92 @@
/*----------------------------------------------------------------------------
NAME
Utils.h
PURPOSE
Defines for the general-purpose functions for the WinTab demos.
COPYRIGHT
Copyright (c) Wacom Company, Ltd. 2014 All Rights Reserved
All rights reserved.
The text and information contained in this file may be freely used,
copied, or distributed without compensation or licensing restrictions.
---------------------------------------------------------------------------- */
#pragma once
#include <windows.h>
#include <stdio.h>
#include <assert.h>
#include <stdarg.h>
#include "wintab.h" // NOTE: get from wactab header package
//////////////////////////////////////////////////////////////////////////////
#define WACOM_DEBUG
// Ignore warnings about using unsafe string functions.
#pragma warning( disable : 4996 )
//////////////////////////////////////////////////////////////////////////////
// Function pointers to Wintab functions exported from wintab32.dll.
typedef UINT ( API * WTINFOA ) ( UINT, UINT, LPVOID );
typedef HCTX ( API * WTOPENA )( HWND, LPLOGCONTEXTA, BOOL );
typedef BOOL ( API * WTGETA ) ( HCTX, LPLOGCONTEXT );
typedef BOOL ( API * WTSETA ) ( HCTX, LPLOGCONTEXT );
typedef BOOL ( API * WTCLOSE ) ( HCTX );
typedef BOOL ( API * WTENABLE ) ( HCTX, BOOL );
typedef BOOL ( API * WTPACKET ) ( HCTX, UINT, LPVOID );
typedef BOOL ( API * WTOVERLAP ) ( HCTX, BOOL );
typedef BOOL ( API * WTSAVE ) ( HCTX, LPVOID );
typedef BOOL ( API * WTCONFIG ) ( HCTX, HWND );
typedef HCTX ( API * WTRESTORE ) ( HWND, LPVOID, BOOL );
typedef BOOL ( API * WTEXTSET ) ( HCTX, UINT, LPVOID );
typedef BOOL ( API * WTEXTGET ) ( HCTX, UINT, LPVOID );
typedef BOOL ( API * WTQUEUESIZESET ) ( HCTX, int );
typedef int ( API * WTDATAPEEK ) ( HCTX, UINT, UINT, int, LPVOID, LPINT);
typedef int ( API * WTPACKETSGET ) (HCTX, int, LPVOID);
// TODO - add more wintab32 function defs as needed
// Loaded Wintab32 API functions.
extern HINSTANCE ghWintab;
extern WTINFOA gpWTInfoA;
extern WTOPENA gpWTOpenA;
extern WTGETA gpWTGetA;
extern WTSETA gpWTSetA;
extern WTCLOSE gpWTClose;
extern WTPACKET gpWTPacket;
extern WTENABLE gpWTEnable;
extern WTOVERLAP gpWTOverlap;
extern WTSAVE gpWTSave;
extern WTCONFIG gpWTConfig;
extern WTRESTORE gpWTRestore;
extern WTEXTSET gpWTExtSet;
extern WTEXTGET gpWTExtGet;
extern WTQUEUESIZESET gpWTQueueSizeSet;
extern WTDATAPEEK gpWTDataPeek;
extern WTPACKETSGET gpWTPacketsGet;
// TODO - add more wintab32 function pointers as needed
//////////////////////////////////////////////////////////////////////////////
BOOL LoadWintab( void );
void UnloadWintab( void );
//////////////////////////////////////////////////////////////////////////////
#ifdef WACOM_DEBUG
void WacomTrace( char *lpszFormat, ...);
#define WACOM_ASSERT( x ) assert( x )
#define WACOM_TRACE(...) WacomTrace(__VA_ARGS__)
#else
#define WACOM_TRACE(...)
#define WACOM_ASSERT( x )
#endif // WACOM_DEBUG

View file

@ -0,0 +1,65 @@
<?xml version="1.0"?>
<project name="JInput wintab port, Native code" basedir="." default="compile">
<property environment="env"/>
<property name="wintabhome" location="${env.WintabSdkDir}"/>
<property name="sdkhome" location="${env.WindowsSdkDir}"/>
<property name="generated-natives" location="..\..\..\target\generated-sources\natives"/>
<property name="compiled-natives" location="..\..\..\target/natives"/>
<property name="jinput-windows-headers" location="../../../../windows/target/generated-sources/natives"/>
<property name="jinput-windows-sources" location="../../../../windows/src/main/native"/>
<target name="init">
<mkdir dir="${compiled-natives}"/>
</target>
<target name="compile_dir">
<echo message="${compiledir}"/>
<echo message="wintab: ${wintabhome}"/>
<apply dir="${compiled-natives}" failonerror="true" executable="cl" dest="${compiled-natives}" skipemptyfilesets="true">
<arg line="/Ox /W2 /nologo /c"/>
<arg line="/I&quot;${sdkhome}\include&quot;"/>
<arg line="/I&quot;${wintabhome}&quot;"/>
<arg line="/I&quot;${java.home}\include&quot;"/>
<arg line="/I&quot;${java.home}\include\win32&quot;"/>
<arg value="/I${commonhome}/src/native"/>
<arg value="/I${generated-natives}"/>
<arg value="/I${jinput-windows-headers}"/>
<srcfile/>
<fileset dir="${compiledir}" includes="*.c"/>
<mapper type="glob" from="*.c" to="*.obj"/>
</apply>
</target>
<target name="link">
<apply dir="${compiled-natives}" parallel="true" executable="cl" failonerror="true">
<arg line="/LD /nologo"/>
<srcfile/>
<arg line="/Fe${dllname} /link"/>
<arg line="/LIBPATH:&quot;${java.home}\lib&quot;"/>
<arg line="/LIBPATH:&quot;${sdkhome}\lib&quot;"/>
<arg line="/DLL ${libs}"/>
<fileset dir="${compiled-natives}" includes="*.obj"/>
</apply>
</target>
<target name="compile" depends="init">
<property name="wintablibs" value="Kernel32.lib User32.lib"/>
<property name="commonhome" location="../../../../common"/>
<property name="dllname" value="jinput-wintab.dll"/>
<antcall target="compile_dir">
<param name="compiledir" location="${commonhome}/src/native"/>
</antcall>
<antcall target="compile_dir">
<param name="compiledir" location="."/>
</antcall>
<antcall target="compile_dir">
<param name="compiledir" location="${jinput-windows-sources}"/>
</antcall>
<antcall target="link">
<param name="dllname" value="${dllname}"/>
<param name="libs" value="${wintablibs}"/>
</antcall>
</target>
</project>

View file

@ -3,6 +3,7 @@
#include <jni.h>
#include "net_java_games_input_WinTabContext.h"
#include "wintabutils.h"
#include <wintab.h>
//#define PACKETDATA ( PK_X | PK_Y | PK_Z | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_TANGENT_PRESSURE | PK_ROTATION | PK_ORIENTATION | PK_CURSOR )
#define PACKETDATA ( PK_TIME | PK_X | PK_Y | PK_Z | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_TANGENT_PRESSURE | PK_ORIENTATION | PK_CURSOR )
@ -22,7 +23,19 @@ JNIEXPORT jlong JNICALL Java_net_java_games_input_WinTabContext_nOpen(JNIEnv *en
jmethodID getBooleanMethod = (*env)->GetStaticMethodID(env, booleanClass, "getBoolean", "(Ljava/lang/String;)Z");
jboolean detachCursor = (*env)->CallStaticBooleanMethod(env, booleanClass, getBooleanMethod, propertyName);
WTInfo(WTI_DEFCONTEXT, 0, &context);
if(!LoadWintab()) {
throwIOException(env, "Failed to load wintab (%d)\n", GetLastError());
} else {
printfJava(env, "Wintab dll loaded\n");
}
if (!gpWTInfoA(0, 0, NULL)) {
throwIOException(env, "Wintab is not available (%d)\n", GetLastError());
} else {
printfJava(env, "Wintab is available\n");
}
gpWTInfoA(WTI_DEFCONTEXT, 0, &context);
wsprintf(context.lcName, "JInput Digitizing");
context.lcPktData = PACKETDATA;
@ -34,18 +47,19 @@ JNIEXPORT jlong JNICALL Java_net_java_games_input_WinTabContext_nOpen(JNIEnv *en
}
/* open the region */
hCtx = WTOpen(hWnd, &context, TRUE);
hCtx = gpWTOpenA(hWnd, &context, TRUE);
return (jlong)(intptr_t)hCtx;
}
JNIEXPORT void JNICALL Java_net_java_games_input_WinTabContext_nClose(JNIEnv *env, jclass unused, jlong hCtx_long) {
WTClose((HCTX)(INT_PTR)hCtx_long);
gpWTClose((HCTX)(INT_PTR)hCtx_long);
UnloadWintab();
}
JNIEXPORT jint JNICALL Java_net_java_games_input_WinTabContext_nGetNumberOfSupportedDevices(JNIEnv *env, jclass unused) {
int numDevices;
WTInfo(WTI_INTERFACE, IFC_NDEVICES, &numDevices);
gpWTInfoA(WTI_INTERFACE, IFC_NDEVICES, &numDevices);
return numDevices;
}
@ -54,7 +68,7 @@ JNIEXPORT jobjectArray JNICALL Java_net_java_games_input_WinTabContext_nGetPacke
jobjectArray retval;
int i=0;
PACKET packets[MAX_PACKETS];
int numberRead = WTPacketsGet((HCTX)(INT_PTR)hCtx_long, MAX_PACKETS, packets);
int numberRead = gpWTPacketsGet((HCTX)(INT_PTR)hCtx_long, MAX_PACKETS, packets);
jclass winTabPacketClass = (*env)->FindClass(env, "net/java/games/input/WinTabPacket");
jfieldID packetTimeField = (*env)->GetFieldID(env, winTabPacketClass, "PK_TIME", "J");
jfieldID packetXAxisField = (*env)->GetFieldID(env, winTabPacketClass, "PK_X", "I");

View file

@ -3,8 +3,8 @@
#include <jni.h>
#include "net_java_games_input_WinTabDevice.h"
#include "net_java_games_input_WinTabComponent.h"
#include "util.h"
#include "wintabutils.h"
#include <wintab.h>
#include <malloc.h>
#define PACKETDATA ( PK_X | PK_Y | PK_Z | PK_BUTTONS | PK_NORMAL_PRESSURE | PK_ORIENTATION | PK_CURSOR )
@ -13,7 +13,7 @@
JNIEXPORT jstring JNICALL Java_net_java_games_input_WinTabDevice_nGetName(JNIEnv *env, jclass unused, jint deviceIndex) {
char name[50];
WTInfo(WTI_DEVICES + deviceIndex, DVC_NAME, name);
gpWTInfoA(WTI_DEVICES + deviceIndex, DVC_NAME, name);
return (*env)->NewStringUTF(env, name);
}
@ -26,16 +26,16 @@ JNIEXPORT jintArray JNICALL Java_net_java_games_input_WinTabDevice_nGetAxisDetai
int res;
jintArray retVal = NULL;
if(axisId==net_java_games_input_WinTabComponent_XAxis) type = DVC_X;
else if(axisId==net_java_games_input_WinTabComponent_YAxis) type = DVC_Y;
else if(axisId==net_java_games_input_WinTabComponent_ZAxis) type = DVC_Z;
else if(axisId==net_java_games_input_WinTabComponent_NPressureAxis) type = DVC_NPRESSURE;
else if(axisId==net_java_games_input_WinTabComponent_TPressureAxis) type = DVC_TPRESSURE;
else if(axisId==net_java_games_input_WinTabComponent_OrientationAxis) type = DVC_ORIENTATION;
else if(axisId==net_java_games_input_WinTabComponent_RotationAxis) type = DVC_ROTATION;
if(axisId==net_java_games_input_WinTabDevice_XAxis) type = DVC_X;
else if(axisId==net_java_games_input_WinTabDevice_YAxis) type = DVC_Y;
else if(axisId==net_java_games_input_WinTabDevice_ZAxis) type = DVC_Z;
else if(axisId==net_java_games_input_WinTabDevice_NPressureAxis) type = DVC_NPRESSURE;
else if(axisId==net_java_games_input_WinTabDevice_TPressureAxis) type = DVC_TPRESSURE;
else if(axisId==net_java_games_input_WinTabDevice_OrientationAxis) type = DVC_ORIENTATION;
else if(axisId==net_java_games_input_WinTabDevice_RotationAxis) type = DVC_ROTATION;
if(axisId==net_java_games_input_WinTabComponent_RotationAxis || axisId==net_java_games_input_WinTabComponent_OrientationAxis) {
res = WTInfo(WTI_DEVICES + deviceIndex, type, &threeAxisArray);
if(axisId==net_java_games_input_WinTabDevice_RotationAxis || axisId==net_java_games_input_WinTabDevice_OrientationAxis) {
res = gpWTInfoA(WTI_DEVICES + deviceIndex, type, &threeAxisArray);
if(res!=0) {
threeAxisData[0] = threeAxisArray[0].axMin;
threeAxisData[1] = threeAxisArray[0].axMax;
@ -47,7 +47,7 @@ JNIEXPORT jintArray JNICALL Java_net_java_games_input_WinTabDevice_nGetAxisDetai
(*env)->SetIntArrayRegion(env, retVal, 0, 6, threeAxisData);
}
} else {
res = WTInfo(WTI_DEVICES + deviceIndex, type, &axis);
res = gpWTInfoA(WTI_DEVICES + deviceIndex, type, &axis);
if(res!=0) {
axisData[0] = axis.axMin;
axisData[1] = axis.axMax;
@ -72,13 +72,13 @@ JNIEXPORT jobjectArray JNICALL Java_net_java_games_input_WinTabDevice_nGetCursor
jstring nameString;
jobjectArray retval;
WTInfo(WTI_DEVICES + deviceId, DVC_NCSRTYPES, &numberCursorTypes);
WTInfo(WTI_DEVICES + deviceId, DVC_FIRSTCSR, &firstCursorType);
gpWTInfoA(WTI_DEVICES + deviceId, DVC_NCSRTYPES, &numberCursorTypes);
gpWTInfoA(WTI_DEVICES + deviceId, DVC_FIRSTCSR, &firstCursorType);
retval = (*env)->NewObjectArray(env, numberCursorTypes, stringClass, NULL);
for(i=0;i<numberCursorTypes;i++) {
WTInfo(WTI_CURSORS + i + firstCursorType, CSR_NAME, name);
gpWTInfoA(WTI_CURSORS + i + firstCursorType, CSR_NAME, name);
nameString = (*env)->NewStringUTF(env, name);
(*env)->SetObjectArrayElement(env, retval, i-firstCursorType, nameString);
}
@ -93,11 +93,11 @@ JNIEXPORT jint JNICALL Java_net_java_games_input_WinTabDevice_nGetMaxButtonCount
int i;
byte retval=0;
WTInfo(WTI_DEVICES + deviceId, DVC_NCSRTYPES, &numberCursorTypes);
WTInfo(WTI_DEVICES + deviceId, DVC_FIRSTCSR, &firstCursorType);
gpWTInfoA(WTI_DEVICES + deviceId, DVC_NCSRTYPES, &numberCursorTypes);
gpWTInfoA(WTI_DEVICES + deviceId, DVC_FIRSTCSR, &firstCursorType);
for(i=0;i<numberCursorTypes;i++) {
WTInfo(WTI_CURSORS + i + firstCursorType, CSR_BUTTONS, &buttonCount);
gpWTInfoA(WTI_CURSORS + i + firstCursorType, CSR_BUTTONS, &buttonCount);
if(buttonCount>retval) {
retval = buttonCount;
}

View file

@ -1,4 +0,0 @@
/net_java_games_input_DummyWindow.h
/net_java_games_input_WinTabComponent.h
/net_java_games_input_WinTabContext.h
/net_java_games_input_WinTabDevice.h

View file

@ -1,73 +0,0 @@
<?xml version="1.0"?>
<project name="JInput wintab port, Native code" basedir="." default="compile">
<property environment="env"/>
<property name="wintabhome" location="${env.WINTAB_DIR}"/>
<property name="sdkhome" location="c:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2"/>
<target name="compile_dir">
<echo message="${compiledir}"/>
<echo message="wintab: ${wintabhome}"/>
<apply dir="${compiledir}" failonerror="true" executable="cl" dest="${compiledir}" skipemptyfilesets="true">
<arg line="/Ox /Wp64 /W2 /nologo /c"/>
<arg value="/I${sdkhome}\include"/>
<arg value="/I${wintabhome}\include"/>
<arg value="/I${java.home}\..\include"/>
<arg value="/I${java.home}\..\include\win32"/>
<arg value="/I${commonhome}/src/native"/>
<arg value="/I.."/>
<srcfile/>
<fileset dir="${compiledir}" includes="*.c"/>
<mapper type="glob" from="*.c" to="*.obj"/>
</apply>
</target>
<!-- <target name="link" unless="nolink">-->
<target name="link">
<apply dir="." parallel="true" executable="cl" failonerror="true">
<arg line="/LD /nologo"/>
<srcfile/>
<arg line="/Fe${dllname} /link"/>
<arg value="/LIBPATH:${java.home}\lib"/>
<arg value="/LIBPATH:${wintabhome}\lib\I386"/>
<arg value="/LIBPATH:${sdkhome}\lib"/>
<arg line="/DLL ${libs}"/>
<fileset dir="${commonhome}/src/native" includes="*.obj"/>
<fileset dir="." includes="*.obj"/>
<fileset dir="../../../windows/src/native" includes="*.obj"/>
</apply>
</target>
<target name="clean">
<delete>
<fileset dir="." includes="*.obj"/>
<fileset dir="." includes="*.dll"/>
<fileset dir="." includes="*.h"/>
<fileset dir="." includes="*.exp"/>
<fileset dir="." includes="*.lib"/>
</delete>
</target>
<target name="compile" if="wintabhome">
<property name="wintablibs" value="Kernel32.lib WINTAB32.LIB User32.lib"/>
<property name="commonhome" location="../../../common"/>
<property name="dllname" value="jinput-wintab.dll"/>
<antcall target="compile_dir">
<param name="compiledir" location="${commonhome}/src/native"/>
</antcall>
<antcall target="compile_dir">
<param name="compiledir" location="."/>
</antcall>
<antcall target="compile_dir">
<param name="compiledir" location="../../../windows/src/native"/>
</antcall>
<!-- <uptodate property="nolink" targetfile="${dllname}">
<srcfiles dir="." includes="*.obj"/>
</uptodate>-->
<antcall target="link">
<param name="dllname" value="${dllname}"/>
<param name="libs" value="${wintablibs}"/>
</antcall>
</target>
</project>

13
pom.xml
View file

@ -103,6 +103,19 @@
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
</plugin>
<plugin>
<groupId>com.googlecode.mavennatives</groupId>
<artifactId>maven-nativedependencies-plugin</artifactId>
<version>0.0.7</version>
<executions>
<execution>
<id>unpacknatives</id>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>