From b4dbf15817f6d6fb1e91828bdab5841c10126ac8 Mon Sep 17 00:00:00 2001 From: Window Maker Date: Sun, 24 May 2026 17:15:36 +0200 Subject: [PATCH] WINGs: dispatch WME_CONFIGURE synchronously before redisplay on resize The configure event was enqueued for later processing but the redisplay happened immediately, painting children at their old positions. Now WMHandleEvent is called directly with the configure event so widget delegates relayout children before the redisplay paints them. Also removed scroller debug logging. --- WINGs/wclient_wl.c | 8 ++++---- WINGs/wview_wl.c | 6 ------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/WINGs/wclient_wl.c b/WINGs/wclient_wl.c index 4cc34e4..96aebb9 100644 --- a/WINGs/wclient_wl.c +++ b/WINGs/wclient_wl.c @@ -300,13 +300,12 @@ xdg_surface_handle_configure(void *data, struct xdg_surface *xs, uint32_t serial if (nb) { wlclient_destroy_shm_buffer(top->buf); top->buf = nb; - /* Tell WINGs the backing pointer changed so subsequent - * draws hit the new buffer. */ W_SetViewBacking(top->view->window, nb->image); top->view->size.width = top->pending_w; top->view->size.height = top->pending_h; - /* Notify WINGs of the resize so widget delegates relayout */ + /* Dispatch configure event synchronously so widget delegates + * relayout children before we repaint. */ WMEvent cev; memset(&cev, 0, sizeof(cev)); cev.type = WME_CONFIGURE; @@ -315,7 +314,8 @@ xdg_surface_handle_configure(void *data, struct xdg_surface *xs, uint32_t serial cev.u.configure.event = top->view->window; cev.u.configure.width = top->pending_w; cev.u.configure.height = top->pending_h; - W_WL_EnqueueEvent(top->ctx->scr, &cev, top->view); + cev._view_target = top->view; + WMHandleEvent(&cev); /* Repaint all content into the new buffer */ if (top->view->flags.mapped) { diff --git a/WINGs/wview_wl.c b/WINGs/wview_wl.c index 9d887b9..2bf7984 100644 --- a/WINGs/wview_wl.c +++ b/WINGs/wview_wl.c @@ -447,12 +447,6 @@ static void wl_redisplay(void *vctx, W_View *view) W_View *next = child->nextSister; if (child->flags.mapped && child->flags.realized && !child->flags.alreadyDead) { wl_redisplay(vctx, child); - } else if (child->flags.realized && !child->flags.mapped) { - /* Debug: find unmapped children that should be mapped */ - if (view->size.width >= 400 && view->size.height > 50 && view->size.height < 100) - wwarning("wl_redisplay: UNMAPPED child %p in view %p (%dx%d) child_size=%dx%d pos=%d,%d", - (void*)child, (void*)view, view->size.width, view->size.height, - child->size.width, child->size.height, child->pos.x, child->pos.y); } child = next; }