- 3,724,395 Users
- 2,244,746 Discussions
- 7,850,990 Comments
Forum Stats
Discussions
Categories
- 16 Data
- 362.2K Big Data Appliance
- 7 Data Science
- 2.1K Databases
- 623 General Database Discussions
- 3.7K Java and JavaScript in the Database
- 32 Multilingual Engine
- 497 MySQL Community Space
- 7 NoSQL Database
- 7.7K Oracle Database Express Edition (XE)
- 2.8K ORDS, SODA & JSON in the Database
- 422 SQLcl
- 62 SQL Developer Data Modeler
- 185.1K SQL & PL/SQL
- 21.1K SQL Developer
- 2.5K Development
- 3 Developer Projects
- 32 Programming Languages
- 135.7K Development Tools
- 14 DevOps
- 3K QA/Testing
- 338 Java
- 10 Java Learning Subscription
- 12 Database Connectivity
- 72 Java Community Process
- 2 Java 25
- 12 Java APIs
- 141.2K Java Development Tools
- 8 Java EE (Java Enterprise Edition)
- 153K Java Essentials
- 135 Java 8 Questions
- 86.2K Java Programming
- 270 Java Lambda MOOC
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 16 Java SE
- 13.8K Java Security
- 4 Java User Groups
- 22 JavaScript - Nashorn
- 18 Programs
- 147 LiveLabs
- 34 Workshops
- 10 Software
- 4 Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 4 Deutsche Oracle Community
- 16 Español
- 1.9K Japanese
- 3 Portuguese
JavaFX Touch events on Linux

Hello,
I've been working on building JavaFX applications for the PinePhone. This is an aarch64 Linux mobile device. I modified the JavaFX build.gradle to include aarch64, since it isn't supported currently, to make this work so I can use Desktop JavaFX on my phone, since it runs "Desktop Linux" and not android.
This works just great and I can build my applications on my desktop and just copy the jar over to the phone.
However, the issue: JavaFX on Linux Touchscreen support is broken. The events only come through as Mouse Entered or Mouse Exited events. I can't click on items, and I can't use touch gestures of any kind.
I have been trying to figure this out for months now, and have not gotten very far.
I found this: How to use touchscreen events under Linux and Javafx 2.2 from 2012.
and this: https://bugs.openjdk.java.net/browse/JDK-8217955 from last year. Also here: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8217955
Which points unfortunately to this closed issue here: https://github.com/javafxports/openjdk-jfx/issues/329#issuecomment-459433106
There is a comment about evaluating for openjfx13, but I still see the issue is open and it affects my builds from 14 up to recent from source.
As more and more touch devices with Linux enter the market (As the PinePhone, the Librem5, and the PineTab, etc...) it would be really nice to be able to actually build and run JavaFX applications on these devices.
Answers
-
After some digging and finding more issues on the current github repository: https://github.com/openjdk/jfx/ I have discovered that indeed, the GTK_TOUCH_* event bindings just do not exist at all in JavaFX.
I should have of course realized this from reading the bug report on the old github: https://github.com/javafxports/openjdk-jfx/issues/329#issuecomment-459433106So, knowing this, would anybody happen to know at a high level how I can add the Touch events from here: https://developer.gnome.org/gdk3/stable/gdk3-Event-Structures.html
into the JavaFX code and have it detected here?: https://github.com/openjdk/jfx/blob/22d4343fe8563c2931910b98e8f18c6fd4a48f05/modules/javafx.graphics/src/main/native-gla…
I will do the work to add it in, though it will be slow going since I'll need to pick up on C++ and how the current bindings work, then figure out the best design to implement the full range of Touch capabilities.
Any help would be of course incredibly appreciated. Like I mentioned, Linux Desktop on Mobile I really believe is going to be a good thing, and JavaFX would be an awesome toolkit to use in that endeavor. It is at least my goal to make it happen the best I can.
-
It looks like the related ticket (https://bugs.openjdk.java.net/browse/JDK-8217955) was closed, and the "solution" linked (https://github.com/javafxports/openjdk-jfx/issues/329#issuecomment-459433106). But since that is unacceptable for my use case, I have started poking around at actually hooking up and implementing the correct glass gtk touch events.
I've got a fork started here (https://github.com/Torbuntu/jfx/tree/touch-support) but I am running into some trouble now with actually translating the GDK_TOUCH events into the JavaFX expected events. I will keep poking at it and see if I can eventually figure something out that can be properly upstream so that anyone wanting to develop for Linux with touch screens can do so (Like for PinePhones, PineTabs, Librem 5's, Touch enabled laptops etc...)