From 81b229c99a7f462afb0af0203e1cdc090b58b3cc Mon Sep 17 00:00:00 2001 From: IoIxD Date: Sun, 19 Apr 2026 20:53:47 -0700 Subject: [PATCH] Recursive_render on SetWH --- examples/gldemos/tripaint.c | 14 ++++++-------- src/backend/wayland.c | 14 +++++++++----- src/widget/opengl.c | 2 ++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/examples/gldemos/tripaint.c b/examples/gldemos/tripaint.c index 1208b26..2e53d9b 100644 --- a/examples/gldemos/tripaint.c +++ b/examples/gldemos/tripaint.c @@ -108,14 +108,13 @@ static void mouse_move(MwWidget handle, void* user, void* call) { int main() { MwSizeHints hints; - MwWidget window, viewport; + MwWidget window; MwLibraryInit(); - window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480, - MwNtitle, "tripaint", - NULL); - viewport = MwCreateWidget(MwViewportClass, "viewport", window, 5, 5, 630, 470 - 16 - 5); + window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480, + MwNtitle, "tripaint", + NULL); hints.min_width = hints.max_width = 640; hints.min_height = hints.max_height = 480; @@ -125,13 +124,12 @@ int main() { MwNtext, "Press left click to draw triangle, right click to undo", NULL); - MwViewportSetSize(viewport, 1024, 768); - t = malloc(sizeof(*t)); - opengl = MwCreateWidget(MwOpenGLClass, "opengl", MwViewportGetViewport(viewport), 0, 0, 1024, 768); + opengl = MwCreateWidget(MwOpenGLClass, "opengl", window, 0, 0, 640, 460); MwAddUserHandler(window, MwNtickHandler, tick, NULL); + MwAddUserHandler(opengl, MwNtickHandler, tick, NULL); MwAddUserHandler(opengl, MwNmouseDownHandler, mouse, NULL); MwAddUserHandler(opengl, MwNmouseMoveHandler, mouse_move, NULL); diff --git a/src/backend/wayland.c b/src/backend/wayland.c index 99a6280..09130d7 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -1720,6 +1720,7 @@ static void clip(MwLL handle) { int w, h, x, y, cx, cy; MwLL toplevel = handle->wayland.parent; MwLL* ws = NULL; + return; arrput(ws, handle); while(toplevel) { @@ -1868,7 +1869,7 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { } #endif - if(parent != NULL){ + if(parent != NULL) { arrput(parent->wayland.children, r); } @@ -1949,9 +1950,9 @@ static void MwLLDestroyImpl(MwLL handle) { wl_flush(handle); - if(handle->wayland.parent != NULL){ - for(i = 0; i < arrlen(handle->wayland.parent->wayland.children); i++){ - if(handle->wayland.parent->wayland.children[i] == handle){ + if(handle->wayland.parent != NULL) { + for(i = 0; i < arrlen(handle->wayland.parent->wayland.children); i++) { + if(handle->wayland.parent->wayland.children[i] == handle) { arrdel(handle->wayland.parent->wayland.children, i); break; } @@ -1974,7 +1975,7 @@ static void MwLLGetXYWHImpl(MwLL handle, int* x, int* y, unsigned int* w, unsign *h = handle->wayland.wh; } -static void recursive_render(MwLL handle){ +static void recursive_render(MwLL handle) { int i; for(i = 0; i < arrlen(handle->wayland.children); i++) recursive_render(handle->wayland.children[i]); @@ -2030,6 +2031,9 @@ static void MwLLSetWHImpl(MwLL handle, int w, int h) { framebuffer_setup(&handle->wayland); backbuffer_destroy(&handle->wayland); backbuffer_setup(&handle->wayland); + + recursive_render(handle); + MwLLDispatch(handle, draw, NULL); handle->wayland.events_pending = 1; } diff --git a/src/widget/opengl.c b/src/widget/opengl.c index 252d7ad..b936920 100644 --- a/src/widget/opengl.c +++ b/src/widget/opengl.c @@ -431,6 +431,8 @@ static void mwOpenGLMakeCurrentImpl(MwWidget handle) { o->egl_context)) { printf("ERROR: eglMakeCurrent, %0X\n", eglGetError()); } + + MwLLForceRender(handle->lowlevel); } #endif }