Skip to content

Commit 2f2ee87

Browse files
committed
Fix widgets not updating with parent's widget
Implement the twin_widget_children_paint function to repaint all the box's widgets. The issue arises when the spline updates the pixmap beneath the button widget, the pixmap of the button isn't triggered to repaint. To solve this, we call the twin_widget_paint function after the spline update to ensure the related widget will be repainted. Signed-off-by: Wei-Hsin Yeh <weihsinyeh168@gmail.com>
1 parent 053a651 commit 2f2ee87

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

apps/spline.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ static twin_dispatch_result_t _apps_spline_update_pos(apps_spline_t *spline,
129129
spline->points[spline->which].y = twin_sfixed_to_fixed(
130130
_twin_matrix_y(&(spline->inverse_transition), x, y));
131131
_twin_widget_queue_paint(&spline->widget);
132+
twin_widget_children_paint((spline->widget).parent);
132133
return TwinDispatchDone;
133134
}
134135

include/twin.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,9 @@ twin_angle_t twin_acos(twin_fixed_t x);
11241124
* widget.c
11251125
*/
11261126

1127+
/* Paint the widget children of the box. */
1128+
void twin_widget_children_paint(twin_box_t *box);
1129+
11271130
twin_widget_t *twin_widget_create(twin_box_t *parent,
11281131
twin_argb32_t background,
11291132
twin_coord_t width,

src/widget.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,13 @@ void _twin_widget_bevel(twin_widget_t *widget, twin_fixed_t b, bool down)
200200
}
201201
}
202202

203+
void twin_widget_children_paint(twin_box_t *box)
204+
{
205+
/* Paint the widget children of the box. */
206+
for (twin_widget_t *child = box->children; child; child = child->next)
207+
_twin_widget_queue_paint(child);
208+
}
209+
203210
twin_widget_t *twin_widget_create(twin_box_t *parent,
204211
twin_argb32_t background,
205212
twin_coord_t width,

0 commit comments

Comments
 (0)