[ui] Reset active widget when UI context is hidden

WIdgets can't possibly be active when the entire UI is hidden, and
resetting the active widget when hiding the UI helps when the state gets
broken due to widget id conflicts.
This commit is contained in:
Bill Currie 2023-07-11 00:30:19 +09:00
parent 24b5066760
commit d8b59656aa

View file

@ -265,6 +265,9 @@ IMUI_DestroyContext (imui_ctx_t *ctx)
void
IMUI_SetVisible (imui_ctx_t *ctx, bool visible)
{
if (!visible) {
ctx->active = nullent;
}
*Canvas_Visible (ctx->csys, ctx->canvas) = visible;
for (uint32_t i = 0; i < ctx->windows.size; i++) {
*Canvas_Visible (ctx->csys, ctx->windows.a[i]->entity) = visible;