summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-03-13 02:48:03 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-03-13 02:48:03 +0000
commit8397b25b72b26593e52fd717baae3c967fc28ebf (patch)
tree31e37f12f08dfbbffb7b771faa245902381ec9e0 /src
parentFix undo stack spam in single-path mode of the spray tool (diff)
downloadinkscape-8397b25b72b26593e52fd717baae3c967fc28ebf.tar.gz
inkscape-8397b25b72b26593e52fd717baae3c967fc28ebf.zip
Try harder to fix the tablet configuration problem
(bzr r9183)
Diffstat (limited to 'src')
-rw-r--r--src/dialogs/input.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/dialogs/input.cpp b/src/dialogs/input.cpp
index f2ef8afe0..a8892bde4 100644
--- a/src/dialogs/input.cpp
+++ b/src/dialogs/input.cpp
@@ -69,15 +69,30 @@ static gchar const *axis_use_strings[GDK_AXIS_LAST] = {
static Glib::ustring sanitized_device_path(gchar const *str)
{
- // LP #334800: device names on Windows sometimes contain funny junk like
- // \x03, \xf2, etc. We need to get rid of this to properly access the settings.
- gchar *escaped = g_strescape(str, NULL);
+ // LP #334800: tablet device names on Windows sometimes contain funny junk like
+ // \x03, \xf2, etc. Moreover this junk changes between runs.
+ // If the tablet name contains unprintable or non-ASCII characters,
+ // we use some default name.
+ // This might break if someone has two tablets with broken names, but it's
+ // not possible to do anything 100% correct then.
+ bool broken = false;
+ if (!str || *str == 0) {
+ broken = true;
+ } else {
+ for (gchar const *s = str; *s; ++s) {
+ if (*s < 0x20 || *s >= 0x7f) {
+ broken = true;
+ break;
+ }
+ }
+ }
- for (gchar *s = escaped; *s; ++s) {
- if (*s == '/') *s = '_';
+ Glib::ustring device_path = "/devices/";
+ if (broken) {
+ device_path += "Tablet";
+ } else {
+ device_path += str;
}
- Glib::ustring device_path = Glib::ustring("/devices/") + escaped;
- g_free(escaped);
return device_path;
}