[gnome-desktop] gnome-rr: add API to check whether rotation is supported



commit 6040dbe44a2e0a9d73ae8713de749139c46d52a2
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Mon Jan 6 19:05:56 2014 -0800

    gnome-rr: add API to check whether rotation is supported
    
    Export a method on GnomeRROutputInfo to check which rotation options are
    supported.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=721672

 libgnome-desktop/gnome-rr-config.c      |    1 +
 libgnome-desktop/gnome-rr-config.h      |    1 +
 libgnome-desktop/gnome-rr-output-info.c |    7 +++++++
 libgnome-desktop/gnome-rr-private.h     |    1 +
 4 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c
index 7d0eb65..976fb92 100644
--- a/libgnome-desktop/gnome-rr-config.c
+++ b/libgnome-desktop/gnome-rr-config.c
@@ -193,6 +193,7 @@ gnome_rr_config_load_current (GnomeRRConfig *config, GError **error)
                output->priv->height = gnome_rr_mode_get_height (mode);
                output->priv->rate = gnome_rr_mode_get_freq (mode);
                output->priv->rotation = gnome_rr_crtc_get_current_rotation (crtc);
+                output->priv->available_rotations = gnome_rr_crtc_get_rotations (crtc);
 
                if (output->priv->x == 0 && output->priv->y == 0) {
                    if (clone_width == -1) {
diff --git a/libgnome-desktop/gnome-rr-config.h b/libgnome-desktop/gnome-rr-config.h
index e7069e0..e13825c 100644
--- a/libgnome-desktop/gnome-rr-config.h
+++ b/libgnome-desktop/gnome-rr-config.h
@@ -73,6 +73,7 @@ void gnome_rr_output_info_set_refresh_rate (GnomeRROutputInfo *self, int rate);
 
 GnomeRRRotation gnome_rr_output_info_get_rotation (GnomeRROutputInfo *self);
 void            gnome_rr_output_info_set_rotation (GnomeRROutputInfo *self, GnomeRRRotation rotation);
+gboolean        gnome_rr_output_info_supports_rotation (GnomeRROutputInfo *self, GnomeRRRotation rotation);
 
 gboolean gnome_rr_output_info_is_connected     (GnomeRROutputInfo *self);
 const char *gnome_rr_output_info_get_vendor    (GnomeRROutputInfo *self);
diff --git a/libgnome-desktop/gnome-rr-output-info.c b/libgnome-desktop/gnome-rr-output-info.c
index 2177692..5422db3 100644
--- a/libgnome-desktop/gnome-rr-output-info.c
+++ b/libgnome-desktop/gnome-rr-output-info.c
@@ -154,6 +154,13 @@ void gnome_rr_output_info_set_rotation (GnomeRROutputInfo *self, GnomeRRRotation
     self->priv->rotation = rotation;
 }
 
+gboolean gnome_rr_output_info_supports_rotation (GnomeRROutputInfo *self, GnomeRRRotation rotation)
+{
+    g_return_val_if_fail (GNOME_IS_RR_OUTPUT_INFO (self), FALSE);
+
+    return (self->priv->available_rotations & rotation);
+}
+
 /**
  * gnome_rr_output_info_is_connected:
  *
diff --git a/libgnome-desktop/gnome-rr-private.h b/libgnome-desktop/gnome-rr-private.h
index f7d1cd9..5ad2b28 100644
--- a/libgnome-desktop/gnome-rr-private.h
+++ b/libgnome-desktop/gnome-rr-private.h
@@ -62,6 +62,7 @@ struct _GnomeRROutputInfoPrivate
     int                        x;
     int                        y;
     GnomeRRRotation    rotation;
+    GnomeRRRotation    available_rotations;
 
     gboolean           connected;
     char *             vendor;


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