[gnome-color-manager] Fix up an important bug, where the EDID was being reused on the wrong device and hence duplicate det
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Fix up an important bug, where the EDID was being reused on the wrong device and hence duplicate det
- Date: Wed, 2 Dec 2009 14:25:33 +0000 (UTC)
commit 4d6dc94acaebcfbc0f2824ef498a2c972cd59e1c
Author: Richard Hughes <richard hughsie com>
Date: Wed Dec 2 14:07:54 2009 +0000
Fix up an important bug, where the EDID was being reused on the wrong device and hence duplicate detection was not working correctly
src/gcm-client.c | 54 +++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 39 insertions(+), 15 deletions(-)
---
diff --git a/src/gcm-client.c b/src/gcm-client.c
index 55810b9..a610156 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -527,6 +527,7 @@ gcm_client_xrandr_add (GcmClient *client, GnomeRROutput *output)
gchar *manufacturer = NULL;
gchar *model = NULL;
const guint8 *data;
+ gboolean connected;
GcmClientPrivate *priv = client->priv;
/* if nothing connected then ignore */
@@ -536,16 +537,6 @@ gcm_client_xrandr_add (GcmClient *client, GnomeRROutput *output)
goto out;
}
- /* get details */
- id = gcm_client_get_id_for_xrandr_device (client, output);
-
- /* we might have a previous saved device with this ID, in which case nuke it */
- device = gcm_client_get_device_by_id (client, id);
- if (device != NULL) {
- g_ptr_array_remove (client->priv->array, device);
- g_object_unref (device);
- }
-
/* parse the EDID to get a crtc-specific name, not an output specific name */
data = gnome_rr_output_get_edid_data (output);
if (data != NULL) {
@@ -554,15 +545,48 @@ gcm_client_xrandr_add (GcmClient *client, GnomeRROutput *output)
egg_warning ("failed to parse edid");
goto out;
}
+ } else {
+ /* reset, as not available */
+ gcm_edid_reset (priv->edid);
+ }
- /* get data about the display */
- g_object_get (priv->edid,
- "monitor-name", &model,
- "vendor-name", &manufacturer,
- "serial-number", &serial,
+ /* get details */
+ id = gcm_client_get_id_for_xrandr_device (client, output);
+ egg_debug ("asking to add %s", id);
+
+ /* we might have a previous saved device with this ID, in which case nuke it */
+ device = gcm_client_get_device_by_id (client, id);
+ if (device != NULL) {
+
+ /* old device not connected */
+ g_object_get (device,
+ "connected", &connected,
NULL);
+
+ /* this is just a dupe */
+ if (connected) {
+ egg_debug ("ignoring dupe");
+ goto out;
+ }
+
+ /* remove from the array */
+ g_ptr_array_remove (client->priv->array, device);
+
+ /* emit a signal */
+ egg_debug ("emit removed: %s (unconnected device that has just been connected)", id);
+ g_signal_emit (client, signals[SIGNAL_REMOVED], 0, device);
+
+ /* unref our copy */
+ g_object_unref (device);
}
+ /* get data about the display */
+ g_object_get (priv->edid,
+ "monitor-name", &model,
+ "vendor-name", &manufacturer,
+ "serial-number", &serial,
+ NULL);
+
/* refine data if it's missing */
output_name = gnome_rr_output_get_name (output);
ret = gcm_utils_output_is_lcd_internal (output_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]