Created
January 5, 2015 22:36
-
-
Save loentar/da5ffce997fb3613db5d to your computer and use it in GitHub Desktop.
patch for mypaint issue #154
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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