Skip to content

Commit 60132b4

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 60132b4

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,8 @@ twin_angle_t twin_acos(twin_fixed_t x);
11241124
* widget.c
11251125
*/
11261126

1127+
void twin_widget_children_paint(twin_box_t *box);
1128+
11271129
twin_widget_t *twin_widget_create(twin_box_t *parent,
11281130
twin_argb32_t background,
11291131
twin_coord_t width,

src/widget.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,14 @@ 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+
/* Update the widget children of the box. */
206+
twin_widget_t *child;
207+
for (child = box->children; child; child = child->next)
208+
_twin_widget_queue_paint(child);
209+
}
210+
203211
twin_widget_t *twin_widget_create(twin_box_t *parent,
204212
twin_argb32_t background,
205213
twin_coord_t width,

0 commit comments

Comments
 (0)