mirror of
https://github.com/yshui/picom.git
synced 2025-10-30 23:46:46 -04:00
backend: embed backend_operations table in backend_base
The idea is to allow backend plugins to override backend functions by modifying this table. Right now, when they do this they are actually changing a global variable and their change will persist after backend resets (!). Store the table inside backend_base solves this problem. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
9c4f62cd24
commit
bd26302f07
13 changed files with 124 additions and 130 deletions
|
|
@ -36,15 +36,7 @@ struct managed_win;
|
|||
struct ev_loop;
|
||||
struct backend_operations;
|
||||
|
||||
typedef struct backend_base {
|
||||
struct backend_operations *ops;
|
||||
struct x_connection *c;
|
||||
struct ev_loop *loop;
|
||||
|
||||
/// Whether the backend can accept new render request at the moment
|
||||
bool busy;
|
||||
// ...
|
||||
} backend_t;
|
||||
typedef struct backend_base backend_t;
|
||||
|
||||
// This mimics OpenGL's ARB_robustness extension, which enables detection of GPU context
|
||||
// resets.
|
||||
|
|
@ -475,6 +467,16 @@ struct backend_operations {
|
|||
enum device_status (*device_status)(backend_t *backend_data);
|
||||
};
|
||||
|
||||
struct backend_base {
|
||||
struct backend_operations ops;
|
||||
struct x_connection *c;
|
||||
struct ev_loop *loop;
|
||||
|
||||
/// Whether the backend can accept new render request at the moment
|
||||
bool busy;
|
||||
// ...
|
||||
};
|
||||
|
||||
/// Register a new backend, `major` and `minor` should be the version of the picom backend
|
||||
/// interface. You should just pass `PICOM_BACKEND_MAJOR` and `PICOM_BACKEND_MINOR` here.
|
||||
/// `name` is the name of the backend, `init` is the function to initialize the backend,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue