diff -r d41b1ffc5f77 -r 958bae372271 ui/gtk/text.c --- a/ui/gtk/text.c Sun Nov 10 15:27:44 2024 +0100 +++ b/ui/gtk/text.c Tue Nov 12 14:58:03 2024 +0100 @@ -78,9 +78,12 @@ NULL); UiTextArea *uitext = malloc(sizeof(UiTextArea)); + uitext->obj = obj; uitext->ctx = obj->ctx; uitext->var = var; uitext->last_selection_state = 0; + uitext->onchange = args.onchange; + uitext->onchangedata = args.onchangedata; g_signal_connect( text_area, @@ -266,13 +269,19 @@ void ui_textbuf_changed(GtkTextBuffer *textbuffer, UiTextArea *textarea) { UiText *value = textarea->var->value; + + UiEvent e; + e.obj = textarea->obj; + e.window = e.obj->window; + e.document = textarea->ctx->document; + e.eventdata = value; + e.intval = 0; + + if(textarea->onchange) { + textarea->onchange(&e, textarea->onchangedata); + } + if(value->observers) { - UiEvent e; - e.obj = textarea->ctx->obj; - e.window = e.obj->window; - e.document = textarea->ctx->document; - e.eventdata = value; - e.intval = 0; ui_notify_evt(value->observers, &e); } }