fix client build default tip

Thu, 25 Dec 2025 10:40:35 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 25 Dec 2025 10:40:35 +0100
changeset 1024
d218b70e1499
parent 1023
d9b6b85cc210

fix client build

client/args.c file | annotate | diff | comparison | revisions
client/uiclient.c file | annotate | diff | comparison | revisions
--- a/client/args.c	Wed Dec 24 08:48:50 2025 +0100
+++ b/client/args.c	Thu Dec 25 10:40:35 2025 +0100
@@ -60,80 +60,80 @@
     
     // boolean args
     val = cxJsonObjGet(value, "fill");
-    if(val && val->type == CX_JSON_LITERAL && val->value.literal == CX_JSON_TRUE) {
+    if(val && val->type == CX_JSON_LITERAL && val->literal == CX_JSON_TRUE) {
         funcs->fill(args, TRUE);
     }
     
     val = cxJsonObjGet(value, "hexpand");
-    if(val && val->type == CX_JSON_LITERAL && val->value.literal == CX_JSON_TRUE) {
+    if(val && val->type == CX_JSON_LITERAL && val->literal == CX_JSON_TRUE) {
         funcs->hexpand(args, TRUE);
     }
     
     val = cxJsonObjGet(value, "vexpand");
-    if(val && val->type == CX_JSON_LITERAL && val->value.literal == CX_JSON_TRUE) {
+    if(val && val->type == CX_JSON_LITERAL && val->literal == CX_JSON_TRUE) {
         funcs->vexpand(args, TRUE);
     }
     
     val = cxJsonObjGet(value, "hfill");
-    if(val && val->type == CX_JSON_LITERAL && val->value.literal == CX_JSON_TRUE) {
+    if(val && val->type == CX_JSON_LITERAL && val->literal == CX_JSON_TRUE) {
         funcs->hfill(args, TRUE);
     }
     
     val = cxJsonObjGet(value, "vfill");
-    if(val && val->type == CX_JSON_LITERAL && val->value.literal == CX_JSON_TRUE) {
+    if(val && val->type == CX_JSON_LITERAL && val->literal == CX_JSON_TRUE) {
         funcs->vfill(args, TRUE);
     }
     
     val = cxJsonObjGet(value, "override_defaults");
-    if(val && val->type == CX_JSON_LITERAL && val->value.literal == CX_JSON_TRUE) {
+    if(val && val->type == CX_JSON_LITERAL && val->literal == CX_JSON_TRUE) {
         funcs->override_defaults(args, TRUE);
     }
     
     // int args
     val = cxJsonObjGet(value, "margin");
     if(val && val->type == CX_JSON_INTEGER) {
-        funcs->margin(args, (int)val->value.integer);
+        funcs->margin(args, (int)val->integer);
     }
     
     val = cxJsonObjGet(value, "margin_left");
     if(val && val->type == CX_JSON_INTEGER) {
-        funcs->margin_left(args, (int)val->value.integer);
+        funcs->margin_left(args, (int)val->integer);
     }
     
     val = cxJsonObjGet(value, "margin_right");
     if(val && val->type == CX_JSON_INTEGER) {
-        funcs->margin_right(args, (int)val->value.integer);
+        funcs->margin_right(args, (int)val->integer);
     }
     
     val = cxJsonObjGet(value, "margin_top");
     if(val && val->type == CX_JSON_INTEGER) {
-        funcs->margin_top(args, (int)val->value.integer);
+        funcs->margin_top(args, (int)val->integer);
     }
     
     val = cxJsonObjGet(value, "margin_bottom");
     if(val && val->type == CX_JSON_INTEGER) {
-        funcs->margin_bottom(args, (int)val->value.integer);
+        funcs->margin_bottom(args, (int)val->integer);
     }
     
     val = cxJsonObjGet(value, "colspan");
     if(val && val->type == CX_JSON_INTEGER) {
-        funcs->colspan(args, (int)val->value.integer);
+        funcs->colspan(args, (int)val->integer);
     }
     
     val = cxJsonObjGet(value, "rowspan");
     if(val && val->type == CX_JSON_INTEGER) {
-        funcs->rowspan(args, (int)val->value.integer);
+        funcs->rowspan(args, (int)val->integer);
     }
     
     // string args
     val = cxJsonObjGet(value, "name");
     if(val && val->type == CX_JSON_STRING) {
-        funcs->name(args, val->value.string.ptr);
+        funcs->name(args, val->string.ptr);
     }
     
     val = cxJsonObjGet(value, "style_class");
     if(val && val->type == CX_JSON_STRING) {
-        funcs->name(args, val->value.string.ptr);
+        funcs->name(args, val->string.ptr);
     }
 }
 
@@ -143,12 +143,12 @@
         return;
     }
     
-    int len = (int)val->value.array.array_size;
+    int len = (int)val->array.size;
     int *states = calloc(len, sizeof(int));
     for(int i=0;i<len;i++) {
-        CxJsonValue *s = val->value.array.array[i];
+        CxJsonValue *s = val->array.data[i];
         if(s->type == CX_JSON_INTEGER) {
-            states[i] = (int)s->value.integer;
+            states[i] = (int)s->integer;
         }
     }
     
@@ -165,36 +165,36 @@
     
     CxJsonValue *val = cxJsonObjGet(value, "spacing");
     if(val && val->type == CX_JSON_INTEGER) {
-        args->spacing = (int)val->value.integer;
+        args->spacing = (int)val->integer;
     }
     
     val = cxJsonObjGet(value, "columnspacing");
     if(val && val->type == CX_JSON_INTEGER) {
-        args->columnspacing = (int)val->value.integer;
+        args->columnspacing = (int)val->integer;
     }
     
     val = cxJsonObjGet(value, "rowspacing");
     if(val && val->type == CX_JSON_INTEGER) {
-        args->rowspacing = (int)val->value.integer;
+        args->rowspacing = (int)val->integer;
     }
     
     val = cxJsonObjGet(value, "def_hfill");
-    if(val && val->type == CX_JSON_LITERAL && val->value.literal == CX_JSON_TRUE) {
+    if(val && val->type == CX_JSON_LITERAL && val->literal == CX_JSON_TRUE) {
         args->def_hfill = TRUE;
     }
     
     val = cxJsonObjGet(value, "def_vfill");
-    if(val && val->type == CX_JSON_LITERAL && val->value.literal == CX_JSON_TRUE) {
+    if(val && val->type == CX_JSON_LITERAL && val->literal == CX_JSON_TRUE) {
         args->def_vfill = TRUE;
     }
     
     val = cxJsonObjGet(value, "def_hexpand");
-    if(val && val->type == CX_JSON_LITERAL && val->value.literal == CX_JSON_TRUE) {
+    if(val && val->type == CX_JSON_LITERAL && val->literal == CX_JSON_TRUE) {
         args->def_hexpand = TRUE;
     }
     
     val = cxJsonObjGet(value, "def_vexpand");
-    if(val && val->type == CX_JSON_LITERAL && val->value.literal == CX_JSON_TRUE) {
+    if(val && val->type == CX_JSON_LITERAL && val->literal == CX_JSON_TRUE) {
         args->def_vexpand = TRUE;
     }
     
@@ -212,22 +212,22 @@
     
     CxJsonValue *val = cxJsonObjGet(value, "label");
     if(val && val->type == CX_JSON_STRING) {
-        ui_button_args_set_label(args, val->value.string.ptr);
+        ui_button_args_set_label(args, val->string.ptr);
     }
     
     val = cxJsonObjGet(value, "icon");
     if(val && val->type == CX_JSON_STRING) {
-        ui_button_args_set_icon(args, val->value.string.ptr);
+        ui_button_args_set_icon(args, val->string.ptr);
     }
     
     val = cxJsonObjGet(value, "tooltip");
     if(val && val->type == CX_JSON_STRING) {
-        ui_button_args_set_tooltip(args, val->value.string.ptr);
+        ui_button_args_set_tooltip(args, val->string.ptr);
     }
     
     val = cxJsonObjGet(value, "labeltype");
     if(val && val->type == CX_JSON_INTEGER) {
-        ui_button_args_set_labeltype(args, (int)val->value.integer);
+        ui_button_args_set_labeltype(args, (int)val->integer);
     }
     
     return args;
@@ -244,27 +244,27 @@
     
     CxJsonValue *val = cxJsonObjGet(value, "label");
     if(val && val->type == CX_JSON_STRING) {
-        ui_toggle_args_set_label(args, val->value.string.ptr);
+        ui_toggle_args_set_label(args, val->string.ptr);
     }
     
     val = cxJsonObjGet(value, "icon");
     if(val && val->type == CX_JSON_STRING) {
-        ui_toggle_args_set_icon(args, val->value.string.ptr);
+        ui_toggle_args_set_icon(args, val->string.ptr);
     }
     
     val = cxJsonObjGet(value, "tooltip");
     if(val && val->type == CX_JSON_STRING) {
-        ui_toggle_args_set_tooltip(args, val->value.string.ptr);
+        ui_toggle_args_set_tooltip(args, val->string.ptr);
     }
     
     val = cxJsonObjGet(value, "labeltype");
     if(val && val->type == CX_JSON_INTEGER) {
-        ui_toggle_args_set_labeltype(args, (int)val->value.integer);
+        ui_toggle_args_set_labeltype(args, (int)val->integer);
     }
     
     val = cxJsonObjGet(value, "enable_group");
     if(val && val->type == CX_JSON_INTEGER) {
-        ui_toggle_args_set_enablestate(args, (int)val->value.integer);
+        ui_toggle_args_set_enablestate(args, (int)val->integer);
     }
     
     return args;
--- a/client/uiclient.c	Wed Dec 24 08:48:50 2025 +0100
+++ b/client/uiclient.c	Thu Dec 25 10:40:35 2025 +0100
@@ -45,7 +45,7 @@
 void client_init(UiMessageHandler *handler) {
     io = handler;
     
-    msg_types = cxHashMapCreateSimple(CX_STORE_POINTERS);
+    msg_types = cxHashMapCreate(NULL, CX_STORE_POINTERS, 32);
     cxMapPut(msg_types, "window", msg_window);
     cxMapPut(msg_types, "sidebar_window", msg_window);
     cxMapPut(msg_types, "splitview_window", msg_window);
@@ -59,13 +59,13 @@
     cxMapPut(msg_types, "button", msg_button);
     cxMapPut(msg_types, "toggle", msg_togglebutton);
     
-    objects = cxHashMapCreateSimple(CX_STORE_POINTERS);
+    objects = cxHashMapCreate(NULL, CX_STORE_POINTERS, 16);
 }
 
 static cxmutstr jsonobj_getstring(const CxJsonValue *obj, const char *name) {
     CxJsonValue *value = cxJsonObjGet(obj, name);
     if(value->type == CX_JSON_STRING) {
-        return value->value.string;
+        return value->string;
     } else {
         return (cxmutstr){ NULL, 0 };
     }
@@ -77,7 +77,7 @@
         if(*error) {
             *error = 0;
         }
-        return value->value.literal == CX_JSON_TRUE ? 1 : 0;
+        return value->literal == CX_JSON_TRUE ? 1 : 0;
     } else {
         if(error) {
             *error = 1;
@@ -127,19 +127,19 @@
         return 1;
     }
     
-    json_msg_handler handler = cxMapGet(msg_types, type->value.string);
+    json_msg_handler handler = cxMapGet(msg_types, type->string);
     if(!handler) {
         return 1;
     }
     
-    return handler(obj, value, type->value.string);
+    return handler(obj, value, type->string);
 }
 
 int client_handle_children(UiObject *parent, const CxJsonValue *value) {
     CxJsonValue *children = cxJsonObjGet(value, "children");
     if(children && children->type == CX_JSON_ARRAY) {
-        for(int i=0;i<children->value.array.array_size;i++) {
-            CxJsonValue *child = children->value.array.array[i];
+        for(int i=0;i<children->array.size;i++) {
+            CxJsonValue *child = children->array.data[i];
             if(client_handle_json(parent, child)) {
                 fprintf(stderr, "Error: invalid child\n");
                 return 1;
@@ -189,7 +189,7 @@
     if(!obj_id || obj_id->type != CX_JSON_STRING) {
         return NULL;
     }
-    return client_get_mapped_obj(obj_id->value.string);
+    return client_get_mapped_obj(obj_id->string);
 }
 
 int msg_window(UiObject *parent, const CxJsonValue *value, cxmutstr type) {
@@ -318,15 +318,15 @@
     CxJsonValue *val = cxJsonObjGet(value, "value");
     UiInteger *i = NULL;
     if(val && val->type == CX_JSON_STRING) {
-        i = ui_get_int_var(obj->ctx, val->value.string.ptr);
+        i = ui_get_int_var(obj->ctx, val->string.ptr);
         if(!i) {
-            i = ui_int_new(obj->ctx, val->value.string.ptr);
+            i = ui_int_new(obj->ctx, val->string.ptr);
         }
     }
     
     UiToggleArgs *args = json2toggle_args(args_value);
     UIWIDGET w;
-    switch(button_type->value.integer) {
+    switch(button_type->integer) {
         default: {
             w = ui_togglebutton_create(obj, args);
             break;

mercurial