Skip to content

Instantly share code, notes, and snippets.

@loentar
Created January 5, 2015 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loentar/da5ffce997fb3613db5d to your computer and use it in GitHub Desktop.
Save loentar/da5ffce997fb3613db5d to your computer and use it in GitHub Desktop.
patch for mypaint issue #154
diff --git a/gui/freehand.py b/gui/freehand.py
index 7055f16..29efa72 100644
--- a/gui/freehand.py
+++ b/gui/freehand.py
@@ -429,6 +429,15 @@ class FreehandMode (gui.mode.BrushworkModeMixin,
ytilt = event.get_axis(gdk.AXIS_YTILT)
state = event.state
+ # Ugly hack for devices which have no description for axes.
+ # If the reported pressure is None but device has more than 2 axes
+ # set third (#2) axis as pressure
+ # Detail: https://github.com/mypaint/mypaint/issues/154
+ if pressure is None and event.device.get_n_axes() > 2 \
+ and event.device.get_axis_use(2) == gdk.AXIS_IGNORE:
+ event.device.set_axis_use(2, gdk.AXIS_PRESSURE)
+ pressure = event.get_axis(gdk.AXIS_PRESSURE)
+
# Workaround for buggy evdev behaviour.
# Events sometimes get a zero raw pressure reading when the
# pressure reading has not changed. This results in broken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment