From a14d38b0cb0834a9147ed3ff64bfaf87a199adce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 14 Dec 2022 09:58:45 +0100 Subject: [PATCH] =?UTF-8?q?meson:=20make=20=E2=80=98xkb=E2=80=99=20plugin?= =?UTF-8?q?=20compile=20time=20optional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- meson.build | 2 ++ meson_options.txt | 2 ++ modules/meson.build | 10 +++++++--- plugin.c | 10 ++++++---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 3223683..874abf6 100644 --- a/meson.build +++ b/meson.build @@ -149,6 +149,7 @@ yambar = executable( plugin_removables_enabled ? '-DPLUGIN_ENABLED_REMOVABLES' : [], plugin_script_enabled ? '-DPLUGIN_ENABLED_SCRIPT' : [], plugin_sway_xkb_enabled ? '-DPLUGIN_ENABLED_SWAY_XKB' : [], + plugin_xkb_enabled ? '-DPLUGIN_ENABLED_XKB' : [], ], build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles', export_dynamic: true, @@ -204,6 +205,7 @@ summary( 'Removables monitoring': plugin_removables_enabled, 'Script': plugin_script_enabled, 'Sway XKB keyboard': plugin_sway_xkb_enabled, + 'XKB keyboard (for X11)': plugin_xkb_enabled, }, section: 'Optional modules', bool_yn: true diff --git a/meson_options.txt b/meson_options.txt index 6c85875..faa64a4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -40,3 +40,5 @@ option('plugin-script', type: 'feature', value: 'auto', description: 'Script support') option('plugin-sway-xkb', type: 'feature', value: 'auto', description: 'keyboard support for Sway') +option('plugin-xkb', type: 'feature', value: 'auto', + description: 'keyboard support for X11') diff --git a/modules/meson.build b/modules/meson.build index 9964b00..a89fed0 100644 --- a/modules/meson.build +++ b/modules/meson.build @@ -2,8 +2,6 @@ module_sdk = declare_dependency(dependencies: [pixman, threads, tllist, fcft]) modules = [] -xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11')) - # Optional deps alsa = dependency('alsa', required: get_option('plugin-alsa')) plugin_alsa_enabled = alsa.found() @@ -44,6 +42,9 @@ plugin_script_enabled = get_option('plugin-script').allowed() json_sway_xkb = dependency('json-c', required: get_option('plugin-sway-xkb')) plugin_sway_xkb_enabled = json_sway_xkb.found() +xcb_xkb = dependency('xcb-xkb', required: get_option('plugin-xkb')) +plugin_xkb_enabled = backend_x11 and xcb_xkb.found() + # Module name -> (source-list, dep-list) mod_data = {} @@ -115,9 +116,12 @@ if plugin_sway_xkb_enabled mod_data += {'sway-xkb': [['i3-common.c', 'i3-common.h'], [dynlist, json_sway_xkb]]} endif +if plugin_xkb_enabled + mod_data += {'xkb': [[], [xcb_stuff, xcb_xkb]]} +endif + if backend_x11 mod_data += { - 'xkb': [[], [xcb_stuff, xcb_xkb]], 'xwindow': [[], [xcb_stuff]], } endif diff --git a/plugin.c b/plugin.c index 79936cd..5b4024a 100644 --- a/plugin.c +++ b/plugin.c @@ -84,8 +84,10 @@ EXTERN_MODULE(script); #if defined(PLUGIN_ENABLED_SWAY_XKB) EXTERN_MODULE(sway_xkb); #endif -EXTERN_MODULE(river); +#if defined(PLUGIN_ENABLED_XKB) EXTERN_MODULE(xkb); +#endif +EXTERN_MODULE(river); EXTERN_MODULE(xwindow); EXTERN_PARTICLE(empty); @@ -204,12 +206,12 @@ init(void) #if defined(PLUGIN_ENABLED_SWAY_XKB) REGISTER_CORE_MODULE(sway-xkb, sway_xkb); #endif +#if defined(PLUGIN_ENABLED_XKB) + REGISTER_CORE_MODULE(xkb, xkb); +#endif #if defined(HAVE_PLUGIN_river) REGISTER_CORE_MODULE(river, river); #endif -#if defined(HAVE_PLUGIN_xkb) - REGISTER_CORE_MODULE(xkb, xkb); -#endif #if defined(HAVE_PLUGIN_xwindow) REGISTER_CORE_MODULE(xwindow, xwindow); #endif