multi touch support

41 views
Skip to first unread message

Klaus Rudolph

unread,
Nov 1, 2025, 7:37:36 AMNov 1
to fltk.general
Hi again.

Now I want to ask if we can handle multi touch events in fltk already. I simply need some kind a status report.


What I need for my application is an event which tells me that a touch point is touched/moved or released.

I have no idea if this is already done and forwarded to the event handlers simply by generating FL_PUSH, FL_DRAG, FL_MOVE, FL_RELEASE?

Or is there already something ongoing with "real" touch events coming from XI_TouchBegin/Update/End to something like FL_TOUCH_BEGIN... and so on?

For gtk it is simply forwarded as GDK_TOUCH_BEGIN, ... but needs some initialization during prog startup.

Regards
 Klaus

Matthias Melcher

unread,
Nov 1, 2025, 10:50:40 AMNov 1
to fltk.general
No, not yet, but a lot of work has been done behind the scenes.

Currently, touch events are translated into mouse events which can be queried using the events you mentioned.

Behind the scenes, we have discussed and decided how the API will work. I am currently implementing that API, also for gestures, tablets, joysticks, and gamepads. It's only a standardized API. We don;t want to repeat previous mistakes where APIs grow slowly, focussing on a single driver, and then work differently for another driver.

The part after that will be implementing the drivers behind that API for every platform that supports those devices. With our current resources, that is probably somewhat on an "I need that now, so I will write it" basis. ;-)

Albrecht Schlosser

unread,
Nov 1, 2025, 12:40:49 PMNov 1
to fltkg...@googlegroups.com
On 11/1/25 12:37 'Klaus Rudolph' wrote:
> Now I want to ask if we can handle multi touch events in fltk already.
> I simply need some kind a status report.

It's ongoing work, not yet finished, and may still take a while.
Multi-touch support is now planned for FLTK 1.5. FLTK 1.4 won't get it
because the changes would be too massive under the hood, but we want to
be backwords compatible as always.

> What I need for my application is an event which tells me that a touch
> point is touched/moved or released.

As I read this, that would be a pretty basic (let's say "single point
touch") API rather than a multi-touch API which would handle complete
gestures like rotate, zoom, swipe, ... The latter is what we want to
provide.

> I have no idea if this is already done and forwarded to the event
> handlers simply by generating FL_PUSH, FL_DRAG, FL_MOVE, FL_RELEASE?

Basic (single finger) touch events do already work like this, at least
on some platforms. Probably not FL_DRAG though.

> Or is there already something ongoing with "real" touch events coming
> from XI_TouchBegin/Update/End to something like FL_TOUCH_BEGIN... and
> so on?
>
> For gtk it is simply forwarded as GDK_TOUCH_BEGIN, ... but needs some
> initialization during prog startup.

Again, that would be too basic (IMHO). Please read also Matthias' post
about what we are trying to implement and how we plan to do it. The plan
is to have one or more "touch" events which user programs can handle
similar to mouse events, maybe an FL_ZOOM event that's similar to an
FL_MOUSEWHEEL event and so on (bad example, but I hope you get the gist).

holm.h...@gmail.com

unread,
Nov 4, 2025, 2:31:33 AMNov 4
to fltk.general

Hi,

From my point of view, this would be a very valuable extension to fltk and lift this great library to new heights.

Hats of for the great work you put into fltk !

Håvard

Matthias Melcher

unread,
Nov 4, 2025, 10:33:30 AMNov 4
to fltk.general

I have put out a proposal for pen.tablet.stylus support today: https://github.com/fltk/fltk/discussions/1319 . There is already quite a hunk of code there. If I get enough positive feedback, I will add a multitouch API to this, in the hopes that core devs will jump on it and implement it. Well, I might for the platforms that I use anyway.

Klaus Rudolph

unread,
Nov 9, 2025, 5:52:22 AMNov 9
to fltk.general
Thanks for the replies!

Maybe to get a better understanding what I personally "need" I would provide some background information of my planned application:

The app should simulate a operators desk where the operator has to press 2 buttons at the same time. That can not be simulated by a single mouse device. But on a multi touch, it is quite easy. So I am talking about multi touch and not a single touch event. But this also means, that for the content of that widget, which is able to get the 2 or more press events, it must be possible to get them without any pre-interpretation from the underlying library. The app simply needs the start and end of the touch event. Quite simple to forward them :-) Maybe ( don't know what you have already implemented ), it needs some setting for the current widget, that the events will be simply forwarded without handled before inside the fltk stack.

Is there already something ( maybe on a public available branch ) which I can use to test? As I said: I only need the simply forwarded touch events. The events itself only needs to contain the coordinates (x,y ) as in the mouse events and the logical number of the "finger" as provided from the touch device itself. This is important, because it might be possible that the user moves the finger unwanted a bit over the screen before releasing it. But this is, as I know, the default handling from the underlying event system for multi touch devices.

Another usage can be a multi finger painting widget. Each finger starts a new line ( maybe with a new color ) and will be drawn along the finger movement until the touch end occurs for that finger.

As you said, you already forwarding touch events as mouse button events. Maybe all I need can already be done?


Regards
 Klaus

imm

unread,
Nov 9, 2025, 8:02:21 AMNov 9
to General FLTK
On Sun, 9 Nov 2025, 10:52 'Klaus Rudolph' wrote:
Thanks for the replies!

Maybe to get a better understanding what I personally "need" I would provide some background information of my planned application:

The app should simulate a operators desk where the operator has to press 2 buttons at the same time. That can not be simulated by a single mouse device. But on a multi touch, it is quite easy. So I am talking about multi touch and not a single touch event. But this also means, that for the content of that widget, which is able to get the 2 or more press events, it must be possible to get them without any pre-interpretation from the underlying library. The app simply needs the start and end of the touch event. Quite simple to forward them :-) Maybe ( don't know what you have already implemented ), it needs some setting for the current widget, that the events will be simply forwarded without handled before inside the fltk stack.

Is there already something ( maybe on a public available branch ) which I can use to test? As I said: I only need the simply forwarded touch events. The events itself only needs to contain the coordinates (x,y ) as in the mouse events and the logical number of the "finger" as provided from the touch device itself. This is important, because it might be possible that the user moves the finger unwanted a bit over the screen before releasing it. But this is, as I know, the default handling from the underlying event system for multi touch devices.

Another usage can be a multi finger painting widget. Each finger starts a new line ( maybe with a new color ) and will be drawn along the finger movement until the touch end occurs for that finger.

As you said, you already forwarding touch events as mouse button events. Maybe all I need can already be done?


Klaus,

If you know what system events you want, and you don't mind writing a little bit of platform specific code, then you can use FL::add_system_handler() to grab the "raw" touch events from the OS before fltk's event processing consumes them.

From there you can map the raw touch events onto your "buttons" and that might work for you?

--
Ian
From my Fairphone FP3

Reply all
Reply to author
Forward
0 new messages