No drawing tablet (e.g., Wacom) support, eh?

So, I Googled briefly and played with SDL a little (examined events coming
into Tux Paint) and it seems like SDL doesn’t support any kind of drawing
tablets yet. (e.g., a Wacom Graphire)

Is there still a major technical hurdle? Or has noone gotten around to it?

For my purposes, in Tux Paint, I’d be happy with being able to tell
Stylus vs. Eraser, at the least. Next in my priority list would be
pressure sensitivity. Beyond that, I don’t think TP would need much else.

I’ve got a Wacom that’s working under Linux Kernel 2.6.8 (with pressure) with
The Gimp 2.2.x, in case anyone either (a) has hints as to what I can do
to change SDL to get things working, or (b) has patches to SDL that they’d
like me to test for them. :^)

Thanks!–
-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/

P? Sun, 23 Oct 2005 11:09:27 +0200, skrev Bill Kendrick :

So, I Googled briefly and played with SDL a little (examined events
coming
into Tux Paint) and it seems like SDL doesn’t support any kind of drawing
tablets yet. (e.g., a Wacom Graphire)

Is there still a major technical hurdle? Or has noone gotten around to
it?

I don’t think SDL itself will support tablets for a while, but I added
some basic tablet support to the linux evdev part of Ryan Gordon’s
ManyMouse
project some time ago (actually this was more of a side-effect of improving
the support for absolute mice to support conversion to relative motion –
so far it only reports tool type, but adding pressure sensitivity and tilt
and such should be ridiculously easy). There’s a few issues, though:

  • So far, this is only supported in the linux evdev driver (and only in my
    local copy here; the patch hasn’t been accepted yet). I’m interested
    in adding support to the other drivers, but I don’t have any knowledge
    of how to do this at all.

  • Full tablet support may be outside the scope of ManyMouse, which only
    aims to support multiple regular mice. I haven’t heard back from Ryan
    yet, so I don’t know what he thinks about this. I’m very interested in
    having an input lib with tablet support myself, so if it’s a problem I
    guess we could always make a fork of the project for tablet support.
    I’d like to hear Ryans opinion first, though.

  • Gerry
  • Full tablet support may be outside the scope of ManyMouse, which only
    aims to support multiple regular mice. I haven’t heard back from Ryan
    yet, so I don’t know what he thinks about this. I’m very interested in
    having an input lib with tablet support myself, so if it’s a problem I
    guess we could always make a fork of the project for tablet support.
    I’d like to hear Ryans opinion first, though.

I need to look at that again. I think I was generally nervous about
adding more-than-generic mouse functionality, but multiple inputs aside,
it’s come to my attention that working with evdev/XInput/WM_INPUT/HID
Manager directly really sucks, so ManyMouse might be a nice API in place
of that even for things like pens. Ideally the app can just ignore
tablet-specific events and treat the thing like a mouse if it wants to.
I have to look at your patch again, it might already do this.

However (and this could be an SDL issue at some point), the latest x.org
grabs the evdev devices for exclusive access…mostly because if they
don’t, your keystrokes fall through to the the Linux VT which also use
evdev for the keyboard, and you could have accidentally CTRL-C’d your X
server when you meant to CTRL-C something in an xterm on that X server.

This means we’ll pretty much have to move to XInput for this to be
useful, but on x.org, XInput is either broken or misconfigured on every
system. It’s a hard problem.

–ryan.

I need to look at that again. I think I was generally nervous about
adding more-than-generic mouse functionality, but multiple inputs aside,
it’s come to my attention that working with evdev/XInput/WM_INPUT/HID
Manager directly really sucks, so ManyMouse might be a nice API in place
of that even for things like pens. Ideally the app can just ignore
tablet-specific events and treat the thing like a mouse if it wants to.
I have to look at your patch again, it might already do this.

In a sense, that’s what Tux Paint is doing right now.
(Tested only under Linux, as I don’t have a Windows box… though I GUESS
I could hijack my work laptop and my wife’s Wacom and see if I didn’t
already throw the Wacom driver CDs in the trash…)

> This means we'll pretty much _have_ to move to XInput for this to be > useful, but on x.org, XInput is either broken or misconfigured on every > system. It's a hard problem.

I feel like a total idiot asking, but… how does Gimp/GTK+ do it, and
why can’t we just life their code? :wink:

I’m also pretty sure Gimp on Windows supports tablets.On Sun, Oct 23, 2005 at 08:35:27AM -0400, Ryan C. Gordon wrote:


-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/

In a sense, that’s what Tux Paint is doing right now.
(Tested only under Linux, as I don’t have a Windows box… though I GUESS
I could hijack my work laptop and my wife’s Wacom and see if I didn’t
already throw the Wacom driver CDs in the trash…)

If all you want is a mouse and button, you can just use the tablet as a
USB mouse device under Linux and X11.

I feel like a total idiot asking, but… how does Gimp/GTK+ do it, and
why can’t we just life their code? :wink:

Most likely? By requiring you to correctly configure your x.org config file.

Unless they’ve fixed this?

–ryan.

P? Sun, 23 Oct 2005 14:35:27 +0200, skrev Ryan C. Gordon
:

I need to look at that again. I think I was generally nervous about
adding more-than-generic mouse functionality, but multiple inputs aside,
it’s come to my attention that working with evdev/XInput/WM_INPUT/HID
Manager directly really sucks, so ManyMouse might be a nice API in place
of that even for things like pens. Ideally the app can just ignore
tablet-specific events and treat the thing like a mouse if it wants to.
I have to look at your patch again, it might already do this.

Well, my patch was pretty simple – it only added activation notification
for tablet-like tools (including absolute mice) so that an absolute-to-
relative converter can detect this event and reset its "last seen at"
values so that absolute-to-relative conversion can actually work. This
was originally only intended to improve the support for absolute mice
that ManyMouse already has, but since there was an unused field in the
activation event, and tool id information has to be accessed anyway to
get the activation info, I put the tool id in the extra field to specify
what tool entered or left the active area. The activation event and its
fields can be safely ignored by an application (it just won’t be able to
do absolute-to-relative conversion properly). I didn’t add any other
tablet-specific events in the patch I sent you, but it wouldn’t be hard
to do (for evdev at least).

Anyway, in my opinion ManyMouse would be very nice as (or as a base of)
an input library supporting tablets – when you’re working with tablets
you typically want to support multiple devices anyway. The tablet is
rarely the primary input device, and you often switch between the tablet
and other input-devices while working with it (well, at least I do that).

However (and this could be an SDL issue at some point), the latest x.org
grabs the evdev devices for exclusive access…mostly because if they
don’t, your keystrokes fall through to the the Linux VT which also use
evdev for the keyboard, and you could have accidentally CTRL-C’d your X
server when you meant to CTRL-C something in an xterm on that X server.

Is it an option, or are you actually forced into having Xorg grab evdev ?

This means we’ll pretty much have to move to XInput for this to be
useful, but on x.org, XInput is either broken or misconfigured on every
system. It’s a hard problem.

One mouse should work fine, right ? So, we only have to worry about
multiple mice and possibly tablets at once ?

I use Xorg, and my tablet works perfectly in the GIMP, with pressure
and tilt sensitivity, tool ids, and all buttons on the tools doing
what they should. GIMP doesn’t sense the tablet unless it’s set up in
xorg.conf, which means it’s using XInput, right ? (Or am I wrong ?)
I didn’t have to do any magic to get this working, just installed the
driver from the linux-wacom project and followed its instructions for
setting up X. Okay, so I had to hunt down and install a driver, but
other than that it was actually a pretty straighforward process.

Now, the question is if getting multiple regular mice to work would
be as easy. My guess is “no”, since you say it’s a hard problem,
but if it’s possible to get a tablet working, multiple mice should
be possible as well … If not, has anyone reported this as a bug to
the Xorg people ?

  • Gerry

P? Sun, 23 Oct 2005 22:41:36 +0200, skrev Bill Kendrick :

I feel like a total idiot asking, but… how does Gimp/GTK+ do it, and
why can’t we just life their code? :wink:

Because GTK+ is LGPL, while ManyMouse is zlib …

  • Gerry

I’m not actually familiar with ManyMouse, but… SDL is LGPL, so it should
be compatible with GTK+.

-bill!On Mon, Oct 24, 2005 at 01:45:33AM +0200, Gerry JJ wrote:

P? Sun, 23 Oct 2005 22:41:36 +0200, skrev Bill Kendrick <@Bill_Kendrick>:

I feel like a total idiot asking, but… how does Gimp/GTK+ do it, and
why can’t we just life their code? :wink:

Because GTK+ is LGPL, while ManyMouse is zlib …

In a sense, that’s what Tux Paint is doing right now.
(Tested only under Linux, as I don’t have a Windows box… though I GUESS
I could hijack my work laptop and my wife’s Wacom and see if I didn’t
already throw the Wacom driver CDs in the trash…)

If all you want is a mouse and button, you can just use the tablet as a
USB mouse device under Linux and X11.

Err, as I said, Tux Paint (and KDE desktop, etc.) see the Stylus and Eraser
as a regular mouse, as it is.

GTK+ and The Gimp just happen to be able to tell the difference between the
Stylus and the Eraser (the opposite side of the stylus), and can sense
differences in pressure. That’s what I’m hoping SDL will eventually be
able to do, too.

That way, Tux Paint will some day be able to tell the difference
between the Stylus and the Eraser, and sense pressure, too.
(Obviously, I’ll need to add some additional code to Tux Paint, just like
The Gimp folks did when they added Wacom support via GTK+ and XFree86.) [1]

I feel like a total idiot asking, but… how does Gimp/GTK+ do it, and
why can’t we just life their code? :wink:

Most likely? By requiring you to correctly configure your x.org config file.

Sure, I had to set up XFree86, but that setup is outside the scope of
SDL, Tux Paint, GTK+, Gimp, etc. anyway, so no biggie!

Of course, we’d want it to be as portable as possible, so that someone
running Tux Paint [1] on Mac OS X, BeOS or Windows could use their drawing
tablets, too.

[1] Right now, I’m just hoping for some kind of test for SDL_Event values:
e.g., “event.button.which”, and maybe “event.button.pressure”. ;^)

[2] Or whatever other SDL-based apps that come along which can sense
different tablet devices & pressure. ;^)On Sun, Oct 23, 2005 at 06:48:22PM -0400, Ryan C. Gordon wrote:


-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/