canvasevent: completely remove the stroke queue
canvasevent: add some rate-debugging code
canvasevent: per-tdw state, simplify queue API

Make last-event times and had-pressure flags per-TDW instead of cross-TDW.
Events may theoretically arrive on any drawing widget.

Remove the need to pass devices around: we now detect device changes in the
direct event handler.
input events: add event filter to improve capture

Add an experimental GDK event filter to capture events before GDK itself
can motion-compress them and thus break our drawing accuracy. See

https://gna.org/bugs/?21003
https://gna.org/bugs/?20822
https://bugzilla.gnome.org/show_bug.cgi?id=702392

Good coding practice dictates that we don't try to do too much inside this
fairly horrid little hack, so we only queue the pointer position and the
timestamp. For all the events GDK 3.8+ drops on the floor during a frame
clock cycle (which the filter now captures), we use the tilt and pressure
info from the event on the event that did make it through. Interpolating
would be better.

Before: 50-60 events/second for all devices.
After: 200 events/second with an Intuos 5. 80 with a touchpad.

This hack only works on X11 platforms right now
eventhack: acquire GIL, bump data tuple refcount

Ubuntu 13.10 (and maybe other systems) require the GIL to be held during
then event filter, so wrap the filter in the appropriate calls. Not
required for all systems, but it's good practice to do this given that the
filter uses Python API calls outside the scope of the Python interpreter,
where execution may or may not be threaded. Fixes a segfault on affected
systems.

http://docs.python.org/2/c-api/init.html#non-python-created-threads

Also bump the data tuple's refcount for the duration of the filter's
operation, if the display type is supported. Technically not needed given
the framework in which it's called, but will be safer in case of error.
eventhack: interpolate pressure and tilt axes

The eventhack code doesn't record pressure or tilt since that requires
knowledge of the maxima and minima for their raw readings in order to be
compatible with GDK's translated values. Such code would be fragile, so
instead interpolate their values based on the detailed eventhack times and
the time and axis values from the coarse events that make it through GDK's
motion compression.

Move pressure and tilt faking and sanity checking up front, since we now
interpolate using the sanitized values from this phase.
freehand: Split out per-TDW drawstate

Keep per-TDW drawing state together in a struct.
freehand: rearrange some processing

Detect and fix zero-dtime events earlier in the chain than before. Move
tilt and pressure fixups earlier too.

The goal here is to enqueue only arrays of raw absolute floats that we can
interpolate between nicely as needed.
freehand: split out, add pressure/tilt interp

Split out freehand mode class: it's getting way too complex to keep around
in the base module.

Events gathered by the eventhack code do not have pressure or tilt
information. Infer this information from surrounding motion-notify events
using a cubic spline to ensure a smoother fit.

Handle mouse button-releases as zero-pressure events for consistency, and
explicitly handle transitions from zero to nonzero pressure and vice versa
to avoid "hook" artefacts.
profiling: use xdg-open

Open the graphical output of gprof2dot.py with the user's default .png
program via xdg-open, rather than a hardcoded feh.
freehand: replace assertion with warning

The evhack checker assertion could be triggered by unfullscreening (depends
on the exact timing, so it's hard to reproduce). Just warn about it instead
of raising an assertion, and ignore the bad batch of evhack events.
freehand: fix an erroneous check
Merge Dopey with MyPaint HEAD