WINGs/wview_wl: redisplay toplevel when non-toplevel view is mapped

Non-toplevel views mapped after the toplevel (e.g., icon buttons added
during Init* calls) need to trigger a redisplay to become visible.
Instead of redisplaying the view itself (which crashed during
realization), find the toplevel ancestor and redisplay from there.

Guards:
- All ancestors must be realized (prevents crash during W_RealizeView)
- Toplevel must be mapped (prevents premature redisplay)
- wl_redisplay_depth==0 (prevents re-entrancy)
This commit is contained in:
Window Maker 2026-05-24 17:02:13 +02:00
parent 9873adf689
commit 85216efeea
1 changed files with 16 additions and 1 deletions

View File

@ -267,8 +267,23 @@ static void wl_map(void *vctx, W_View *view)
{
(void)vctx;
view->flags.mapped = 1;
if (view->flags.realized && view->flags.topLevel) {
if (!view->flags.realized)
return;
if (view->flags.topLevel) {
wl_redisplay(vctx, view);
return;
}
/* Non-toplevel: find the toplevel and redisplay from there,
* but only if all ancestors are realized (not mid-realization). */
W_View *top = view->parent;
while (top && !top->flags.topLevel) {
if (!top->flags.realized)
return;
top = top->parent;
}
if (top && top->flags.realized && top->flags.mapped
&& wl_redisplay_depth == 0) {
wl_redisplay(vctx, top);
}
}