summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo@endlessm.com>2014-01-06 19:05:56 -0800
committerCosimo Cecchi <cosimo@endlessm.com>2014-01-09 09:41:40 -0800
commit6040dbe44a2e0a9d73ae8713de749139c46d52a2 (patch)
tree2ff7e58d1a6deac6bcdf35d55f20ab6ae6a34566
parent11f32f153b395d3ead7af3176488e85e47d5504d (diff)
downloadgnome-desktop-6040dbe44a2e0a9d73ae8713de749139c46d52a2.tar.gz
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
-rw-r--r--libgnome-desktop/gnome-rr-config.c1
-rw-r--r--libgnome-desktop/gnome-rr-config.h1
-rw-r--r--libgnome-desktop/gnome-rr-output-info.c7
-rw-r--r--libgnome-desktop/gnome-rr-private.h1
4 files changed, 10 insertions, 0 deletions
diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c
index 7d0eb655..976fb926 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 e7069e0e..e13825cc 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 21776920..5422db3e 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 f7d1cd99..5ad2b28e 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;