Make dbus dependency optional
I would have opened a MR instead, but I can't fork the project for some reason(new to gitlab, just made an account yesterday to open this issue). See https://forums.gentoo.org/viewtopic-t-1164263.html for full context. The devs there to ld me to try this with upstream. Gtk3 depends on at-spi2-core, which depends on dbus. However, with a few small patches, one can easily loosen the dependency on at-spi2-core, allowing gtk3 to work with atk instead. Atk doesn't depend on dbus, so Gtk3 will build and work without dbus. These are the patches:
--- 1/gtk/a11y/gtkaccessibility.c
+++ 1/gtk/a11y/gtkaccessibility.c
@@ -38,8 +38,10 @@
#include <gtk/gtkaccessible.h>
#ifdef GDK_WINDOWING_X11
+#ifdef HAVE_ATK_BRIDGE
#include <atk-bridge.h>
#endif
+#endif
static gboolean gail_focus_watcher (GSignalInvocationHint *ihint,
guint n_param_values,
@@ -983,8 +985,10 @@ _gtk_accessibility_init (void)
do_window_event_initialization ();
#ifdef GDK_WINDOWING_X11
+#ifdef HAVE_ATK_BRIDGE
atk_bridge_adaptor_init (NULL, NULL);
#endif
+#endif
atk_misc_instance = g_object_new (GTK_TYPE_MISC_IMPL, NULL);
}
Martin V\"ath <martin at mvath.de>
Honor atk_bridge option
--- 1/meson.build
+++ 2/meson.build
@@ -564,7 +564,12 @@
xfixes_dep = dependency('xfixes', required: false)
xcomposite_dep = dependency('xcomposite', required: false)
fontconfig_dep = dependency('fontconfig', fallback: ['fontconfig', 'fontconfig_dep'])
- atkbridge_dep = dependency('atk-bridge-2.0', version: at_spi2_atk_req)
+
+ atk_bridge_enabled = get_option('atk_bridge')
+ if atk_bridge_enabled
+ atkbridge_dep = dependency('atk-bridge-2.0', version: at_spi2_atk_req)
+ cdata.set('HAVE_ATK_BRIDGE', 1)
+ endif
backend_immodules += ['xim']
@@ -583,7 +588,9 @@
x11_pkgs += ['xdamage']
endif
- atk_pkgs += ['atk-bridge-2.0']
+ if atk_bridge_enabled
+ atk_pkgs += ['atk-bridge-2.0']
+ endif
cdata.set('HAVE_XDAMAGE', xdamage_dep.found() ? 1 : false)
cdata.set('HAVE_XCURSOR', xcursor_dep.found() ? 1 : false)
Martin V\"ath <martin at mvath.de>
Add atk_bridge option
--- 1/meson_options.txt
+++ 2/meson_options.txt
@@ -47,3 +47,7 @@
# input modules
option('builtin_immodules', type: 'string',
value: '', description: 'Build specified immodules into GTK so/DLL (comma-separated list), "all", "none" or "backend"')
+
+# Recommended dependencies
+option('atk_bridge', type: 'boolean', value: true,
+ description : 'Enable atk-bridge support')