diff --git a/build.xml b/build.xml
deleted file mode 100644
index 9496a5d..0000000
--- a/build.xml
+++ /dev/null
@@ -1,385 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/pom.xml b/examples/pom.xml
index 4f08317..990d916 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -17,6 +17,22 @@
coreapi
${project.version}
+
+
@@ -27,6 +43,128 @@
maven-javadoc-plugin
+
+ com.googlecode.mavennatives
+ maven-nativedependencies-plugin
+
+
+
+
+ linux
+
+
+ linux
+
+
+
+
+ ${project.groupId}
+ linux-plugin
+ ${project.version}
+ natives-linux
+
+
+ ${project.groupId}
+ linux-plugin
+ ${project.version}
+
+
+
+
+ osx
+
+
+ mac
+
+
+
+
+ ${project.groupId}
+ osx-plugin
+ ${project.version}
+ natives-osx
+
+
+ ${project.groupId}
+ osx-plugin
+ ${project.version}
+
+
+
+
+ windows
+
+
+ windows
+
+
+
+
+ ${project.groupId}
+ windows-plugin
+ ${project.version}
+ natives-windows
+
+
+ ${project.groupId}
+ windows-plugin
+ ${project.version}
+
+
+
+
+ wintab
+
+
+ windows
+
+
+ env.WINTABSDKDIR
+
+
+
+
+ ${project.groupId}
+ wintab-plugin
+ ${project.version}
+ natives-wintab
+
+
+ ${project.groupId}
+ wintab-plugin
+ ${project.version}
+
+
+
+
+ ReadAllEvents
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.6.0
+
+
+
+ exec
+
+
+
+
+ java
+
+ -classpath
+
+ -Djava.library.path=${project.build.directory}/natives
+ net.java.games.input.example.ReadAllEvents
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jinput-platform.pom b/jinput-platform.pom
deleted file mode 100644
index 8a47164..0000000
--- a/jinput-platform.pom
+++ /dev/null
@@ -1,27 +0,0 @@
-
- 4.0.0
- net.java.jinput
- jinput-platform
- pom
- JInput natives
- @VERSION@
- Library for access to input devices.
- https://github.com/jinput/jinput
-
-
- BSD
- http://www.opensource.org/licenses/bsd-license.php
- repo
-
-
-
-
- Members
- https://github.com/jinput/jinput/graphs/contributors
-
-
-
- https://github.com/jinput/jinput
- scm:git:git@github.com:jinput/jinput.git
-
-
\ No newline at end of file
diff --git a/jinput.pom b/jinput.pom
deleted file mode 100644
index a9c2cdb..0000000
--- a/jinput.pom
+++ /dev/null
@@ -1,55 +0,0 @@
-
- 4.0.0
- net.java.jinput
- jinput
- jar
- JInput
- @VERSION@
- Library for access to input devices.
- https://github.com/jinput/jinput
-
-
- BSD
- http://www.opensource.org/licenses/bsd-license.php
- repo
-
-
-
-
- Members
- https://github.com/jinput/jinput/graphs/contributors
-
-
-
- https://github.com/jinput/jinput
- https://github.com/jinput/jinput
-
-
-
- net.java.jutils
- jutils
- 1.0.0
-
-
- net.java.jinput
- jinput-platform
- @VERSION@
- natives-linux
- runtime
-
-
- net.java.jinput
- jinput-platform
- @VERSION@
- natives-windows
- runtime
-
-
- net.java.jinput
- jinput-platform
- @VERSION@
- natives-osx
- runtime
-
-
-
\ No newline at end of file
diff --git a/plugins/OSX/build.xml b/plugins/OSX/build.xml
index 264eebf..05bda4b 100644
--- a/plugins/OSX/build.xml
+++ b/plugins/OSX/build.xml
@@ -3,15 +3,15 @@
OSX JInput Native Plugin
-
+
-
+
-
-
+
+
@@ -27,55 +27,25 @@
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
-
-
+
diff --git a/plugins/OSX/src/main/native/.gitignore b/plugins/OSX/src/main/native/.gitignore
deleted file mode 100644
index 2b1c8e9..0000000
--- a/plugins/OSX/src/main/native/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/net_java_games_input_OSXHIDDevice.h
-/net_java_games_input_OSXHIDDeviceIterator.h
-/net_java_games_input_OSXHIDQueue.h
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 4f3f989..e003dc5 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -42,7 +42,7 @@
OSX
- macos
+ mac
@@ -50,10 +50,18 @@
- Wintab
+ wintab
+
+
+ windows
+
+
+ env.WINTABSDKDIR
+
+
wintab
-
\ No newline at end of file
+
diff --git a/plugins/windows/src/main/native/.gitignore b/plugins/windows/src/main/native/.gitignore
deleted file mode 100644
index 04fb3ee..0000000
--- a/plugins/windows/src/main/native/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/net_java_games_input_DummyWindow.h
diff --git a/plugins/windows/src/main/native/dx8/.gitignore b/plugins/windows/src/main/native/dx8/.gitignore
deleted file mode 100644
index 0fd0ace..0000000
--- a/plugins/windows/src/main/native/dx8/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/net_java_games_input_IDirectInput.h
-/net_java_games_input_IDirectInputDevice.h
-/net_java_games_input_IDirectInputEffect.h
diff --git a/plugins/windows/src/main/native/raw/.gitignore b/plugins/windows/src/main/native/raw/.gitignore
deleted file mode 100644
index fb0c52f..0000000
--- a/plugins/windows/src/main/native/raw/.gitignore
+++ /dev/null
@@ -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
diff --git a/plugins/wintab/build.xml b/plugins/wintab/build.xml
deleted file mode 100644
index 6e47c64..0000000
--- a/plugins/wintab/build.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/plugins/wintab/pom.xml b/plugins/wintab/pom.xml
new file mode 100644
index 0000000..4121eeb
--- /dev/null
+++ b/plugins/wintab/pom.xml
@@ -0,0 +1,75 @@
+
+ 4.0.0
+ wintab-plugin
+ jar
+ JInput - Wintab Plugin
+
+
+ net.java.jinput
+ plugins
+ 2.0.8-SNAPSHOT
+ ../
+
+
+
+
+ net.java.jinput
+ windows-plugin
+ ${project.version}
+
+
+
+
+
+
+ maven-source-plugin
+
+
+ maven-javadoc-plugin
+
+
+ maven-compiler-plugin
+
+
+ -h
+ ${project.build.directory}/generated-sources/natives
+
+
+
+
+ maven-antrun-plugin
+
+
+ compile
+
+
+
+
+
+
+ run
+
+
+
+
+
+ maven-jar-plugin
+
+
+ package
+
+ jar
+
+
+ ${project.build.directory}/natives
+ natives-wintab
+
+ *.dll
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/wintab/src/java/net/java/games/input/WinTabButtonComponent.java b/plugins/wintab/src/main/java/net/java/games/input/WinTabButtonComponent.java
similarity index 100%
rename from plugins/wintab/src/java/net/java/games/input/WinTabButtonComponent.java
rename to plugins/wintab/src/main/java/net/java/games/input/WinTabButtonComponent.java
diff --git a/plugins/wintab/src/java/net/java/games/input/WinTabComponent.java b/plugins/wintab/src/main/java/net/java/games/input/WinTabComponent.java
similarity index 94%
rename from plugins/wintab/src/java/net/java/games/input/WinTabComponent.java
rename to plugins/wintab/src/main/java/net/java/games/input/WinTabComponent.java
index 0c2944d..03bea98 100644
--- a/plugins/wintab/src/java/net/java/games/input/WinTabComponent.java
+++ b/plugins/wintab/src/main/java/net/java/games/input/WinTabComponent.java
@@ -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;
diff --git a/plugins/wintab/src/java/net/java/games/input/WinTabContext.java b/plugins/wintab/src/main/java/net/java/games/input/WinTabContext.java
similarity index 100%
rename from plugins/wintab/src/java/net/java/games/input/WinTabContext.java
rename to plugins/wintab/src/main/java/net/java/games/input/WinTabContext.java
diff --git a/plugins/wintab/src/java/net/java/games/input/WinTabCursorComponent.java b/plugins/wintab/src/main/java/net/java/games/input/WinTabCursorComponent.java
similarity index 100%
rename from plugins/wintab/src/java/net/java/games/input/WinTabCursorComponent.java
rename to plugins/wintab/src/main/java/net/java/games/input/WinTabCursorComponent.java
diff --git a/plugins/wintab/src/java/net/java/games/input/WinTabDevice.java b/plugins/wintab/src/main/java/net/java/games/input/WinTabDevice.java
similarity index 85%
rename from plugins/wintab/src/java/net/java/games/input/WinTabDevice.java
rename to plugins/wintab/src/main/java/net/java/games/input/WinTabDevice.java
index 819abc7..a6df095 100644
--- a/plugins/wintab/src/java/net/java/games/input/WinTabDevice.java
+++ b/plugins/wintab/src/main/java/net/java/games/input/WinTabDevice.java
@@ -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);
diff --git a/plugins/wintab/src/java/net/java/games/input/WinTabEnvironmentPlugin.java b/plugins/wintab/src/main/java/net/java/games/input/WinTabEnvironmentPlugin.java
similarity index 100%
rename from plugins/wintab/src/java/net/java/games/input/WinTabEnvironmentPlugin.java
rename to plugins/wintab/src/main/java/net/java/games/input/WinTabEnvironmentPlugin.java
diff --git a/plugins/wintab/src/java/net/java/games/input/WinTabPacket.java b/plugins/wintab/src/main/java/net/java/games/input/WinTabPacket.java
similarity index 100%
rename from plugins/wintab/src/java/net/java/games/input/WinTabPacket.java
rename to plugins/wintab/src/main/java/net/java/games/input/WinTabPacket.java
diff --git a/plugins/wintab/src/main/native/WinTabUtils.c b/plugins/wintab/src/main/native/WinTabUtils.c
new file mode 100644
index 0000000..3c9d709
--- /dev/null
+++ b/plugins/wintab/src/main/native/WinTabUtils.c
@@ -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
diff --git a/plugins/wintab/src/main/native/WinTabUtils.h b/plugins/wintab/src/main/native/WinTabUtils.h
new file mode 100644
index 0000000..89b31a3
--- /dev/null
+++ b/plugins/wintab/src/main/native/WinTabUtils.h
@@ -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
+#include
+#include
+#include
+
+#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
+
diff --git a/plugins/wintab/src/main/native/build.xml b/plugins/wintab/src/main/native/build.xml
new file mode 100644
index 0000000..8de51f9
--- /dev/null
+++ b/plugins/wintab/src/main/native/build.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/wintab/src/native/net_java_games_input_WinTabContext.c b/plugins/wintab/src/main/native/net_java_games_input_WinTabContext.c
similarity index 86%
rename from plugins/wintab/src/native/net_java_games_input_WinTabContext.c
rename to plugins/wintab/src/main/native/net_java_games_input_WinTabContext.c
index 99d6fe5..d455197 100644
--- a/plugins/wintab/src/native/net_java_games_input_WinTabContext.c
+++ b/plugins/wintab/src/main/native/net_java_games_input_WinTabContext.c
@@ -3,6 +3,7 @@
#include
#include "net_java_games_input_WinTabContext.h"
+#include "wintabutils.h"
#include
//#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");
diff --git a/plugins/wintab/src/native/net_java_games_input_WinTabDevice.c b/plugins/wintab/src/main/native/net_java_games_input_WinTabDevice.c
similarity index 63%
rename from plugins/wintab/src/native/net_java_games_input_WinTabDevice.c
rename to plugins/wintab/src/main/native/net_java_games_input_WinTabDevice.c
index 45f202e..45af0c1 100644
--- a/plugins/wintab/src/native/net_java_games_input_WinTabDevice.c
+++ b/plugins/wintab/src/main/native/net_java_games_input_WinTabDevice.c
@@ -3,8 +3,8 @@
#include
#include "net_java_games_input_WinTabDevice.h"
-#include "net_java_games_input_WinTabComponent.h"
#include "util.h"
+#include "wintabutils.h"
#include
#include
#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;iNewStringUTF(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;iretval) {
retval = buttonCount;
}
diff --git a/plugins/wintab/src/native/.gitignore b/plugins/wintab/src/native/.gitignore
deleted file mode 100644
index 85b86d0..0000000
--- a/plugins/wintab/src/native/.gitignore
+++ /dev/null
@@ -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
diff --git a/plugins/wintab/src/native/build.xml b/plugins/wintab/src/native/build.xml
deleted file mode 100644
index 38691d9..0000000
--- a/plugins/wintab/src/native/build.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pom.xml b/pom.xml
index 58e9dd9..0a90e68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,6 +103,19 @@
maven-antrun-plugin
1.8
+
+ com.googlecode.mavennatives
+ maven-nativedependencies-plugin
+ 0.0.7
+
+
+ unpacknatives
+
+ copy
+
+
+
+