summaryrefslogtreecommitdiff
path: root/panels/wacom
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-12-13 16:36:14 +1000
committerCarlos Garnacho <mrgarnacho@gmail.com>2018-12-18 20:46:02 +0000
commita82b975367e3733612062bd8a8075640ab5837f7 (patch)
treedd897eef70eacb61b188ec7c4905f53a2552070a /panels/wacom
parentd925ea3c6c260423a70412863cb6ee806e3cf815 (diff)
downloadgnome-control-center-a82b975367e3733612062bd8a8075640ab5837f7.tar.gz
wacom: Only write a generic pen to the keyfile when it's previously unseen
When we bring a generic pen (serial 0) into proximity, the tool is initialized as "generic" and mapped to the current tablet. This is then written out into the keyfile, so we end up with something like: [056a:00d1] Styli=generic; On the next g-c-c start the generic pen is pre-loaded from the keyfile but not yet associated with the tablet. When the pen gets into proximity the association was handled like a completely new pen, thus triggering a key file entry again. Eventually, our styli list looked like this: [056a:00d1] Styli=generic;generic;generic;generic;generic;generic; Fix this by remembering whether we freshly initialized the tool or whether it was already known. Since we can only have one generic tool per tablet (because we wouldn't notice the difference between two physical tools) we just skip the write of the keyfile. Fixes #313
Diffstat (limited to 'panels/wacom')
-rw-r--r--panels/wacom/cc-tablet-tool-map.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/panels/wacom/cc-tablet-tool-map.c b/panels/wacom/cc-tablet-tool-map.c
index eea54c282..8b681e3f4 100644
--- a/panels/wacom/cc-tablet-tool-map.c
+++ b/panels/wacom/cc-tablet-tool-map.c
@@ -347,6 +347,7 @@ cc_tablet_tool_map_add_relation (CcTabletToolMap *map,
CcWacomTool *tool)
{
gboolean tablets_changed = FALSE, tools_changed = FALSE;
+ gboolean new_tool_without_serial = FALSE;
gchar *tool_key, *device_key;
GError *error = NULL;
guint64 serial, id;
@@ -367,6 +368,7 @@ cc_tablet_tool_map_add_relation (CcTabletToolMap *map,
g_hash_table_insert (map->no_serial_tool_map,
g_strdup (device_key),
g_object_ref (tool));
+ new_tool_without_serial = TRUE;
}
} else {
tool_key = get_tool_key (serial);
@@ -383,12 +385,15 @@ cc_tablet_tool_map_add_relation (CcTabletToolMap *map,
styli = g_hash_table_lookup (map->tablet_map, device_key);
if (!g_list_find (styli, tool)) {
- tablets_changed = TRUE;
- keyfile_add_device_stylus (map, device_key, tool_key);
styli = g_list_prepend (styli, tool);
g_hash_table_replace (map->tablet_map,
g_strdup (device_key),
g_list_copy (styli));
+
+ if (serial || new_tool_without_serial) {
+ tablets_changed = TRUE;
+ keyfile_add_device_stylus (map, device_key, tool_key);
+ }
}
g_free (device_key);