Touch screen

42 views
Skip to first unread message

holm.h...@gmail.com

unread,
Feb 16, 2022, 3:02:14 AM2/16/22
to fltk.general

Hello,
I have a OpenGL window, and need to operate with a touch screen.
Anyone who know how to handle zooming with two fingers ?

I can not figure out which event is handled.

I run my application on a Linux machine.

Best regards
Håvard

Ian MacArthur

unread,
Feb 16, 2022, 4:36:16 AM2/16/22
to fltk.general
AFAIK, there's no fltk event for the pinch-zoom actions yet, though somebody (maybe Mike Sweet?) did post notes about that a while back, so if you can find those posts, they might have some clues... might have been in fltk.coredev rather than this list, though, not sure.

FWIW, my limited understanding of this is that it is tricky, because WinXX, macOS, Linux and Wayland all handle this in different (and not very compatible!) ways, so coming up with some sort of generic wrapper that fltk can use is "challenging"...

As it stands, you may be bale to use some platform specific code on your Linux build and have that post events into the fltk event stream, but even then I'd be cautious that the solution might turn out to be X11 or even WM specific...


The short answer to this would have been: I do not know.


 

holm.h...@gmail.com

unread,
Feb 17, 2022, 12:31:14 PM2/17/22
to fltk.general
Hello,

What about touchegg. I do not know that system well, but to me it seems like it can capture "zoom by two finger" and generate an event / action.

Anyone with experience on fltk and touchegg ?

Best regards
Håvard

Albrecht Schlosser

unread,
Feb 17, 2022, 1:27:36 PM2/17/22
to fltkg...@googlegroups.com
On 2/16/22 10:36 Ian MacArthur wrote:
On Wednesday, 16 February 2022 at 08:02:14 UTC  Håvard  wrote:

Hello,
I have a OpenGL window, and need to operate with a touch screen.
Anyone who know how to handle zooming with two fingers ?


AFAIK, there's no fltk event for the pinch-zoom actions yet, though somebody (maybe Mike Sweet?) did post notes about that a while back, so if you can find those posts, they might have some clues... might have been in fltk.coredev rather than this list, though, not sure.

There's been a thread in fltk.coredev started on Oct 6, 2021: https://groups.google.com/g/fltkcoredev/c/YeSLqZ7SWF0/

Current status:

There is an old (I'd say experimental) implementation for zoom gestures exclusively on macOS but this should be considered deprecated (don't use it!). The API needs to be changed because it's not correct.

Work in progress:

I've been working on a new implementation whose API is not yet finally defined. If you follow the thread mentioned above you'll find a link to a branch in my fork where a proof of concept has been implemented (with the help of the OP) for macOS including a working demo program. But again, the final API is not yet defined and the demo API will be changed in the future.

I have another branch with basic event dispatching on Windows for multiple touch gestures. This branch will be combined with the macOS implementation.


FWIW, my limited understanding of this is that it is tricky, because WinXX, macOS, Linux and Wayland all handle this in different (and not very compatible!) ways, so coming up with some sort of generic wrapper that fltk can use is "challenging"...

Yes, it is, but I'm confident that it can be done at least for macOS and Windows in the near future (FLTK 1.4.0).


As it stands, you may be bale to use some platform specific code on your Linux build and have that post events into the fltk event stream, but even then I'd be cautious that the solution might turn out to be X11 or even WM specific...

I investigated how to implement touch gestures under Linux/X11 but I didn't find a good (i.e. simple) way to do it and gave up for now. There are obviously libraries available but it's not clear to me how this could be done. Maybe we can find something later.


My short term plan:

Define a full API for touch gestures, implement this on macOS and Windows and release this in FLTK 1.4.0. The basics are available, this needs "just a little more work". ;-)


Future plans:

Once the API is defined (see above) there are chances that touch gestures can be implemented on Linux/Wayland. I don't know Wayland good enough but Manolo mentioned that he wanted to try it. If possible this *might* also be available in FLTK 1.4.0 (no guarantees though).

There are currently no concrete plans though to implement touch gestures for Linux/Unix/X11 because we don't know how to do it. Hints, links to docs and/or examples would be appreciated.

holm.h...@gmail.com

unread,
Mar 26, 2023, 2:20:35 PM3/26/23
to fltk.general

Hi Albrecht,

I am most curious if you have had time to work with the touch screen project. I run my software under Linux. Are you aware of methods to use two fingers for zooming etc. ?

Maybe anyone else also have idea how this can be done in fltk ?

Best regards
Håvard

Albrecht Schlosser

unread,
Mar 27, 2023, 9:08:53 AM3/27/23
to fltkg...@googlegroups.com
On 3/26/23 20:20 holm.h...@gmail.com wrote:

Hi Albrecht,

I am most curious if you have had time to work with the touch screen project.

No, unfortunately not yet. But it's still on my todo list.


I run my software under Linux. Are you aware of methods to use two fingers for zooming etc. ?

No, Linux (i.e. X11) is still an open problem. I have basic event recognition working on Windows and macOS and there is minimal support for touch screens (only "mouse like" events like tap/click and double tap/click IIRC) on Wayland.

I stopped further investigations for Linux because I didn't find a suitable integration in X11 which we could use. All I read was about using libinput but I don't know how to integrate this with X11, hence X11 support is an open problem. Maybe we can extend the Wayland touch support to multi touch gestures, I don't know yet. This is very likely the way to go on Linux (i.e. support Wayland but not X11).


Maybe anyone else also have idea how this can be done in fltk ?

... unless someone else can find or implement proper multi touch support for FLTK under X11.

I'll need a day or two (or maybe more) to put the existing code together in a suitable FLTK API (event model and delivery) to make it work on the two platforms Windows and macOS, with the option to extend it then to Wayland. I have some concrete ideas how to do this.

I'll try to do this as soon as my spare time permits.


--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/6aec8854-72e8-4267-a38a-c8dbb54568f9n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages