From cb5d1b44d7c23b0ab77621fb237a3b213372f6ad Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 31 May 2014 04:57:00 +0200 Subject: add libgamma_is_method_available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libgamma-facade.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/libgamma-facade.c') 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 @@ -211,6 +211,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. * -- cgit v1.2.3-70-g09d2