[gnome-color-manager] Add gcm_device_xrandr_is_primary() for future code



commit dba155f7e9112d29b9979d502c1bbd5331c4ce36
Author: Richard Hughes <richard hughsie com>
Date:   Sun Jun 20 08:37:56 2010 +0100

    Add gcm_device_xrandr_is_primary() for future code

 src/gcm-device-xrandr.c |   25 +++++++++++++++++++++++++
 src/gcm-device-xrandr.h |    1 +
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-device-xrandr.c b/src/gcm-device-xrandr.c
index 88bef21..7d24ae4 100644
--- a/src/gcm-device-xrandr.c
+++ b/src/gcm-device-xrandr.c
@@ -469,6 +469,31 @@ gcm_device_xrandr_get_config_data (GcmDevice *device)
 }
 
 /**
+ * gcm_device_xrandr_is_primary:
+ *
+ * Return value: %TRUE is the monitor is left-most
+ **/
+gboolean
+gcm_device_xrandr_is_primary (GcmDeviceXrandr *device_xrandr)
+{
+	gint x, y;
+	gboolean ret = FALSE;
+	GnomeRROutput *output;
+
+	/* check we have an output */
+	output = gcm_screen_get_output_by_name (device_xrandr->priv->screen,
+						device_xrandr->priv->output_name, NULL);
+	if (output == NULL)
+		goto out;
+
+	/* is the monitor our primary monitor */
+	gnome_rr_output_get_position (output, &x, &y);
+	ret = (x == 0 && y == 0);
+out:
+	return ret;
+}
+
+/**
  * gcm_device_xrandr_apply:
  *
  * Return value: %TRUE for success;
diff --git a/src/gcm-device-xrandr.h b/src/gcm-device-xrandr.h
index 9c37437..5d61525 100644
--- a/src/gcm-device-xrandr.h
+++ b/src/gcm-device-xrandr.h
@@ -59,6 +59,7 @@ const gchar	*gcm_device_xrandr_get_native_device	(GcmDeviceXrandr	*device_xrandr
 const gchar	*gcm_device_xrandr_get_eisa_id		(GcmDeviceXrandr	*device_xrandr);
 const gchar	*gcm_device_xrandr_get_edid_md5		(GcmDeviceXrandr	*device_xrandr);
 gboolean	 gcm_device_xrandr_get_fallback		(GcmDeviceXrandr	*device_xrandr);
+gboolean	 gcm_device_xrandr_is_primary		(GcmDeviceXrandr	*device_xrandr);
 
 G_END_DECLS
 



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