diff --git a/src/backend/wayland.c b/src/backend/wayland.c index d1130e6..7e4d890 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -648,11 +648,12 @@ static void setup_subsurface(MwLL parent, MwLL r, int x, int y) { // arrpush(parent->wayland.subsurfaces, r); - r->wayland.configured = MwTRUE; - if(!r->wayland.egl_setup) { - r->wayland.egl_setup = egl_setup(r, r->wayland.ww, r->wayland.wh); - MwLLForceRender(r); - }; + r->wayland.configured = MwTRUE; + r->wayland.egl_context = topmost_parent->wayland.egl_context; + r->wayland.egl_display = topmost_parent->wayland.egl_display; + r->wayland.egl_surface = topmost_parent->wayland.egl_surface; + r->wayland.fbo = topmost_parent->wayland.fbo; + r->wayland.fbo_texture = topmost_parent->wayland.fbo_texture; arrpush(parent->wayland.subwidgets, r); } @@ -821,16 +822,15 @@ static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) { } static void MwLLBeginDrawImpl(MwLL handle) { - if(handle->wayland.parent == NULL) - if(!eglMakeCurrent(handle->wayland.egl_display, handle->wayland.egl_surface, handle->wayland.egl_surface, handle->wayland.egl_context)) { - printf("ERROR: eglMakeCurrent, %0X\n", eglGetError()); - return; - } } static void MwLLEndDrawImpl(MwLL handle) { int w, h; + if(handle->wayland.parent != NULL) { + return; + } + if(handle->wayland.type == MWLL_WAYLAND_TOPLEVEL) { w = handle->wayland.ww; h = handle->wayland.wh; @@ -862,12 +862,11 @@ static void MwLLEndDrawImpl(MwLL handle) { wl_surface_damage(handle->wayland.surface, 0, 0, handle->wayland.ww, handle->wayland.wh); - if(handle->wayland.parent == NULL) - if(!eglSwapBuffers(handle->wayland.egl_display, handle->wayland.egl_surface)) { - printf("error swapping buffers! %0X\n", eglGetError()); - } else { - wl_surface_commit(handle->wayland.surface); - } + if(!eglSwapBuffers(handle->wayland.egl_display, handle->wayland.egl_surface)) { + printf("error swapping buffers! %0X\n", eglGetError()); + } else { + wl_surface_commit(handle->wayland.surface); + } } static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {