From 95bf3c774ddb4908900d06099bc1d588bb69bbe4 Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Sat, 23 Jul 2022 06:09:08 +0200 Subject: [PATCH] Hide imlib_get/set_color_usage() if no X11 Pointless without. --- src/lib/Imlib2.h.in | 25 +++++++++++++------------ src/lib/api.c | 20 +++++++------------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/src/lib/Imlib2.h.in b/src/lib/Imlib2.h.in index 28671ad..5d04db7 100644 --- a/src/lib/Imlib2.h.in +++ b/src/lib/Imlib2.h.in @@ -686,6 +686,7 @@ EAPI int imlib_get_cache_size(void); */ EAPI void imlib_set_cache_size(int bytes); +#ifndef X_DISPLAY_MISSING /** * Get the maximum number of colors Imlib2 is allowed to allocate * @@ -704,17 +705,6 @@ EAPI int imlib_get_color_usage(void); */ EAPI void imlib_set_color_usage(int max); -/** - * Flush loader cache - * - * If you want Imlib2 to forcibly flush any cached loaders it has and - * re-load them from disk (this is useful if the program just - * installed a new loader and does not want to wait till Imlib2 deems - * it an optimal time to rescan the loaders) - */ -EAPI void imlib_flush_loaders(void); - -#ifndef X_DISPLAY_MISSING /** * Convenience function that returns the depth of a visual * @@ -738,6 +728,16 @@ EAPI Visual *imlib_get_best_visual(Display * display, int screen, int *depth_return); #endif /* X_DISPLAY_MISSING */ +/** + * Flush loader cache + * + * If you want Imlib2 to forcibly flush any cached loaders it has and + * re-load them from disk (this is useful if the program just + * installed a new loader and does not want to wait till Imlib2 deems + * it an optimal time to rescan the loaders) + */ +EAPI void imlib_flush_loaders(void); + /** * Load an image from file (header only) * @@ -1511,7 +1511,8 @@ EAPI int imlib_get_ximage_cache_size_max(void); * @param bytes XImage cache max size in bytes */ EAPI void imlib_set_ximage_cache_size_max(int bytes); -#endif + +#endif /* X_DISPLAY_MISSING */ /*-------------------------------- * Updates - lists of rectangles for storing required update draws diff --git a/src/lib/api.c b/src/lib/api.c index fee1102..7f0dbc8 100644 --- a/src/lib/api.c +++ b/src/lib/api.c @@ -722,35 +722,23 @@ imlib_set_cache_size(int bytes) __imlib_SetCacheSize(bytes); } +#ifdef BUILD_X11 EAPI int imlib_get_color_usage(void) { -#ifdef BUILD_X11 return (int)_max_colors; -#else - return 256; -#endif } EAPI void imlib_set_color_usage(int max) { -#ifdef BUILD_X11 if (max < 2) max = 2; else if (max > 256) max = 256; _max_colors = max; -#endif } -EAPI void -imlib_flush_loaders(void) -{ - __imlib_RemoveAllLoaders(); -} - -#ifdef BUILD_X11 EAPI int imlib_get_visual_depth(Display * display, Visual * visual) { @@ -768,6 +756,12 @@ imlib_get_best_visual(Display * display, int screen, int *depth_return) } #endif +EAPI void +imlib_flush_loaders(void) +{ + __imlib_RemoveAllLoaders(); +} + EAPI Imlib_Image imlib_load_image(const char *file) {