Commit graph

21 commits

Author SHA1 Message Date
Wim Taymans
fa771af329 modules: use the right module name in the docs
Fixes #4172
2024-08-07 10:30:54 +02:00
Wim Taymans
8ecc61e117 module-x11-bell: force pulse backend
The libcanberra ALSA backend has some races and causes crashes, we
should try to not use that one.

Fixes #3688
2023-12-05 16:24:37 +01:00
Pauli Virtanen
fdcb02ed75 modules: add Module Name section to the module reference docs 2023-11-20 08:41:13 +00:00
Pauli Virtanen
eca773fc12 modules: strip "PipeWire Module:" from Doxygen page name
Make them appear nicer in the output.
2023-11-19 16:39:15 +00:00
Wim Taymans
893b46c0d0 module-x11-bell: protect libcanberra calls with a mutex
The libcanberra calls use libtool, which can not be called from multiple
threads at the same time. Use a global lock to serialize these calls in
the x11-bell module.

This is only a problem when multiple libcanberra calls are made in the
same process, such when you load the x11-bell module twice. There is no
guarantee that other libcanberra calls will not interfere but for now
we only use libcanberra here.

Fixes #2834
2023-08-03 10:08:11 +02:00
Wim Taymans
dad87fb3a8 module-x11-bell: move error to info
Make the XOpenDiplay call failure print an info message instead of a
warning. We usually ignore this error in the config file. Add a
suggestion for how to fix this issue in the info log.

Fixes #2918
2023-04-17 11:11:01 +02:00
Wim Taymans
07e6f44e58 modules: clean up USAGE arguments
use () to mark optional arguments to avoid confusion with arrays.
Add some more optional arguments.
2023-03-22 16:35:55 +01:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Wim Taymans
164e343dbf remove pipewire/private.h includes when possible
In many places this is not needed.
Expose pw_impl_node_set_param() for adapter.
2023-01-20 16:08:38 +01:00
Wim Taymans
4574678424 conf: load module-x11-bell if available
Fixes !1375
2022-10-03 12:00:16 +02:00
Barnabás Pőcze
d6c5da5678 pipewire: module-x11-bell: mark connection as terminatable
Since XFixes version 6[1] it is possible to mark
an X connection as terminatable. The X server will
gracefully terminate after a timeout if only
terminatable connections remain.

[1]: https://gitlab.freedesktop.org/xorg/lib/libxfixes/-/merge_requests/1
2022-02-18 12:30:53 +01:00
Barnabás Pőcze
c9612225e1 pipewire: module-x11-bell: handle X11 errors
Unfortunately, libX11 has global error and I/O error handlers,
which make it inconvenient to use them from library code.

Since libX11 1.7.0, there is a per-display "exit_handler" which
is called from `_XIOError()`, however, the global I/O error
handler is still called before that, and that - by default -
calls `exit(1)` in `_XDefaultIOError()` after printing the error
to stderr.

To avoid exiting, custom handlers will be registered when
libpipewire-module-x11-bell.so is loaded given that at
that moment the default handlers are installed.

When the shared object is unloaded, the handlers will
be reset to the default ones given that the currently
registered handlers are the ones that were registered
when the module was loaded.

The logic only works correctly if there are no concurrent
calls to `XSet{IO}ErrorHandler()` while `{set,restore}_x11_handlers()`
is running. Since module-x11-bell is probably mostly going to
be loaded in `pipewire-pulse`, this seems like a reasonable
assumption to make.
2022-02-18 12:30:53 +01:00
Barnabás Pőcze
7c70c4e383 pipewire: module-x11-bell: remove unnecessary member
`xkb_event_base` is only ever set and never read. Remove it.
2022-02-18 12:30:53 +01:00
Barnabás Pőcze
afda4c81e7 pipewire: module-x11-bell: simplify x11_connect()
Since no cleanup needs to be in `x11_cleanup()`, the
`error` label may be removed and the error codes
can be returned directly.
2022-02-18 12:30:53 +01:00
Barnabás Pőcze
d558e87b51 pipewire: module-x11-bell: remove a function
`x11_close()` is no longer needed since X11 errors
are now considered fatal, so `module_destroy()` will
be called if `x11_connect()` fails, which means that
the code from `x11_close()` can be moved there.
2022-02-18 12:30:53 +01:00
Barnabás Pőcze
ffabf78cb7 pipewire: module-x11-bell: check source creation 2022-02-18 12:30:53 +01:00
Barnabás Pőcze
84cc3d7dc6 pipewire: module-x11-bell: make X11 errors fatal 2022-02-18 12:30:53 +01:00
Barnabás Pőcze
7f70d484c2 pipewire: module-x11-bell: only use the thread loop to play the sample
Register the X11 file descriptor in the main loop,
and use `pw_loop_invoke()` to offload the libcanberra
calls to the thread loop.
2022-02-18 12:30:50 +01:00
Barnabás Pőcze
0ed27e570f pipewire: module-x11-bell: only remove hook if registered
Only remove the module listener if it has actually
been added to the module's listener list.
2022-02-18 12:22:10 +01:00
Wim Taymans
5c894c2283 modules: handle x11 sample fallback better 2022-01-21 16:47:42 +01:00
Wim Taymans
0cd0ef5912 modules: add x11-bell module
It listens for X11 bell events and plays a sample with libcanberra.

Fixes #1668
2022-01-21 16:30:02 +01:00