Development/Debugging Tablet Issues

From MyPaint

Jump to: navigation, search

This page aims to tell you how to collect more information if MyPaint fails because of tablet issues. This can also happen if you don't have a tablet! The symptoms are usually one of the following:

  • No stroke happens when trying to paint.
  • Tablet pressure does not work.
  • Clicking on GUI elements has no effects.
  • There is an offset between the cursor and the actual stroke.
  • MyPaint crashes immediately when trying to paint.


[edit] Workaround: Disable tablet support

From the menu, choose Edit --> Preferences. This usually fixes all problems:

[edit] Workaround: Ignore low tablet pressure

This usually helps if you are seeing "ghost lines" between strokes, or if you cannot use "redo" after "undo" because you are always painting very faint (invisible) strokes:

[edit] Test Input Devices in MyPaint

The second screenshot shows how it looks if everything is working fine (click to enlarge):

Explanation for checking event timestamps:

Input devices (mice, tablets) report motion events with a fixed rate. The rate is usually 100 events per second, or 125. This means 10 or 8 milliseconds between two events. When the position doesn't change, no event is reported, and the time between two events is longer.

The first thing to check is the event rate. Maximize the canvas, and move the cursor in very large and fast circles. Watch number of events. If you are not able to reach at least 95 events per second, something is wrong. You will also notice that circles look much too jagged when you draw them fast. But note that when you draw circles really large and fast, they will look a bit jagged even when everything is working correctly.

The second thing to check is the timestamp quality. We know that events are generated at a fixed rate, so the time between two events should be always the same. Do the same test as before, but watch the "timestamp spacing". When the field updates, it shows the difference of timestamps (in milliseconds) for a short sequence of events. Ideally, this would show "8, 8, 8, 8, 8, 8" or "10, 10, 10, 10, 10, 10". Usually, we have to be content with something like "8, 8, 16, 8, 8, 9, 16" which isn't too bad.

MyPaint uses event timestamps to estimate the pointer velocity. Timestamp quality can have a notable impact on the quality of brushes. In particular, brushes that use the "fine speed" input, or the "offset by speed" setting, or the "direction" input (brushes with a flat tip that turns with the stroke direction), or a high "dabs per second" setting. There are filters to smooth this noise (e.g. the "fine speed filter" and "direction filter" brush settings) but they add delay, which is not wanted in most brushes.

The last thing to check is subpixel position. When you paint a stroke with your tablet, you should see a MOTION_NOTIFY in the window with a fractional part. In contrast to the other things above, this one usually is okay for everyone who has pressure working.

[edit] Check MyPaint STDOUT

On Linux: start MyPaint from the console rather than from the menu. If you didn't compile it yourself: open a terminal, type "mypaint" and press return.
On Windows: after quitting MyPaint, go into the "Local Settings" folder (or similar) where you find a folder called "mypaint". Open mypaint_error.log with a text editor. Scroll down to the end for the latest log.

Note: You get the output below only for MyPaint <= 1.1.0 (GTK2), newer versions (GTK3) don't print it.

If everything is fine, MyPaint should print something like this:

Setting screen mode for "Wacom Graphire3 eraser"
Ignoring "Wacom Graphire3 cursor" (probably wacom mouse device)
Setting screen mode for "Wacom Graphire3 stylus"

If your tablet is not set into "screen mode", it was not recognized as a tablet and pressure will not work.

If "screen mode" is set for a device that doesn't sense different levels of pressure, something is wrong.

If this is your issue, a note: GTK2 detects whether a device is a pen by checking the device name. If the lowercase name contains the substring "wacom" or "pen" (but not "cursor") then GTK2 will report it as GDK_SOURCE_PEN. Simplified, MyPaint will look at the number of axes of all GDK_SOURCE_PEN devices, and enable "screen" mode for all devices that have a third axis (which should be the pressure axis).

[edit] Check X11/xorg pressure support (Linux)

You should see your tablet in this list, and you should see pressure change in the hilighted column:

[edit] Testing GTK3 tablet support

The GTK+ source tree has a program called testinput.c for testing pressure sensitivity. Remove the line #include "config.h" and compile with:

 gcc -o testinput testinput.c `pkg-config --cflags --libs gtk+-3.0` -lm

As an alternative, you can compile it by building the whole GTK+ (use --enable-debug=yes while you're at it).

Make sure you know which GTK/GDK libraries it uses:

 ./testinput &
 cat /proc/$!/maps|grep -i g[td]k

You may also want to enable some debug prints by setting the environment variable GDK_DEBUG=input,events described in the gtk-running GTK+ documentation page. This should print all input devices to stdout when a GTK+ application starts.

GTK+ tablet bugs should be reported at gnome bugzilla.

[edit] Further Reading

Personal tools