From 1e5ff44d792125cecf8eb17f6771a82d495f5ff6 Mon Sep 17 00:00:00 2001 From: IoIxD Date: Sun, 7 Dec 2025 19:33:16 -0700 Subject: [PATCH] swap buffers on all children --- .clangd | 1 + src/backend/wayland.c | 20 +++++++++++--------- src/core.c | 6 ++---- 3 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 .clangd diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..7abd528 --- /dev/null +++ b/.clangd @@ -0,0 +1 @@ +header-insertion: never diff --git a/src/backend/wayland.c b/src/backend/wayland.c index d30a5d4..d1130e6 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -821,10 +821,11 @@ static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) { } static void MwLLBeginDrawImpl(MwLL handle) { - 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; - } + 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) { @@ -861,11 +862,12 @@ static void MwLLEndDrawImpl(MwLL handle) { wl_surface_damage(handle->wayland.surface, 0, 0, handle->wayland.ww, handle->wayland.wh); - 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(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); + } } static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) { diff --git a/src/core.c b/src/core.c index 6f2f041..792dd30 100644 --- a/src/core.c +++ b/src/core.c @@ -7,16 +7,14 @@ static void lldrawhandler(MwLL handle, void* data) { MwWidget h = (MwWidget)handle->common.user; (void)data; - if(handle->wayland.parent == NULL) - MwLLBeginDraw(handle); + MwLLBeginDraw(handle); h->bgcolor = NULL; MwDispatch(h, draw); if(h->draw_inject != NULL) h->draw_inject(h); MwDispatchUserHandler(h, MwNdrawHandler, NULL); - if(handle->wayland.parent == NULL) - MwLLEndDraw(handle); + MwLLEndDraw(handle); } static void lluphandler(MwLL handle, void* data) {