[gnome-settings-daemon] wacom: Automatically assign 'display' when heuristically found
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Automatically assign 'display' when heuristically found
- Date: Wed, 18 Jan 2012 23:21:56 +0000 (UTC)
commit f32c8ff3f8421558af7b97d5cad62e785d6919ba
Author: Jason Gerecke <killertofu gmail com>
Date: Fri Jan 13 15:38:32 2012 -0800
wacom: Automatically assign 'display' when heuristically found
If find_output was unable to find a defined mapping, but heuristics
provided a match, go ahead and store the mapping automatically.
https://bugzilla.gnome.org/show_bug.cgi?id=657423
plugins/wacom/gsd-wacom-device.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index d693fa9..8ee2c71 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -487,6 +487,37 @@ find_output_by_display (GsdWacomDevice *device)
return find_output_by_edid (edid[0], edid[1], edid[2]);
}
+static void
+set_display_by_output (GsdWacomDevice *device,
+ GnomeRROutputInfo *rr_output_info)
+{
+ GSettings *tablet;
+ GVariant *c_array;
+ GVariant *n_array;
+ const char **display;
+ gsize nvalues;
+ gchar o_vendor[4], *o_product, *o_serial;
+ const gchar *values[3];
+
+ tablet = gsd_wacom_device_get_settings (device);
+ c_array = g_settings_get_value (tablet, "display");
+ display = g_variant_get_strv (c_array, &nvalues);
+ if (nvalues != 3) {
+ g_warning("Unable set set display property. Got %"G_GSIZE_FORMAT" items; expected %d items.\n", nvalues, 4);
+ return;
+ }
+
+ gnome_rr_output_info_get_vendor (rr_output_info, &o_vendor);
+ o_product = g_strdup_printf ("%d", gnome_rr_output_info_get_product (rr_output_info));
+ o_serial = g_strdup_printf ("%d", gnome_rr_output_info_get_serial (rr_output_info));
+
+ values[0] = o_vendor;
+ values[1] = o_product;
+ values[2] = o_serial;
+ n_array = g_variant_new_strv(&values, 3);
+ g_settings_set_value (tablet, "display", n_array);
+}
+
static GnomeRROutputInfo*
find_output (GsdWacomDevice *device)
{
@@ -502,7 +533,14 @@ find_output (GsdWacomDevice *device)
{
rr_output_info = find_output_by_heuristic (device);
if (rr_output_info == NULL)
+ {
g_warning ("No fuzzy match based on heuristics was found.");
+ }
+ else
+ {
+ g_warning("Automatically mapping tablet to heuristically-found display.");
+ set_display_by_output (device, rr_output_info);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]