summaryrefslogtreecommitdiff
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
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]
-rw-r--r--docs/reference/endless/endless-sections.txt1
-rw-r--r--endless/endless.h3
-rw-r--r--endless/eosutil.c27
3 files changed, 31 insertions, 0 deletions
diff --git a/docs/reference/endless/endless-sections.txt b/docs/reference/endless/endless-sections.txt
index 96b5ff3..c543d42 100644
--- a/docs/reference/endless/endless-sections.txt
+++ b/docs/reference/endless/endless-sections.txt
@@ -9,6 +9,7 @@ EOS_SDK_MAJOR_VERSION
EOS_SDK_MINOR_VERSION
EOS_SDK_MICRO_VERSION
eos_get_system_personality
+eos_is_composite_tv_screen
<SUBSECTION Private>
EOS_DEFINE_ENUM_TYPE
EOS_ENUM_VALUE
diff --git a/endless/endless.h b/endless/endless.h
index 4e9d3f2..2b328e2 100644
--- a/endless/endless.h
+++ b/endless/endless.h
@@ -28,6 +28,9 @@ gboolean eos_hello_sample_function (GFile *file,
EOS_SDK_AVAILABLE_IN_0_0
const gchar * eos_get_system_personality (void);
+EOS_SDK_AVAILABLE_IN_0_6
+gboolean eos_is_composite_tv_screen (GdkScreen *screen);
+
G_END_DECLS
#endif
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;
+}