Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-touch cross platform java application (Windows, Mac, and Linux(Ubuntu)(possibly Android))

Am trying to add multi-touch to an existing cross platform java project. I have looked in to 2 ways. There was several other ways but they seemed to not be cross platform or needed special software.

  1. JavaFx - Working gesturing/touchevent events on windows and osx but not functioning on Ubuntu 16.04.
  2. MT4J - Looks to be discontinued and/or unsupported.

My conclusions for the above could be wrong and am willing to try them again given good feedback.

Is there anyway to achieving a cross platform multi-touch java application? Seems I may need to write some native code and add it through the JNI which seems like a lot of work. Any ideas on this line of thought?. Feed back is appreciated, Thanks.

Continuation 1.0:

I have kept investigating using JavaFX on linux mostly because the only drawback right now for using JavaFX is linux multitouch support. What I have found out is that JavaFx multitouch does work on Linux distributions that are for embedded systems(ex: Raspberry Pi, probably most to be honest). What I can gather from this is if OpenJFX can be compiled for the embedded system then the embedded version of OpenJFX uses the device drivers directly to get input(/dev/input/) instead of the X11/GTK. Since the Linux dists for the desktop use X11/GTK for there input into the desktop environment JavaFx is unable to get these events due to a lack of support.

I don't wish to use a link but here it is

https://wiki.openjdk.java.net/display/OpenJFX/Building+the+OpenJFX+embedded+stack+for+Linux+desktop

The above link, seems to me at-least, to be about compiling a version of the OpenJFX for x86 systems(should work x64) which uses the embedded systems way of getting device input. I'am able to compile this version but when I run it appears to crash the Desktop and sometimes it does leave the Java App up. When the Java App is left running touch events do work but this end result is just not acceptable because it is unpredictable and seems to crash the desktop manager(Requires a reboot of the desktop after this).

Continuation 1.1:

I looked into using TUIO but none of the sample programs worked. They say you need a TUIO enable device which might be a special standard/protocal my devices don't use. Pretty much just downloaded the TUIO demo and ran it on a touch screen with no luck.

I also thought about attaching xev to my java application window and streaming the results to a file to latter be read by the java application and parsed into java events. This seems pretty hacky and am not sure if it would even work. If someone would lay out the possibility of this working I may try it. But at this point it seems like way to much work.

Continuation 1.2:

Found this https://bugs.openjdk.java.net/browse/JDK-8090954 and thought it was interesting.

Posted the solution below.

like image 620
mpyne Avatar asked Mar 07 '17 00:03

mpyne


1 Answers

Recently there has been many cross platform project generators

React native, Cordova are some of those

I have used React Native .It uses javascript codes which are compiled down according to the platform

React native has support for Gesture Control programming

https://facebook.github.io/react-native/docs/gesture-responder-system.html

you can also interface the react portion of code with the existing JAVA code for the app which you have already written

https://facebook.github.io/react-native/docs/integration-with-existing-apps.html
like image 200
Aloy A Sen Avatar answered Oct 03 '22 18:10

Aloy A Sen