render/egl: replace init/finish with create/destroy

This ensures wlr_gles2_renderer can properly take ownership of the
wlr_egl.

Closes: https://github.com/swaywm/wlroots/issues/2612
This commit is contained in:
Simon Ser 2021-01-09 12:00:31 +01:00
parent 50b120927d
commit 1d461687d2
12 changed files with 62 additions and 68 deletions

View file

@ -33,12 +33,12 @@ static struct zwp_keyboard_shortcuts_inhibitor_v1 *
keyboard_shortcuts_inhibitor = NULL;
static bool active = false;
struct wlr_egl egl;
struct wlr_egl *egl;
struct wl_egl_window *egl_window;
struct wlr_egl_surface *egl_surface;
static void draw(void) {
eglMakeCurrent(egl.display, egl_surface, egl_surface, egl.context);
eglMakeCurrent(egl->display, egl_surface, egl_surface, egl->context);
float color[] = {1.0, 1.0, 0.0, 1.0};
if (keyboard_shortcuts_inhibitor) {
@ -49,7 +49,7 @@ static void draw(void) {
glClearColor(color[0], color[1], color[2], 1.0);
glClear(GL_COLOR_BUFFER_BIT);
eglSwapBuffers(egl.display, egl_surface);
eglSwapBuffers(egl->display, egl_surface);
}
static void keyboard_shortcuts_inhibit_handle_active(void *data,
@ -225,7 +225,7 @@ int main(int argc, char **argv) {
}
EGLint attribs[] = { EGL_NONE };
wlr_egl_init(&egl, EGL_PLATFORM_WAYLAND_EXT, display, attribs);
egl = wlr_egl_create(EGL_PLATFORM_WAYLAND_EXT, display, attribs);
struct wl_surface *surface = wl_compositor_create_surface(compositor);
struct xdg_surface *xdg_surface =
@ -241,7 +241,7 @@ int main(int argc, char **argv) {
wl_surface_commit(surface);
egl_window = wl_egl_window_create(surface, width, height);
egl_surface = wlr_egl_create_surface(&egl, egl_window);
egl_surface = wlr_egl_create_surface(egl, egl_window);
wl_display_roundtrip(display);