From 8eb20971873d23e6849f1a58d9f28e61ff9c9fb7 Mon Sep 17 00:00:00 2001 From: Thomas Adam Date: Wed, 10 Apr 2024 08:57:29 +0000 Subject: [PATCH] PRIVATE_COLORSET: always assume this is true For years, we've been setting FVWM_COLORSET_PRIVATE=1, so there is no need for the include guards. --- fvwm/Makefile.am | 3 +- libs/Colorset.h | 7 ----- meson.build | 78 ++++++++++++++++++------------------------------ meson.options | 56 +++++++++++++++++++++++++++++++--- 4 files changed, 82 insertions(+), 62 deletions(-) diff --git a/fvwm/Makefile.am b/fvwm/Makefile.am index bb04b6d22..0f794f429 100644 --- a/fvwm/Makefile.am +++ b/fvwm/Makefile.am @@ -49,5 +49,4 @@ AM_CFLAGS = \ -DFVWM_MODULEDIR=\"$(FVWM_MODULEDIR)\" \ -DFVWM_DATADIR=\"$(FVWM_DATADIR)\" \ -DFVWM_CONFDIR=\"$(FVWM_CONFDIR)\" \ - -DFVWM_COLORSET_PRIVATE=1 \ - -DLOCALEDIR=\"$(LOCALEDIR)\" + -DLOCALEDIR=\"$(LOCALEDIR)\" \ No newline at end of file diff --git a/libs/Colorset.h b/libs/Colorset.h index a2447c06b..c5a606c5c 100644 --- a/libs/Colorset.h +++ b/libs/Colorset.h @@ -32,8 +32,6 @@ typedef struct Colorset unsigned int tint_percent : 7; unsigned int icon_alpha_percent : 7; unsigned int icon_tint_percent : 7; -#ifdef FVWM_COLORSET_PRIVATE - /* fvwm/colorset.c use only */ Pixel fg_tint; Pixel fg_saved; Pixel bg_tint; @@ -53,7 +51,6 @@ typedef struct Colorset Bool dither; Bool allows_buffered_transparency; Bool is_maybe_root_transparent; -#endif } colorset_t; #define PIXMAP_TILED 0 @@ -68,7 +65,6 @@ typedef struct Colorset #define SHAPE_STRETCH 1 #define SHAPE_STRETCH_ASPECT 2 -#ifdef FVWM_COLORSET_PRIVATE #define FG_SUPPLIED 0x1 #define BG_SUPPLIED 0x2 #define HI_SUPPLIED 0x4 @@ -80,7 +76,6 @@ typedef struct Colorset #define FG_TINT_SUPPLIED 0x100 #define BG_TINT_SUPPLIED 0x200 #define ICON_TINT_SUPPLIED 0x400 -#endif /* colorsets are stored as an array of structs to permit fast dereferencing */ extern colorset_t *Colorset; @@ -155,11 +150,9 @@ extern colorset_t *Colorset; (cset != NULL && cset->pixmap == ParentRelative && \ cset->tint_percent > 0) -#ifdef FVWM_COLORSET_PRIVATE /* Create n new colorsets, fvwm/colorset.c does its own thing (different size) */ void AllocColorset(int n); -#endif /* dump one */ char *DumpColorset(int n, colorset_t *colorset); diff --git a/meson.build b/meson.build index c6bb0ff12..4fb5922b6 100644 --- a/meson.build +++ b/meson.build @@ -74,6 +74,7 @@ conf.set('SIGNAL_RETURN', 'return') conf.set('ICONV_ARG_CONST', '') conf.set('fd_set_size_t', 'int') conf.set('EXECUTABLE_EXTENSION', 'NULL') +conf.set10('HAVE_XOUTPUT_METHOD', true) # Enable FTMs if host_machine.system() == 'linux' @@ -270,16 +271,18 @@ endif librsvg = dependency( 'librsvg-2.0', version: '>=2.13.92', - required: get_option('rsvg'), + required: get_option('svg'), ) if librsvg.found() all_found_deps += librsvg conf.set10('HAVE_RSVG', true) # We need at least one of these dependencies - svg_opt_deps = ['cairo', 'cairo-svg', 'libsvg-cairo'] + svg_backends = ['cairo', 'cairo-svg', 'libsvg-cairo'] svg_deps = [] - foreach d : svg_opt_deps - svg_dep = dependency(d, required: false) + foreach d : svg_backends + # By treating these as features we can let automagic find one or more backends + # or we can explicitly set one or more backends as required, or disable ones we don't want to use. + svg_dep = dependency(d, required: get_option(d)) if svg_dep.found() svg_deps += svg_dep summary_depvals += {d: svg_dep} @@ -288,8 +291,9 @@ if librsvg.found() endif endforeach if svg_deps.length() == 0 + # If everything is set to auto (or the user turns all the backends off) we need to explicitly fail here. error( - 'librsvg found but also require one of: ' + ', '.join(svg_opt_deps) + + 'librsvg found but also require one of: ' + ', '.join(svg_backends) + ' to build SVG support.', ) else @@ -303,69 +307,40 @@ if sm.found() conf.set10('SESSION', true) endif +xcursor = dependency('xcursor', required: get_option('xcursor')) +if xcursor.found() + all_found_deps += xcursor + conf.set10('HAVE_XCURSOR', true) +endif + xext = dependency('xext', required: get_option('xext')) if xext.found() all_found_deps += xext conf.set10('HAVE_SHAPE', true) endif -# Automagic optional dependencies -# TODO: Automagic dependencies are a nightmare for -# downstream packagers who need to know what is -# and is not enabled for a package at build-time -# not what was randomly also found on their system. - -# We should either make these required or hide them behind -# a feature flag. - -freetype = dependency('freetype2', required: false) -if freetype.found() - all_found_deps += freetype - summary_depvals += {'freetype': freetype} - conf.set10('HAVE_XFT', true) - freetype_opt_deps = ['xft', 'fontconfig'] - freetype_deps = [] - foreach d : freetype_opt_deps - # These deps were previously listed as 'optional', but with 'required: true' - freetype_dep = dependency(d, required: false) - if freetype_dep.found() - freetype_deps += freetype_dep - summary_depvals += {d: freetype_dep} - conf.set10('HAVE_' + d.to_upper().underscorify(), true) - endif - endforeach - if freetype_deps.length() > 0 - all_found_deps += freetype_deps - endif -endif - -xkbcommon = dependency('xkbcommon', required: false) +xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon')) if xkbcommon.found() all_found_deps += xkbcommon conf.set10('HAVE_X11_XKBLIB_H', true) - summary_depvals += {'xkbcommon': xkbcommon} endif -xpm = dependency('xpm', required: false) +xpm = dependency('xpm', required: get_option('xpm')) if xpm.found() all_found_deps += xpm conf.set10('HAVE_XPM', true) - summary_depvals += {'xpm': xpm} endif -automagic_opt_deps = ['xcursor', 'xrender'] -foreach ad : automagic_opt_deps - this_dep = dependency(ad, required: true) - summary_depvals += {ad: this_dep} - conf.set10('HAVE_' + ad.to_upper().underscorify(), true) - all_found_deps += this_dep -endforeach +xrender = dependency('xrender', required: get_option('xrender')) +if xrender.found() + all_found_deps += xrender + conf.set10('HAVE_XRENDER', true) +endif # Hard-coded non_configurable_ops = [ 'FMiniIconsSupported', 'HAVE_XSM', - 'FVWM_COLORSET_PRIVATE', ] foreach nco : non_configurable_ops @@ -545,14 +520,19 @@ summary( ) featurevals = { - 'bidi': fribidi.found() ? fribidi : false, + 'BiDi': fribidi.found() ? fribidi : false, + 'FreeType': freetype.found() ? freetype : false, 'Go Modules': golang.found(), 'iconv': iconv.found(), 'NLS': libintl.found(), + 'PNG support': libpng.found() ? libpng : false, 'Session Management': sm.found() ? sm : false, 'Shaped Windows': xext.found() ? xext : false, - 'PNG support': libpng.found() ? libpng : false, 'SVG support': librsvg.found() ? librsvg : false, + 'Xcursor': xcursor.found() ? xcursor : false, + 'xkbcommon': xkbcommon.found() ? xkbcommon : false, + 'XPM support': xpm.found() ? xpm : false, + 'XRender': xrender.found() ? xrender : false, } if not golang.found() diff --git a/meson.options b/meson.options index 75900c30d..3d37cef62 100644 --- a/meson.options +++ b/meson.options @@ -4,6 +4,24 @@ option( value: 'auto', description: 'Enable fribidi support', ) +option( + 'cairo', + type: 'feature', + value: 'auto', + description: 'Use Cairo as a librsvg backend', +) +option( + 'cairo-svg', + type: 'feature', + value: 'auto', + description: 'Use CairoSVG as a librsvg backend', +) +option( + 'freetype', + type: 'feature', + value: 'auto', + description: 'Enable freetype support', +) option( 'golang', type: 'feature', @@ -27,6 +45,12 @@ option( value: 'auto', description: 'Enable iconv support', ) +option( + 'libsvg-cairo', + type: 'feature', + value: 'auto', + description: 'Use librsvg as a librsvg backend', +) option( 'mandoc', type: 'boolean', @@ -47,20 +71,44 @@ option( description: 'Enable readline support for FvwmConsole (disabled if using Go)', ) option( - 'rsvg', + 'sm', + type: 'feature', + value: 'auto', + description: 'Enable session management support', +) +option( + 'svg', type: 'feature', value: 'auto', description: 'Enable svg support', ) option( - 'sm', + 'xcursor', type: 'feature', value: 'auto', - description: 'Enable session management support', + description: 'Enable Xcursor support', ) option( 'xext', type: 'feature', value: 'auto', - description: 'Enable shaped window support', + description: 'Enable shaped window support via Xext', +) +option( + 'xkbcommon', + type: 'feature', + value: 'auto', + description: 'Enable xkbcommon support', +) +option( + 'xrender', + type: 'feature', + value: 'auto', + description: 'Enable XRender support', +) +option( + 'xpm', + type: 'feature', + value: 'auto', + description: 'Enable X PixMap (xpm) support', )