First focusable widget now focused on window initial paint.

This commit is contained in:
Scott Duensing 2026-03-18 00:36:15 -05:00
parent bf71916462
commit 69865a54f6

View file

@ -614,6 +614,16 @@ void widgetOnPaint(WindowT *win, RectT *dirtyArea) {
widgetLayoutChildren(root, &ctx->font);
}
// Auto-focus first focusable widget if nothing has focus yet
if (!sFocusedWidget) {
WidgetT *first = widgetFindNextFocusable(root, NULL);
if (first) {
first->focused = true;
sFocusedWidget = first;
}
}
// Paint widget tree (clip rect limits drawing to visible area)
wgtPaint(root, &cd, &ctx->blitOps, &ctx->font, &ctx->colors);