[gnome-control-center/wip/wayland-display: 69/70] wacom: adapt to GnomeRR API changes
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/wayland-display: 69/70] wacom: adapt to GnomeRR API changes
- Date: Thu, 8 Aug 2013 12:27:43 +0000 (UTC)
commit 9af5f2a2c51d51137613c9845b2810024e4ffa7e
Author: Giovanni Campagna <gcampagn redhat com>
Date: Thu Aug 8 14:22:41 2013 +0200
wacom: adapt to GnomeRR API changes
GnomeRR now returns the EDID IDs as strings directly, so we don't
need to convert them to compare to the settings. Also, we don't
need to filter disconnected outputs, it's done by mutter now.
https://bugzilla.gnome.org/show_bug.cgi?id=705573
panels/wacom/gsd-wacom-device.c | 73 +++++++++++++++-----------------------
1 files changed, 29 insertions(+), 44 deletions(-)
---
diff --git a/panels/wacom/gsd-wacom-device.c b/panels/wacom/gsd-wacom-device.c
index e90371a..8a11477 100644
--- a/panels/wacom/gsd-wacom-device.c
+++ b/panels/wacom/gsd-wacom-device.c
@@ -523,35 +523,26 @@ find_output_by_edid (GnomeRRScreen *rr_screen, const gchar *vendor, const gchar
rr_outputs = gnome_rr_screen_list_outputs (rr_screen);
for (i = 0; rr_outputs[i] != NULL; i++) {
- gchar *o_vendor_s;
- gchar *o_product_s;
- int o_product;
- gchar *o_serial_s;
- int o_serial;
+ gchar *o_vendor;
+ gchar *o_product;
+ gchar *o_serial;
gboolean match;
- if (!gnome_rr_output_is_connected (rr_outputs[i]))
- continue;
-
- if (!gnome_rr_output_get_ids_from_edid (rr_outputs[i],
- &o_vendor_s,
- &o_product,
- &o_serial))
- continue;
-
- o_product_s = g_strdup_printf ("%d", o_product);
- o_serial_s = g_strdup_printf ("%d", o_serial);
+ gnome_rr_output_get_ids_from_edid (rr_outputs[i],
+ &o_vendor,
+ &o_product,
+ &o_serial);
g_debug ("Checking for match between '%s','%s','%s' and '%s','%s','%s'", \
- vendor, product, serial, o_vendor_s, o_product_s, o_serial_s);
+ vendor, product, serial, o_vendor, o_product, o_serial);
- match = (vendor == NULL || g_strcmp0 (vendor, o_vendor_s) == 0) && \
- (product == NULL || g_strcmp0 (product, o_product_s) == 0) && \
- (serial == NULL || g_strcmp0 (serial, o_serial_s) == 0);
+ match = (vendor == NULL || g_strcmp0 (vendor, o_vendor) == 0) && \
+ (product == NULL || g_strcmp0 (product, o_product) == 0) && \
+ (serial == NULL || g_strcmp0 (serial, o_serial) == 0);
- g_free (o_vendor_s);
- g_free (o_product_s);
- g_free (o_serial_s);
+ g_free (o_vendor);
+ g_free (o_product);
+ g_free (o_serial);
if (match) {
retval = rr_outputs[i];
@@ -575,9 +566,6 @@ find_builtin_output (GnomeRRScreen *rr_screen)
rr_outputs = gnome_rr_screen_list_outputs (rr_screen);
for (i = 0; rr_outputs[i] != NULL; i++) {
- if (!gnome_rr_output_is_connected (rr_outputs[i]))
- continue;
-
if (gnome_rr_output_is_builtin_display(rr_outputs[i])) {
retval = rr_outputs[i];
break;
@@ -701,8 +689,7 @@ set_display_by_output (GsdWacomDevice *device,
GVariant *c_array;
GVariant *n_array;
gsize nvalues;
- gchar *o_vendor_s, *o_product_s, *o_serial_s;
- int o_product, o_serial;
+ gchar *o_vendor, *o_product, *o_serial;
const gchar *values[3];
tablet = gsd_wacom_device_get_settings (device);
@@ -713,28 +700,26 @@ set_display_by_output (GsdWacomDevice *device,
return;
}
- if (rr_output == NULL ||
- !gnome_rr_output_get_ids_from_edid (rr_output,
- &o_vendor_s,
- &o_product,
- &o_serial)) {
- o_vendor_s = g_strdup ("");
- o_product_s = g_strdup ("");
- o_serial_s = g_strdup ("");
+ if (rr_output == NULL) {
+ o_vendor = g_strdup ("");
+ o_product = g_strdup ("");
+ o_serial = g_strdup ("");
} else {
- o_product_s = g_strdup_printf ("%d", o_product);
- o_serial_s = g_strdup_printf ("%d", o_serial);
+ gnome_rr_output_get_ids_from_edid (rr_output,
+ &o_vendor,
+ &o_product,
+ &o_serial);
}
- values[0] = o_vendor_s;
- values[1] = o_product_s;
- values[2] = o_serial_s;
+ values[0] = o_vendor;
+ values[1] = o_product;
+ values[2] = o_serial;
n_array = g_variant_new_strv ((const gchar * const *) &values, 3);
g_settings_set_value (tablet, "display", n_array);
- g_free (o_vendor_s);
- g_free (o_product_s);
- g_free (o_serial_s);
+ g_free (o_vendor);
+ g_free (o_product);
+ g_free (o_serial);
}
static GsdWacomRotation
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]