Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Please add ability to use tablet features like pen pressure sensitivity, tilt, and other stuff. #208

Open
ghost opened this issue Apr 3, 2021 · 9 comments
Assignees

Comments

@ghost
Copy link

ghost commented Apr 3, 2021

I want to use FLTK, but I truly need ability to use tablet features such as pen pressure sensitivity and other stuff related to the tablet. How difficult would it be to implement it into FLTK?

By tablet I mean my drawing tablet like a wacom tablet.

@fire-eggs
Copy link
Contributor

You don't tell us what platform(s) you wish to target. Drivers for tablets are platform and sometimes manufacturer specific. A fair amount of work is necessary to handle devices in a cross-platform fashion. [Someone more knowledgeable than I might know of a "standard" interface for tablets and similar devices.]

For instance, if you were targeting Wacom compatible tablets on Linux, you could install or use the Wacom driver and write your code to use the tablet, following the test programs in that repo.

@erco77
Copy link
Contributor

erco77 commented Apr 11, 2021

Yes, we should add this, but no one's been able to come up with this cross platform as yet.

Back in 2016 I proposed a Mac specific patch in STR#3329 to support pen movement + pressure/tilt that worked for me on a Cintiq (Wacom monitor/tablet combo used for drawing), see:

[1] https://www.fltk.org/newsgroups.php?gfltk.general+v:40003
[2] https://www.fltk.org/str.php?L3329

But that's as far as I got. Which is to say it worked for my app, but I don't think in this state it's ready for implementation into an FLTK release just yet; a proper API needs to be conceived.

I was not sure what the proper API should be, and sought input, but since none was offered, the STR has languished.

Could be revived though, we just need a way that (a) works for cross platform, (b) does not impact performance on non-tablet devices (since this causes a lot of excess event traffic, or at least in my case it certainly did), or at least provides a way to turn these events on and off easily.

@fire-eggs
Copy link
Contributor

I was going to point out that Gimp supports tablets [via GTK+], but then I read that their tablet support is broken on Windows and Mac.

@erco77
Copy link
Contributor

erco77 commented Apr 11, 2021

Inkscape might be a good reference for an app that uses e.g. pen pressure.
I use Gimp on a mac with the Wacom Cintiq and it works fine. If it's broken, I'm not aware of it.

But we already have an example of Mac <-> FLTK <-> Cintiq in STR#3329. What's needed is Win and Linux.
I'm pretty sure Linux probably uses the same stuff SGI did back in the day, as X input extensions, IIRC.

I wrote some pure X windows/OpenGL code very long ago (1998) on an SGI using X input extensions to read pen pressure and tilt from a Wacom Artz tablet, code for that is here: http://seriss.com/people/erco/wacom/

Since Linux inherited a lot from SGI regarding X and graphics, I wouldn't be surprised if the same/similar techniques still work 23 years later, lol. It's just never been dragged into FLTK because at the time the specs were still in a state of formation. I think Matthias took that code and tried to integrate it into FLTK, maybe FLTK2.

Perhaps we should first look to FLTK2 to see if this has already been done. I think most of the current FLTK 1.x devs are completely unaware of what's in FLTK2.

@MatthiasWM
Copy link
Contributor

In one of the fading corners of my brain I remember implementing this for fltk2 for Nuke (about 25 years ago). Not sure if it ever made it into the public branch.

Basically I added Fl::event_device() to differentiate mouse, pen, eraser, and touch. I had Fl::event_*() functions for pressure, angle_x, and angle_y. Also, pens have additional buttons. I did use some of Erco's Waco. code, but I assume that these days we have actual system APIs available.

In private branches I had support for Spaceball and Spacemouse.

@pydsigner
Copy link

A number of searches about tablet input were leading me towards Qt, so I took a look at what platform-specific APIs they rely on. What I found is evdev on Linux, Wintab (Wacom only) on Windows, and NSEvent on macOS. Interestingly, Wacom lists some alternatives to Wintab for non-Windows platforms, including the NSEvent approach for macOS and Wayland Tablet Protocol/XInput2 for Linux.

@MatthiasWM MatthiasWM added this to the Release FLTK 1.4.0 milestone Dec 6, 2023
@MatthiasWM
Copy link
Contributor

MatthiasWM commented Dec 6, 2023

The API and ABI for this and the touch interface will be in 1.4.0 so we can add the implementation for the remaining platforms in 1.4.1

@MatthiasWM MatthiasWM reopened this Dec 6, 2023
@MatthiasWM MatthiasWM self-assigned this Dec 6, 2023
@Albrecht-S
Copy link
Member

Albrecht-S commented Jan 1, 2024

@MatthiasWM I'm no longer keen on adding anything related to touch and/or tablet events in 1.4.0 because we can't have a clear specification of events etc. before we implement them.

My take on this is (meanwhile) that we should wait until the release is done and then - after keeping the master branch in 1.4.x for some weeks for potential bug fixes - create the maintenance branch branch-1.4 (like branch-1.3 is now) and concentrate on 1.5.0 in the master (development) branch. That would be the time to implement new ABI breaking features like touch events.

What do you think? Do you agree to go this way?

@Albrecht-S
Copy link
Member

Removed from the release milestone. We're getting closer...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants