diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..e76195e
Binary files /dev/null and b/.DS_Store differ
diff --git a/TuioDriver.jar b/TuioDriver.jar
new file mode 100644
index 0000000..aa5802b
Binary files /dev/null and b/TuioDriver.jar differ
diff --git a/TuioMouse.app/Contents/Info.plist b/TuioMouse.app/Contents/Info.plist
new file mode 100644
index 0000000..ab22e7f
--- /dev/null
+++ b/TuioMouse.app/Contents/Info.plist
@@ -0,0 +1,20 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ English
+ CFBundleExecutable
+ TuioMouse
+ CFBundleIconFile
+ icon
+ CFBundleInfoDictionaryVersion
+ 8.0
+ CFBundleName
+ TuioMouse
+ CFBundlePackageType
+ APPL
+ CFBundleSignature
+ ????
+
+
diff --git a/TuioMouse.app/Contents/MacOS/TuioMouse b/TuioMouse.app/Contents/MacOS/TuioMouse
new file mode 100755
index 0000000..6590545
Binary files /dev/null and b/TuioMouse.app/Contents/MacOS/TuioMouse differ
diff --git a/TuioMouse.app/Contents/MacOS/TuioMouse.sh b/TuioMouse.app/Contents/MacOS/TuioMouse.sh
new file mode 100755
index 0000000..e1545dd
--- /dev/null
+++ b/TuioMouse.app/Contents/MacOS/TuioMouse.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+PRG=$0
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
+ if expr "$link" : '^/' 2> /dev/null >/dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+done
+
+progdir=`dirname "$PRG"`
+
+if [ -n "$JAVA_HOME" ]; then
+ JAVACMD="$JAVA_HOME/bin/java"
+elif [ -x /usr/libexec/java_home ]; then
+ JAVACMD="`/usr/libexec/java_home`/bin/java"
+else
+ JAVACMD="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
+fi
+
+exec "$JAVACMD" -classpath "$progdir/../Resources/Java/*" \
+ -Dapple.laf.useScreenMenuBar=true \
+ TuioDriver
diff --git a/TuioMouse.app/Contents/PkgInfo b/TuioMouse.app/Contents/PkgInfo
new file mode 100644
index 0000000..6f749b0
--- /dev/null
+++ b/TuioMouse.app/Contents/PkgInfo
@@ -0,0 +1 @@
+APPL????
diff --git a/TuioMouse.app/Contents/Resources/Java/TuioDriver.jar b/TuioMouse.app/Contents/Resources/Java/TuioDriver.jar
new file mode 100644
index 0000000..aa5802b
Binary files /dev/null and b/TuioMouse.app/Contents/Resources/Java/TuioDriver.jar differ
diff --git a/TuioMouse.app/Contents/Resources/Java/libTUIO.jar b/TuioMouse.app/Contents/Resources/Java/libTUIO.jar
new file mode 100644
index 0000000..a101d4d
Binary files /dev/null and b/TuioMouse.app/Contents/Resources/Java/libTUIO.jar differ
diff --git a/TuioMouse.app/Contents/Resources/icon.icns b/TuioMouse.app/Contents/Resources/icon.icns
new file mode 100644
index 0000000..9e14f5c
Binary files /dev/null and b/TuioMouse.app/Contents/Resources/icon.icns differ
diff --git a/TuioMouse.jar b/TuioMouse.jar
index 5e39305..807c84a 100644
Binary files a/TuioMouse.jar and b/TuioMouse.jar differ
diff --git a/TuioTouchpad.jar b/TuioTouchpad.jar
index e145b72..f92a247 100644
Binary files a/TuioTouchpad.jar and b/TuioTouchpad.jar differ
diff --git a/source/.DS_Store b/source/.DS_Store
new file mode 100644
index 0000000..5008ddf
Binary files /dev/null and b/source/.DS_Store differ
diff --git a/source/TuioDriver.java b/source/TuioDriver.java
new file mode 100644
index 0000000..ada3afd
--- /dev/null
+++ b/source/TuioDriver.java
@@ -0,0 +1,252 @@
+/*
+ TUIO Driver - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2016 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.net.*;
+import java.io.*;
+import java.util.*;
+import TUIO.*;
+
+public class TuioDriver implements TuioListener {
+
+ private Robot robot = null;
+ private int width = 0;
+ private int height = 0;
+ private long mouse = -1;
+ private int mode = 1;
+
+ public void addTuioObject(TuioObject tobj) {}
+ public void updateTuioObject(TuioObject tobj) {}
+ public void removeTuioObject(TuioObject tobj) {}
+ public void addTuioBlob(TuioBlob tblb) {}
+ public void updateTuioBlob(TuioBlob tblb) {}
+ public void removeTuioBlob(TuioBlob tblb) {}
+ public void refresh(TuioTime bundleTime) {}
+
+ public void addTuioCursor(TuioCursor tcur) {
+ if (mode == 1) addTuioMouseCursor(tcur);
+ if (mode == 2) addTuioTrackpadCursor(tcur);
+ }
+
+ public void updateTuioCursor(TuioCursor tcur) {
+ if (mode == 1) updateTuioMouseCursor(tcur);
+ if (mode == 2) updateTuioTrackpadCursor(tcur);
+ }
+
+ private void addTuioMouseCursor(TuioCursor tcur) {
+ if (mouse<0) {
+ mouse = tcur.getSessionID();
+ if (robot!=null) robot.mouseMove(tcur.getScreenX(width),tcur.getScreenY(height));
+ } else {
+ if (robot!=null) robot.mousePress(InputEvent.BUTTON1_MASK);
+ }
+ }
+
+ private void updateTuioMouseCursor(TuioCursor tcur) {
+ if (mouse==tcur.getSessionID()) {
+ if (robot!=null) robot.mouseMove(tcur.getScreenX(width),tcur.getScreenY(height));
+ }
+ }
+
+ private void addTuioTrackpadCursor(TuioCursor tcur) {
+ Point pos = MouseInfo.getPointerInfo().getLocation();
+ int xpos = pos.x+(int)Math.round(tcur.getXSpeed()*Math.sqrt(width));
+ if(xpos<0) xpos=0; if(xpos>width) xpos=width;
+ int ypos = pos.y+(int)Math.round(tcur.getYSpeed()*Math.sqrt(height));
+ if(ypos<0) ypos=0; if(ypos>height) ypos=height;
+
+ if (mouse<0) {
+ mouse = tcur.getSessionID();
+ if (robot!=null) robot.mouseMove(xpos,ypos);
+ } else {
+ if (robot!=null) robot.mousePress(InputEvent.BUTTON1_MASK);
+ }
+ }
+
+ private void updateTuioTrackpadCursor(TuioCursor tcur) {
+ Point pos = MouseInfo.getPointerInfo().getLocation();
+ int xpos = pos.x+(int)Math.round(tcur.getXSpeed()*Math.sqrt(width));
+ if(xpos<0) xpos=0; if(xpos>width) xpos=width;
+ int ypos = pos.y+(int)Math.round(tcur.getYSpeed()*Math.sqrt(height));
+ if(ypos<0) ypos=0; if(ypos>height) ypos=height;
+ if (mouse==tcur.getSessionID()) {
+ if (robot!=null) robot.mouseMove(xpos,ypos);
+ }
+ }
+
+ public void removeTuioCursor(TuioCursor tcur) {
+ if (mouse==tcur.getSessionID()) {
+ mouse=-1;
+ } else {
+ if (robot!=null) robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ }
+
+ }
+
+ public TuioDriver() {
+ try { robot = new Robot(); }
+ catch (Exception e) {
+ System.out.println("failed to initialize mouse robot");
+ System.exit(0);
+ }
+
+ width = (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();
+ height = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
+ }
+
+ public static void main(String argv[]) {
+
+ int port = 3333;
+ System.setProperty("apple.awt.UIElement", "true");
+ java.awt.Toolkit.getDefaultToolkit();
+
+ if (argv.length==1) {
+ try { port = Integer.parseInt(argv[1]); }
+ catch (Exception e) { System.out.println("usage: java TuioDriver [port]"); }
+ }
+
+ final TuioDriver mouse = new TuioDriver();
+
+ final TuioClient client = new TuioClient(port);
+ client.addTuioListener(mouse);
+ client.connect();
+
+ if (SystemTray.isSupported()) {
+
+ final PopupMenu popup = new PopupMenu();
+ final TrayIcon trayIcon =
+ new TrayIcon(Toolkit.getDefaultToolkit().getImage(mouse.getClass().getResource("tuio.png")));
+
+ trayIcon.setToolTip("Tuio Mouse");
+ final CheckboxMenuItem tuioMouseMenuItem = new CheckboxMenuItem("Tuio Mouse");
+ popup.add(tuioMouseMenuItem);
+ tuioMouseMenuItem.setState(true);
+ final CheckboxMenuItem tuioTrackpadMenuItem = new CheckboxMenuItem("Tuio Trackpad");
+ popup.add(tuioTrackpadMenuItem);
+ final CheckboxMenuItem pauseItem = new CheckboxMenuItem("Pause Tuio");
+ popup.add(pauseItem);
+ popup.addSeparator();
+
+ final SystemTray tray = SystemTray.getSystemTray();
+
+ popup.add(new MenuItem("IP Address:"));
+
+ try {
+ Enumeration nics = NetworkInterface.getNetworkInterfaces();
+ while (nics.hasMoreElements()) {
+ NetworkInterface nic = nics.nextElement();
+ Enumeration addrs = nic.getInetAddresses();
+ while (addrs.hasMoreElements()) {
+ InetAddress addr = addrs.nextElement();
+ if (!addr.isLoopbackAddress() && !addr.toString().startsWith("/fe80")) {
+ popup.insert(new MenuItem(" " + nic.getName() + ": " + addr.getHostAddress()), 5);
+ }
+ }
+ }
+ } catch (SocketException e) {
+ e.printStackTrace();
+ }
+
+ final MenuItem refreshItem = new MenuItem("Refresh");
+ popup.add(refreshItem);
+
+ popup.addSeparator();
+ popup.add(new MenuItem("Port: " + port));
+
+ final MenuItem exitItem = new MenuItem("Exit");
+
+ trayIcon.setPopupMenu(popup);
+
+ tuioMouseMenuItem.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent evt) {
+
+ if (evt.getStateChange() == ItemEvent.SELECTED) {
+ mouse.mode = 1;
+ if (!client.isConnected()) client.connect();
+ tuioTrackpadMenuItem.setState(false);
+ pauseItem.setState(false);
+ } else {
+ tuioMouseMenuItem.setState(true);
+ }
+ } } );
+
+ tuioTrackpadMenuItem.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent evt) {
+
+ if (evt.getStateChange() == ItemEvent.SELECTED) {
+ mouse.mode = 2;
+ if (!client.isConnected()) client.connect();
+ tuioMouseMenuItem.setState(false);
+ pauseItem.setState(false);
+ } else {
+ tuioTrackpadMenuItem.setState(true);
+ }
+ } } );
+
+ refreshItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) {
+ while (popup.getItemCount() > 9) {
+ popup.remove(5);
+ }
+
+ try {
+ Enumeration nics = NetworkInterface.getNetworkInterfaces();
+ while (nics.hasMoreElements()) {
+ NetworkInterface nic = nics.nextElement();
+ Enumeration addrs = nic.getInetAddresses();
+ while (addrs.hasMoreElements()) {
+ InetAddress addr = addrs.nextElement();
+ if (!addr.isLoopbackAddress() && (!addr.isLinkLocalAddress() || addr.toString().startsWith("/169.254"))) {
+ popup.insert(new MenuItem(" " + nic.getName() + ": " + addr.getHostAddress()), 5);
+ }
+ }
+ }
+ } catch (SocketException e) {
+ e.printStackTrace();
+ }
+
+ } } );
+
+ pauseItem.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent evt) {
+
+ if (evt.getStateChange() == ItemEvent.SELECTED) {
+ client.disconnect();
+ tuioMouseMenuItem.setState(false);
+ tuioTrackpadMenuItem.setState(false);
+ } else {
+ pauseItem.setState(true);
+ }
+ } } );
+
+ popup.add(exitItem);
+ exitItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) {
+ client.disconnect();
+ System.exit(0);
+ } } );
+
+ try {
+ tray.add(trayIcon);
+ } catch (AWTException e) {
+ System.out.println("SystemTray could not be added.");
+ }
+
+ } else System.out.println("SystemTray is not supported");
+
+ }
+}
diff --git a/source/TuioMouse.java b/source/TuioMouse.java
index 6043658..7316813 100644
--- a/source/TuioMouse.java
+++ b/source/TuioMouse.java
@@ -21,6 +21,9 @@
import java.awt.*;
import java.awt.event.*;
+import java.net.*;
+import java.io.*;
+import java.util.*;
import TUIO.*;
public class TuioMouse implements TuioListener {
@@ -87,7 +90,6 @@ public static void main(String argv[]) {
TuioMouse mouse = new TuioMouse();
final TuioClient client = new TuioClient(port);
- System.out.println("listening to TUIO messages at port "+port);
client.addTuioListener(mouse);
client.connect();
@@ -95,10 +97,32 @@ public static void main(String argv[]) {
final PopupMenu popup = new PopupMenu();
final TrayIcon trayIcon =
- new TrayIcon(Toolkit.getDefaultToolkit().getImage(mouse.getClass().getResource("tuio.gif")));
+ new TrayIcon(Toolkit.getDefaultToolkit().getImage(mouse.getClass().getResource("tuio.png")));
trayIcon.setToolTip("Tuio Mouse");
final SystemTray tray = SystemTray.getSystemTray();
-
+
+ final MenuItem ipAddress = new MenuItem("IP Address:");
+ popup.add(ipAddress);
+
+ try {
+ Enumeration nics = NetworkInterface.getNetworkInterfaces();
+ while (nics.hasMoreElements()) {
+ NetworkInterface nic = nics.nextElement();
+ Enumeration addrs = nic.getInetAddresses();
+ while (addrs.hasMoreElements()) {
+ InetAddress addr = addrs.nextElement();
+ if (!addr.isLoopbackAddress() && (!addr.isLinkLocalAddress() || addr.toString().startsWith("/169.254"))) {
+ popup.add(new MenuItem(" " + nic.getName() + ": " + addr.getHostAddress()));
+ }
+ }
+ }
+ } catch (SocketException e) {
+ e.printStackTrace();
+ }
+
+ popup.addSeparator();
+ popup.add("Port: " + port);
+
final CheckboxMenuItem pauseItem = new CheckboxMenuItem("Pause");
final MenuItem exitItem = new MenuItem("Exit");
@@ -128,4 +152,4 @@ public static void main(String argv[]) {
} else System.out.println("SystemTray is not supported");
}
-}
\ No newline at end of file
+}
diff --git a/source/TuioTouchpad.java b/source/TuioTouchpad.java
index 7dfa615..fb44cb5 100644
--- a/source/TuioTouchpad.java
+++ b/source/TuioTouchpad.java
@@ -21,6 +21,9 @@
import java.awt.*;
import java.awt.event.*;
+import java.net.*;
+import java.io.*;
+import java.util.*;
import TUIO.*;
public class TuioTouchpad implements TuioListener {
@@ -98,19 +101,42 @@ public static void main(String argv[]) {
TuioTouchpad touchpad = new TuioTouchpad();
final TuioClient client = new TuioClient(port);
-
- System.out.println("listening to TUIO messages at port "+port);
client.addTuioListener(touchpad);
client.connect();
if (SystemTray.isSupported()) {
-
+
final PopupMenu popup = new PopupMenu();
final TrayIcon trayIcon =
- new TrayIcon(Toolkit.getDefaultToolkit().getImage(touchpad.getClass().getResource("tuio.gif")));
+ new TrayIcon(Toolkit.getDefaultToolkit().getImage(touchpad.getClass().getResource("tuio.png")));
trayIcon.setToolTip("Tuio Touchpad");
+ popup.add(new MenuItem("TUIO Trackpad"));
+ popup.addSeparator();
+
final SystemTray tray = SystemTray.getSystemTray();
-
+
+ final MenuItem ipAddress = new MenuItem("IP Address:");
+ popup.add(ipAddress);
+
+ try {
+ Enumeration nics = NetworkInterface.getNetworkInterfaces();
+ while (nics.hasMoreElements()) {
+ NetworkInterface nic = nics.nextElement();
+ Enumeration addrs = nic.getInetAddresses();
+ while (addrs.hasMoreElements()) {
+ InetAddress addr = addrs.nextElement();
+ if (!addr.isLoopbackAddress() && (!addr.isLinkLocalAddress() || addr.toString().startsWith("/169.254"))) {
+ popup.add(new MenuItem(" " + nic.getName() + ": " + addr.getHostAddress()));
+ }
+ }
+ }
+ } catch (SocketException e) {
+ e.printStackTrace();
+ }
+
+ popup.addSeparator();
+ popup.add("Port: " + port);
+
final CheckboxMenuItem pauseItem = new CheckboxMenuItem("Pause");
final MenuItem exitItem = new MenuItem("Exit");
diff --git a/source/compile.sh b/source/compile.sh
index 46ebdf3..9e45aea 100755
--- a/source/compile.sh
+++ b/source/compile.sh
@@ -1,7 +1,10 @@
#!/bin/sh
javac -Xlint:-options -Xlint:unchecked -O -source 1.6 -target 1.6 -cp ../libTUIO.jar TuioMouse.java
-jar cfm ../TuioMouse.jar mouseManifest.inc *.class tuio.gif
+jar cfm ../TuioMouse.jar mouseManifest.inc *.class tuio.png
rm -f *.class
javac -Xlint:-options -Xlint:unchecked -O -source 1.6 -target 1.6 -cp ../libTUIO.jar TuioTouchpad.java
-jar cfm ../TuioTouchpad.jar touchpadManifest.inc *.class tuio.gif
+jar cfm ../TuioTouchpad.jar touchpadManifest.inc *.class tuio.png
+rm -f *.class
+javac -Xlint:-options -Xlint:unchecked -O -source 1.6 -target 1.6 -cp ../libTUIO.jar TuioDriver.java
+jar cfm ../TuioDriver.jar driverManifest.inc *.class tuio.png
rm -f *.class
diff --git a/source/driverManifest.inc b/source/driverManifest.inc
new file mode 100644
index 0000000..ca0111c
--- /dev/null
+++ b/source/driverManifest.inc
@@ -0,0 +1,3 @@
+Main-Class: TuioDriver
+Class-Path: libTUIO.jar
+
diff --git a/source/tuio.gif b/source/tuio.gif
deleted file mode 100644
index d60d3c7..0000000
Binary files a/source/tuio.gif and /dev/null differ
diff --git a/source/tuio.png b/source/tuio.png
new file mode 100644
index 0000000..1839369
Binary files /dev/null and b/source/tuio.png differ