1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2025-10-30 23:46:46 -04:00

api: introduce the concept of backend specific plugins

Allow loaded plugins to hook into specific backends.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-05-23 16:00:10 +01:00
parent 21fe5983e0
commit bbde4bb1ab
No known key found for this signature in database
GPG key ID: D3A4405BE6CC17F4
4 changed files with 91 additions and 4 deletions

View file

@ -3,12 +3,31 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#define PICOM_API_MAJOR (0UL)
#define PICOM_API_MINOR (1UL)
struct picom_api {};
struct backend_base;
/// The entry point of a backend plugin. Called after the backend is initialized.
typedef void (*picom_backend_plugin_entrypoint)(struct backend_base *backend, void *user_data);
struct picom_api {
/// Add a plugin for a specific backend. The plugin's entry point will be called
/// when the specified backend is initialized.
///
/// @param backend_name The name of the backend to add the plugin to.
/// @param major The major version of the backend API interface this plugin
/// is compatible with.
/// @param minor The minor version of the backend API interface this plugin
/// is compatible with.
/// @param entrypoint The entry point of the plugin.
/// @param user_data The user data to pass to the plugin's entry point.
bool (*add_backend_plugin)(const char *backend_name, uint64_t major, uint64_t minor,
picom_backend_plugin_entrypoint entrypoint,
void *user_data);
};
const struct picom_api *
picom_api_get_interfaces(uint64_t major, uint64_t minor, const char *context);