Any touchscreen APIs for Julia?

Are there any packages that measure touchscreen gestures? I want to make something like this virtual piano (https://www.apronus.com/music/flashpiano.htm) but in an offline interactive window. So far I’m imagining that I just want to measure if and where there are touches at regular intervals, not anything like swipes or double-taps.

I just looked up for one of the cross-platform GUI toolkits:

https://developer.gnome.org/gtk3/stable/chap-input-handling.html

The most basic input devices that every computer user has interacted with are keyboards and mice; beyond these, GTK+ supports touchpads, touchscreens and more exotic input devices such as graphics tablets.

Qt or QML may also have this, and are maybe better options in general (I believe many think so, for windows/mouse GUIs). That said, I’m not sure the Julia wrappers for those, Gtkl.jl, QML.jl and Qt.jl support. I’m even skeptical of that, but please look into that (and extend if not, or file an issue).

The web APIs may also support, not sure you want to use program that way with Julia. And Android support for Julia is I think not at that level yet.

1 Like

Yeah I’m not sure, either. I read on stackoverflow that multitouch support was added to Gtk some 7+ years ago for version 3.4, so I’m guessing Gtk.jl is using a later version than that. However, I can’t find anything in the Gtk.jl docs explicitly about touchscreen events. Gtk apparently has a GdkEventTouch struct for touchscreen actions, but I can’t find it in Gtk.jl’s github repo (though I should mention I never use github). I did find mentions of the GDK_TOUCH_xxxx event types, though. I’ll try to read up on how Gtk and Gtk.jl work, but boy do I wish I had some ready-made multitouch examples.

I did find QTouchEvent in https://doc.qt.io/qt-5/qtouchevent.html

but it doesn’t seem to be supported in QML.jl, I didn’t see it exported. @barche might know if easy to support, it seems you’re out of luck with all the Julia wrappers for GUI toolkits. You might want to look into Kivy with Python, or some Qt library with Python or other lanuage. I mention Python as you should be able to use Python libraries with Julia, even frameworks, but I’ve not seen anyone actually use Python (web) frameworks (maybe in the past GUI frameworks), while I know of no one using touch related with Julia (or possibly in conjunction with Python).

I did actually find “touch device” mentioned in this GUI wrapper:

I have never tried it (due to the lack of a Julia-running touchscreen device), but I think this might work for touch input:

https://doc.qt.io/qt-5/qml-qtquick-multipointtoucharea.html

Conceptually, all these things are handled on the QML side, so it should all just work.

1 Like

Also for CImGui, another package I just found that might be usuful (or not, as searching for touch got me nothing, but at least might be helpful for non-touch GUI, maybe simplifying a lot): https://juliahub.com/ui/Packages/Poptart/HOpB5/0.3.0

Nuklear has touch support, and seems the wrapper may have too: https://github.com/Gnimuc/Nuklear.jl/search?q=touch&unscoped_q=touch

QML.jl doesn’t have any ready-made examples for this either, but a possible starting point could be the board example:

In the QML part, you can try to replace the MouseArea with a MultiPointTouchArea and follow the QML examples from the Qt documentation from there: https://doc.qt.io/qt-5/qtquick-touchinteraction-example.html

3 Likes

I never tried Dear ImGui with a touch screen device, but it looks like the config flags have a IsTouchScreen entry: