diff -r e79a60b3a7cb -r 7c3ff86ee9d4 ui/motif/button.c --- a/ui/motif/button.c Sun Apr 16 10:20:21 2023 +0200 +++ b/ui/motif/button.c Tue May 23 11:11:28 2023 +0200 @@ -32,7 +32,11 @@ #include "button.h" #include "container.h" #include "../common/context.h" -#include +#include + +#include +#include +#include UIWIDGET ui_button(UiObject *obj, char *label, ui_callback f, void *data) { @@ -50,8 +54,8 @@ ct->add(ct, button); if(f) { - UiEventData *event = ucx_mempool_malloc( - obj->ctx->mempool, + UiEventData *event = cxMalloc( + obj->ctx->allocator, sizeof(UiEventData)); event->obj = obj; event->userdata = data; @@ -143,11 +147,15 @@ RadioButtonGroup *group; if(rgroup->obj) { group = rgroup->obj; - group->buttons = ucx_list_append(group->buttons, button); + if(!group->buttons) { + group->buttons = cxArrayListCreate(cxDefaultAllocator, cx_cmp_uintptr, CX_STORE_POINTERS, 8); + } + cxListAdd(group->buttons, button); group->ref++; } else { group = malloc(sizeof(RadioButtonGroup)); - group->buttons = ucx_list_append(NULL, button); + group->buttons = cxArrayListCreate(cxDefaultAllocator, cx_cmp_uintptr, CX_STORE_POINTERS, 8); + cxListAdd(group->buttons, button); group->current = button; // this is the first button in the radiobutton group // so we should enable it @@ -181,7 +189,7 @@ int64_t ui_radiobutton_get(UiInteger *value) { RadioButtonGroup *group = value->obj; - int i = ucx_list_find(group->buttons, group->current, NULL, NULL); + int i = cxListFind(group->buttons, group->current); if (i >= 0) { value->value = i; return i; @@ -197,9 +205,8 @@ XtSetArg(arg, XmNset, FALSE); XtSetValues(group->current, &arg, 1); - UcxList *elm = ucx_list_get(group->buttons, i); - if(elm) { - Widget button = elm->data; + Widget button = cxListAt(group->buttons, i); + if(button) { XtSetArg(arg, XmNset, TRUE); XtSetValues(button, &arg, 1); group->current = button;