diff --git a/meson.build b/meson.build index ac4ff9d51..9a8f41840 100644 --- a/meson.build +++ b/meson.build @@ -280,6 +280,9 @@ x11_dep = dependency('x11-xcb', required : get_option('x11')) summary({'X11 (x11-bell)': x11_dep.found()}, bool_yn: true, section: 'Misc dependencies') +xfixes_dep = dependency('xfixes', required : get_option('x11-xfixes'), version: '>= 6') +cdata.set('HAVE_XFIXES_6', xfixes_dep.found()) + canberra_dep = dependency('libcanberra', required : get_option('libcanberra')) summary({'libcanberra (x11-bell)': canberra_dep.found()}, bool_yn: true, section: 'Misc dependencies') diff --git a/meson_options.txt b/meson_options.txt index 961ae2a76..49d5b2203 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -229,6 +229,10 @@ option('x11', description: 'Enable code that depends on X11', type: 'feature', value: 'auto') +option('x11-xfixes', + description: 'Enable code that depends on XFixes', + type: 'feature', + value: 'auto') option('libcanberra', description: 'Enable code that depends on libcanberra', type: 'feature', diff --git a/src/modules/meson.build b/src/modules/meson.build index 2d3a800d3..6d5d4fdbc 100644 --- a/src/modules/meson.build +++ b/src/modules/meson.build @@ -489,7 +489,7 @@ pipewire_module_x11_bell = shared_library('pipewire-module-x11-bell', install : true, install_dir : modules_install_dir, install_rpath: modules_install_dir, - dependencies : [mathlib, dl_lib, rt_lib, pipewire_dep, x11_dep, canberra_dep], + dependencies : [mathlib, dl_lib, rt_lib, pipewire_dep, x11_dep, xfixes_dep, canberra_dep], ) endif summary({'x11-bell': build_module_x11_bell}, bool_yn: true, section: 'Optional Modules') diff --git a/src/modules/module-x11-bell.c b/src/modules/module-x11-bell.c index cf73f1d0c..b7bc2a970 100644 --- a/src/modules/module-x11-bell.c +++ b/src/modules/module-x11-bell.c @@ -38,6 +38,10 @@ #include #include +#ifdef HAVE_XFIXES_6 +#include +#endif + #include #include @@ -190,6 +194,10 @@ static int x11_connect(struct impl *impl, const char *name) XSetIOErrorExitHandler(impl->display, x11_io_error_exit_handler, impl); #endif +#ifdef HAVE_XFIXES_6 + XFixesSetClientDisconnectMode(impl->display, XFixesClientDisconnectFlagTerminate); +#endif + major = XkbMajorVersion; minor = XkbMinorVersion;