[gnome-desktop] GnomeRR: read the physical output size for mutter



commit 375293f1a9adeb2a9c7e5bc065a41949a0911d00
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Mon Aug 19 17:52:52 2013 +0200

    GnomeRR: read the physical output size for mutter
    
    And expose it in the API, so that the control center can use it
    to show the diagonal and aspect ratio.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705919

 libgnome-desktop/gnome-rr.c |   23 +++++++++++++++++++++++
 libgnome-desktop/gnome-rr.h |    3 +++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c
index d2cd561..2d1613a 100644
--- a/libgnome-desktop/gnome-rr.c
+++ b/libgnome-desktop/gnome-rr.c
@@ -71,6 +71,8 @@ struct GnomeRROutput
     char *              vendor;
     char *              product;
     char *              serial;
+    int                 width_mm;
+    int                 height_mm;
     GBytes *            edid;
     char *              edid_file;
 
@@ -1235,6 +1237,8 @@ output_initialize (GnomeRROutput *output, GVariant *info)
     g_variant_lookup (properties, "vendor", "s", &output->vendor);
     g_variant_lookup (properties, "product", "s", &output->product);
     g_variant_lookup (properties, "serial", "s", &output->serial);
+    g_variant_lookup (properties, "width-mm", "i", &output->width_mm);
+    g_variant_lookup (properties, "height-mm", "i", &output->height_mm);
     g_variant_lookup (properties, "display-name", "s", &output->display_name);
     g_variant_lookup (properties, "backlight", "i", &output->backlight);
     g_variant_lookup (properties, "primary", "b", &output->is_primary);
@@ -1371,6 +1375,25 @@ gnome_rr_output_get_ids_from_edid (GnomeRROutput         *output,
     *serial = g_strdup (output->serial);
 }
 
+/**
+ * gnome_rr_output_get_physical_size:
+ * @output: a #GnomeRROutput
+ * @width_mm: (out) (allow-none):
+ * @height_mm: (out) (allow-none):
+ */
+void
+gnome_rr_output_get_physical_size (GnomeRROutput *output,
+                                  int           *width_mm,
+                                  int           *height_mm)
+{
+    g_return_if_fail (output != NULL);
+
+    if (width_mm)
+       *width_mm = output->width_mm;
+    if (height_mm)
+       *height_mm = output->height_mm;
+}
+
 const char *
 gnome_rr_output_get_display_name (GnomeRROutput *output)
 {
diff --git a/libgnome-desktop/gnome-rr.h b/libgnome-desktop/gnome-rr.h
index 15f1f4d..a0d42f7 100644
--- a/libgnome-desktop/gnome-rr.h
+++ b/libgnome-desktop/gnome-rr.h
@@ -149,6 +149,9 @@ void            gnome_rr_output_get_ids_from_edid  (GnomeRROutput         *outpu
                                                     char                 **vendor,
                                                     char                 **product,
                                                     char                 **serial);
+void            gnome_rr_output_get_physical_size  (GnomeRROutput         *output,
+                                                    int                   *width_mm,
+                                                    int                   *height_mm);
 
 gint            gnome_rr_output_get_backlight      (GnomeRROutput         *output);
 gboolean        gnome_rr_output_set_backlight      (GnomeRROutput         *output,


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