[mutter] backends: Handle tablet settings lookups with no backing libwacom info



commit 3137ddb1a1071407f557a181121695e37e5faf3d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 19 16:30:44 2016 +0200

    backends: Handle tablet settings lookups with no backing libwacom info
    
    Those will be unseen by g-s-d/g-c-c, so no settings will be written on
    disk for those. Still, look up an ID correctly in this case instead of
    crashing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771628

 src/backends/meta-input-settings.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 9d78112..ae17f7b 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -1052,7 +1052,7 @@ static gchar *
 get_tablet_settings_id (ClutterInputDevice *device,
                         DeviceMappingInfo  *info)
 {
-  gchar *id, *machine_id;
+  gchar *id = NULL, *machine_id;
   gsize length;
 
   if (!g_file_get_contents ("/etc/machine-id", &machine_id, &length, NULL))
@@ -1060,13 +1060,15 @@ get_tablet_settings_id (ClutterInputDevice *device,
 
   machine_id = g_strstrip (machine_id);
 #ifdef HAVE_LIBWACOM
-  id = g_strdup_printf ("%s-%s", machine_id, libwacom_get_match (info->wacom_device));
-#else
-  id = g_strdup_printf ("%s-%s:%s", machine_id,
-                        clutter_input_device_get_vendor_id (device),
-                        clutter_input_device_get_product_id (device));
+  if (info->wacom_device)
+    id = g_strdup_printf ("%s-%s", machine_id, libwacom_get_match (info->wacom_device));
 #endif
 
+  if (!id)
+    id = g_strdup_printf ("%s-%s:%s", machine_id,
+                          clutter_input_device_get_vendor_id (device),
+                          clutter_input_device_get_product_id (device));
+
   g_free (machine_id);
 
   return id;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]