backend: gl: implement root_change interface for glx & egl

Co-authored-by: Monsterovich <Monsterovich@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-02-20 17:30:19 +00:00
parent 9ac5166622
commit fef7ff8815
4 changed files with 9 additions and 0 deletions

View File

@ -366,6 +366,7 @@ static void egl_diagnostics(backend_t *base) {
struct backend_operations egl_ops = {
.init = egl_init,
.deinit = egl_deinit,
.root_change = gl_root_change,
.bind_pixmap = egl_bind_pixmap,
.release_image = gl_release_image,
.prepare = gl_prepare,

View File

@ -621,6 +621,11 @@ static bool gl_win_shader_from_stringv(const char **vshader_strv,
return true;
}
void gl_root_change(backend_t *base, session_t *ps) {
auto gd = (struct gl_data *)base;
gl_resize(gd, ps->root_width, ps->root_height);
}
/**
* Callback to run on root window size change.
*/

View File

@ -153,6 +153,8 @@ bool gl_last_render_time(backend_t *backend_data, struct timespec *time);
void gl_compose(backend_t *, image_handle image, coord_t image_dst, image_handle mask,
coord_t mask_dst, const region_t *reg_tgt, const region_t *reg_visible);
void gl_root_change(backend_t *base, session_t *);
void gl_resize(struct gl_data *, int width, int height);
bool gl_init(struct gl_data *gd, session_t *);

View File

@ -547,6 +547,7 @@ static void glx_diagnostics(backend_t *base) {
struct backend_operations glx_ops = {
.init = glx_init,
.deinit = glx_deinit,
.root_change = gl_root_change,
.bind_pixmap = glx_bind_pixmap,
.release_image = gl_release_image,
.prepare = gl_prepare,