From 742bb6af1cc73d3762419d1bb5d181eaf01371bc Mon Sep 17 00:00:00 2001 From: Vladimir Stoiakin Date: Sat, 27 Sep 2025 23:23:41 +0300 Subject: [PATCH] build: do not allow to compile f0rmz and unl0kr without graphical backends --- f0rmz/config.c | 2 +- shared/backends.c | 17 ++++++----------- shared/backends.h | 15 +++++++-------- unl0kr/config.c | 2 +- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/f0rmz/config.c b/f0rmz/config.c index a5a4998..a0d9d98 100644 --- a/f0rmz/config.c +++ b/f0rmz/config.c @@ -165,7 +165,7 @@ static int parsing_handler(void* user_data, const char* section, const char* key */ void f0_config_init_opts(f0_config_opts *opts) { - opts->general.backend = bbx_backends_backends[0] == NULL ? BBX_BACKENDS_BACKEND_NONE : 0; + opts->general.backend = 0; opts->intro.title = "A Form!"; opts->intro.body = "Please complete the following form."; opts->theme.default_id = BBX_THEMES_THEME_BREEZY_DARK; diff --git a/shared/backends.c b/shared/backends.c index 74cfd6b..b845ea5 100644 --- a/shared/backends.c +++ b/shared/backends.c @@ -6,28 +6,23 @@ #include "backends.h" -#include "../shared/log.h" +#include "log.h" #include - -/** - * Public interface - */ - -const char *bbx_backends_backends[] = { +static const char *backends[] = { #if LV_USE_LINUX_FBDEV "fbdev", -#endif /* LV_USE_LINUX_FBDEV */ +#endif #if LV_USE_LINUX_DRM "drm", -#endif /* LV_USE_LINUX_DRM */ +#endif NULL }; bbx_backends_backend_id_t bbx_backends_find_backend_with_name(const char *name) { - for (int i = 0; bbx_backends_backends[i] != NULL; ++i) { - if (strcmp(bbx_backends_backends[i], name) == 0) { + for (int i = 0; backends[i] != NULL; ++i) { + if (strcmp(backends[i], name) == 0) { bbx_log(BBX_LOG_LEVEL_VERBOSE, "Found backend: %s\n", name); return i; } diff --git a/shared/backends.h b/shared/backends.h index 1bd4766..639ec14 100644 --- a/shared/backends.h +++ b/shared/backends.h @@ -7,7 +7,11 @@ #ifndef BBX_BACKENDS_H #define BBX_BACKENDS_H -#include "lvgl/lvgl.h" +#include "lv_conf.h" + +#if LV_USE_LINUX_FBDEV == 0 && LV_USE_LINUX_DRM == 0 +#error Neither of graphical backends is enabled +#endif /** * Backend identifiers @@ -18,17 +22,12 @@ typedef enum { BBX_BACKENDS_BACKEND_NONE = -1, #if LV_USE_LINUX_FBDEV BBX_BACKENDS_BACKEND_FBDEV, -#endif /* LV_USE_LINUX_FBDEV */ +#endif #if LV_USE_LINUX_DRM BBX_BACKENDS_BACKEND_DRM, -#endif /* LV_USE_LINUX_DRM */ +#endif } bbx_backends_backend_id_t; -/** - * Actual backends - */ -extern const char *bbx_backends_backends[]; - /** * Find the first backend with a given name. * diff --git a/unl0kr/config.c b/unl0kr/config.c index 12a9390..a17c91d 100644 --- a/unl0kr/config.c +++ b/unl0kr/config.c @@ -139,7 +139,7 @@ static int parsing_handler(void* user_data, const char* section, const char* key void ul_config_init_opts(ul_config_opts *opts) { opts->general.animations = false; - opts->general.backend = bbx_backends_backends[0] == NULL ? BBX_BACKENDS_BACKEND_NONE : 0; + opts->general.backend = 0; opts->general.timeout = 0; opts->keyboard.autohide = true; opts->keyboard.layout_id = SQ2LV_LAYOUT_US;