Tablets with GIMP

Peter Hutterer peter.hutterer at who-t.net
Mon Nov 22 21:31:21 PST 2010


On Sun, Nov 21, 2010 at 06:20:40PM -0800, Neil Whelchel wrote:
> On Sunday, November 21, 2010 05:44:32 pm Peter Hutterer wrote:
> > On Sat, Nov 20, 2010 at 10:53:52PM -0800, Neil Whelchel wrote:
> > > I have been trying to get a VisTablet working with the GIMP with limited
> > > success. I am not interested in the tablet acting as a core pointer so
> > > I added a section to the xorg configuration:
> > > 
> > > Section "InputClass"
> > > 
> > >         Identifier "evdev tablet"
> > >         MatchVendor "WALTOP"
> > >         MatchDevicePath "/dev/input/event*"
> > >         Option "SendCoreEvents" "false"
> > >         Driver "evdev"
> > > 
> > > EndSection
> > > 
> > > And in the GIMP extended input device configuration  I selected the
> > > tablet device and set its mode to window.
> > > At first glance all worked as expected, then I ran into a problem...
> > > If I center a small drawing window in the middle of my screen, and start
> > > drawing in the middle, all is fine, and I can draw to the edges, however,
> > > if I start from a corner, the GIMP doesn't see the events from the
> > > tablet. My guess is that xorg assumes that the coordinates from the
> > > tablet corners are outside of the GIMP window and does not send events.
> > > This looks like a bug, because if I start in the middle, and go to the
> > > edge, all is fine until I release the pen.
> > 
> > gimp grabs the device when a button press is registered on the canvas, but
> > does not do so for events outside the canvas (well, because it wouldn't get
> > them since they don't arrive on the canvas)
> 
> Maybe I was not clear. The GIMP scales the entire tablet area to the size of 
> the canvas when it is in Window mode.  Even though the actual tool is on the 
> canvas because of scaling, clicks are not passed to the GIMP if you are 
> outside of the area that the pointer would be on the canvas if GIMP was not 
> scaling it.
> 
> I can see this by the way that it acts. There is a problem there, however. 
> Since SendCoreEvents is false, the core pointer moves in response to the 
> mouse, not the tablet. In this case, you would think that having the window 
> active would be enough to allow it to receive tablet events (since GIMP is 
> configured to look for the tablet events in its exended input configuration), 
> but that is not how it works.

I don't know how GIMP works internally (other than from debugging requests
that arrive in the X server) but for floating slave devices the same picking
mechanism is true as for master devices, i.e. the window underneath the
device position.

this means that even if your device is floating, if you hit the top-left
corner of the tablet the event will go to which ever window is on the
screen-coordinate equivalent to the device coordinates. if GIMP wants to
receive those coordinates, it needs to grab the device before the event
occurs.

> The point is that when GIMP is set in Window mode, the entire tablet surface 
> is scaled to the size of the drawing window. As I move the pen to the edge of 
> the tablet, the tool is positioned at the edge of the window. Where things go 
> bad is that even though the tool is in the window, when I click the pen, GIMP 
> does not see the event. It is like xorg is not seeing the fact that GIMP is 
> scaling the input and that the tool *IS* in the window. 

the X server doesn't know what a client is doing with the events (and
coordinates) it provides to the client. thus the definition of "the tool is
in the window" is contained to within GIMP only, since X itself doesn't know
what a tool is and even only has a limited definition of "in the window"
(which in GIMPs case I guess is a subwindow, the canvas.

> If you don't account 
> for scaling and click in a place where the tool WOULD be in the window if 
> scaling were not applied, it works as expected, and continues to work when you 
> drag the pen outside of the unscaled area. There is no documentation to 
> explain this or work around this issue.

> > http://who-t.blogspot.com/2010/11/high-level-overview-of-grabs.html
> > 
> > > Another problem is that I am unable to find any real documentation on
> > > InputClass. All I can find is bits here and there. Am I looking in the
> > > wrong places or do I need to take on a documentation project?
> > 
> > xorg.conf(5) isn't enough?
> Not really. While it covers the basics, it really doesn't get into things like 
> whre MatchIsTablet and such decide if it is true or false. After some digging, 
> I figured out how udev sets the environment, and the relation is clear, but 
> that is not in the documentation that I can find. Also there is little mention 
> of how devices that are not set as Core are dealt with.

right, the MatchIsTouchpad etc. is set by the config backend, i.e. udev or
HAL, depending on the platform. Please feel free to submit a patch to update
the man page in this regard.

Cheers,
  Peter



More information about the xorg mailing list