summaryrefslogtreecommitdiff
path: root/endless/eosutil.c
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2015-12-15 22:15:06 -0800
committerPhilip Chimento <philip@endlessm.com>2015-12-15 23:12:55 -0800
commitfef6ea4704c375876b844ade88b0a344e1cd9519 (patch)
tree330be2e7e0eca97fdb4652a24a0ee3e0e4717943 /endless/eosutil.c
parentddb27c4c3c65775592ecf7698ea707732a28fff5 (diff)
Add eos_is_composite_tv_screen()
This function simply queries the resolution of a screen, or the default screen if none is given. A resolution of 720x480 or 720x576 indicates a composite TV, since we don't allow the user to select those resolutions for themselves. [endlessm/eos-sdk#3930]
Diffstat (limited to 'endless/eosutil.c')
-rw-r--r--endless/eosutil.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/endless/eosutil.c b/endless/eosutil.c
index 6ef12bf..7926cb5 100644
--- a/endless/eosutil.c
+++ b/endless/eosutil.c
@@ -66,3 +66,30 @@ eos_get_system_personality (void)
return personality;
}
+
+/**
+ * eos_is_composite_tv_screen:
+ * @screen: a #GdkScreen, or %NULL to use the default display's default screen.
+ *
+ * Determines whether @screen is a composite TV out.
+ *
+ * Returns: %TRUE if @screen is a composite TV, otherwise %FALSE.
+ *
+ * Since: 0.6
+ */
+gboolean
+eos_is_composite_tv_screen (GdkScreen *screen)
+{
+ if (screen == NULL)
+ screen = gdk_screen_get_default ();
+
+ if (gdk_screen_get_width (screen) != 720)
+ return FALSE;
+
+ int height = gdk_screen_get_height (screen);
+ if (height != 480 && height != 576)
+ return FALSE;
+
+ g_debug ("Composite screen detected for screen %p", screen);
+ return TRUE;
+}