load custom plugins by pointer
This adds function libdecor_decorate_custom
to enable loading custom plugins by function pointers to plugin constructors. These constructors must have the type libdecor_plugin_constructor
, i.e. libdecor_plugin * ()(struct libdecor *)
.
As discussed in https://gitlab.gnome.org/jadahl/libdecoration/-/issues/7 and https://gitlab.gnome.org/jadahl/libdecoration/-/merge_requests/11#note_796686 this enables the most generic way to load custom plugins. These plugins can be part of the same source as the client, as demonstrated with the demo example if macro CUSTOM_PLUGIN
is set.
Additionally to this, the MR also adds the static libdecoration library. Together with the loading via a function pointer, this enables to link the library and a plugin statically and thus simplifies the distribution of an application if exchanging plugins at runtime is not required.
The meson build script now creates two versions of the demo application:
- dynamic: loading the libdecoration library and cairo plugin dynamically at runtime
- static: linking the static libdecoration library and compiling a simple plugin into the executable
The "simple" plugin that is compiled into the static demo application is in fact the "old" cairo plugin before the title bar and buttons were added.
I initially tried to statically link the "new" cairo plugin, but this would require renaming most of the demo symbols as those would clash with the same symbol names in the cairo plugin.