aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-31 04:57:00 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-31 04:57:00 +0200
commitcb5d1b44d7c23b0ab77621fb237a3b213372f6ad (patch)
treec20209a1c415fb7b14b8c0f5ddbfdf72c1bb6db6 /src/lib
parentinfo: list adjustment method identifiers (diff)
downloadlibgamma-cb5d1b44d7c23b0ab77621fb237a3b213372f6ad.tar.gz
libgamma-cb5d1b44d7c23b0ab77621fb237a3b213372f6ad.tar.bz2
libgamma-cb5d1b44d7c23b0ab77621fb237a3b213372f6ad.tar.xz
add libgamma_is_method_available
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/libgamma-facade.c42
-rw-r--r--src/libgamma-facade.h9
2 files changed, 51 insertions, 0 deletions
diff --git a/src/libgamma-facade.c b/src/libgamma-facade.c
index ef5d369..c94d9e3 100644
--- a/src/libgamma-facade.c
+++ b/src/libgamma-facade.c
@@ -212,6 +212,48 @@ size_t libgamma_list_methods(int* restrict methods, size_t buf_size, int operati
/**
+ * Check whether an adjustment method is available, non-existing (invalid) methods will be
+ * identified as not available under the rationale that the library may be out of date.
+ *
+ * @param method The adjustment method.
+ * @return Whether the adjustment method is available.
+ */
+int libgamma_is_method_available(int method)
+{
+#ifdef HAVE_NO_LIBGAMMA_METHODS
+ (void) methods;
+ return 0;
+#else
+ switch (method)
+ {
+#ifdef HAVE_LIBGAMMA_METHOD_DUMMY
+ case LIBGAMMA_METHOD_DUMMY:
+#endif
+#ifdef HAVE_LIBGAMMA_METHOD_X_RANDR
+ case LIBGAMMA_METHOD_X_RANDR:
+#endif
+#ifdef HAVE_LIBGAMMA_METHOD_X_VIDMODE
+ case LIBGAMMA_METHOD_X_VIDMODE:
+#endif
+#ifdef HAVE_LIBGAMMA_METHOD_LINUX_DRM
+ case LIBGAMMA_METHOD_LINUX_DRM:
+#endif
+#ifdef HAVE_LIBGAMMA_METHOD_W32_GDI
+ case LIBGAMMA_METHOD_W32_GDI:
+#endif
+#ifdef HAVE_LIBGAMMA_METHOD_QUARTZ_CORE_GRAPHICS
+ case LIBGAMMA_METHOD_QUARTZ_CORE_GRAPHICS:
+#endif
+ return 1;
+
+ default:
+ return 0;
+ }
+#endif
+}
+
+
+/**
* Return the capabilities of an adjustment method.
*
* @param this The data structure to fill with the method's capabilities.
diff --git a/src/libgamma-facade.h b/src/libgamma-facade.h
index db5075b..fdf46ae 100644
--- a/src/libgamma-facade.h
+++ b/src/libgamma-facade.h
@@ -93,6 +93,15 @@ typedef double libgamma_gamma_rampsd_fun(double encoding);
size_t libgamma_list_methods(int* restrict methods, size_t buf_size, int operation);
/**
+ * Check whether an adjustment method is available, non-existing (invalid) methods will be
+ * identified as not available under the rationale that the library may be out of date.
+ *
+ * @param method The adjustment method.
+ * @return Whether the adjustment method is available.
+ */
+int libgamma_is_method_available(int method) __attribute__((const));
+
+/**
* Return the capabilities of an adjustment method.
*
* @param this The data structure to fill with the method's capabilities