Skip to content

Fix widgets not updating with parent's widget #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/spline.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ static twin_dispatch_result_t _apps_spline_update_pos(apps_spline_t *spline,
spline->points[spline->which].y = twin_sfixed_to_fixed(
_twin_matrix_y(&(spline->inverse_transition), x, y));
_twin_widget_queue_paint(&spline->widget);
twin_widget_children_paint((spline->widget).parent);
return TwinDispatchDone;
}

Expand Down
3 changes: 3 additions & 0 deletions include/twin.h
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,9 @@ twin_angle_t twin_acos(twin_fixed_t x);
* widget.c
*/

/* Paint the widget children of the box. */
void twin_widget_children_paint(twin_box_t *box);

twin_widget_t *twin_widget_create(twin_box_t *parent,
twin_argb32_t background,
twin_coord_t width,
Expand Down
1 change: 1 addition & 0 deletions src/box.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ twin_dispatch_result_t _twin_box_dispatch(twin_widget_t *widget,
case TwinEventConfigure:
return _twin_box_configure(box);
case TwinEventButtonDown:
twin_window_show(widget->window);
box->button_down =
_twin_box_xy_to_widget(box, event->u.pointer.x, event->u.pointer.y);
if (box->button_down && box->button_down->want_focus)
Expand Down
7 changes: 7 additions & 0 deletions src/widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ void _twin_widget_bevel(twin_widget_t *widget, twin_fixed_t b, bool down)
}
}

void twin_widget_children_paint(twin_box_t *box)
{
/* Paint the widget children of the box. */
for (twin_widget_t *child = box->children; child; child = child->next)
_twin_widget_queue_paint(child);
}

twin_widget_t *twin_widget_create(twin_box_t *parent,
twin_argb32_t background,
twin_coord_t width,
Expand Down