From cdc21fb0d6e781a5c7ea1498ea25599ae10f8f85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Sun, 28 Jan 2024 22:36:31 -0500
Subject: [PATCH] Add fill and aliases...

I think this is ready to start drawing things soon now.
---
 src/newifc/genapi.c        | 312 ++++++++++++++++++++++---------------
 src/newifc/newifc_nongen.c |  13 ++
 src/newifc/root_window.c   | 102 +-----------
 3 files changed, 200 insertions(+), 227 deletions(-)

diff --git a/src/newifc/genapi.c b/src/newifc/genapi.c
index cc324be5cd..58eed26a97 100644
--- a/src/newifc/genapi.c
+++ b/src/newifc/genapi.c
@@ -1,6 +1,7 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 enum ni_type {
 	ni_bool,
@@ -21,6 +22,8 @@ objtypes[] = {
 enum attribute_types {
 	NI_attr_type_NewIfcObj,
 	NI_attr_type_uint16_t,
+	NI_attr_type_uint8_t,
+	NI_attr_type_uint32_t,
 	NI_attr_type_NI_err,
 	NI_attr_type_bool,
 	NI_attr_type_charptr,
@@ -35,6 +38,8 @@ struct type_str_values {
 struct type_str_values type_str[] = {
 	{"NewIfcObj", "obj"},
 	{"uint16_t", "uint16"},
+	{"uint8_t", "uint8"},
+	{"uint32_t", "uint32"},
 	{"NI_err", "NI_err"},
 	{"bool", "bool"},
 	{"const char *", "const_char_ptr"},
@@ -63,6 +68,10 @@ attributes[] = {
 	{"child_xpos", NI_attr_type_uint16_t, attr_impl_global, 1},
 	{"child_ypos", NI_attr_type_uint16_t, attr_impl_global, 1},
 	{"dirty", NI_attr_type_bool, attr_impl_root, 1},
+	{"fill_character", NI_attr_type_uint32_t, attr_impl_global, 0},
+	{"fill_character_colour", NI_attr_type_uint32_t, attr_impl_global, 0},
+	{"fill_colour", NI_attr_type_uint32_t, attr_impl_global, 0},
+	{"fill_font", NI_attr_type_uint8_t, attr_impl_global, 0},
 	{"focus", NI_attr_type_bool, attr_impl_global_custom_setter, 0},
 	{"height", NI_attr_type_uint16_t, attr_impl_global, 0},
 	{"hidden", NI_attr_type_bool, attr_impl_global, 1},
@@ -85,6 +94,16 @@ attributes[] = {
 	{"ypos", NI_attr_type_uint16_t, attr_impl_global, 0},
 };
 
+struct attribute_alias {
+	const char *attribute_name;
+	const char *alias_name;
+};
+
+const struct attribute_alias aliases[] = {
+	{"fill_colour", "fill_color"},
+	{"fill_character_colour", "fill_character_color"},
+};
+
 struct error_info {
 	const char *name;
 	int value;
@@ -115,6 +134,148 @@ extra_handlers[] = {
 	{"on_destroy", "NI_err (*on_destroy)(NewIfcObj obj, void *cbdata)"},
 };
 
+size_t
+find_attribute(const char *name)
+{
+	size_t nitems = sizeof(attributes) / sizeof(attributes[0]);
+	// Linear search in case they're not alphabetical
+	for (size_t i = 0; i < nitems; i++) {
+		if (strcmp(attributes[i].name, name) == 0)
+			return i;
+	}
+	return -1;
+}
+
+void
+attribute_functions(size_t i, FILE *c_code, const char *alias)
+{
+	switch (attributes[i].impl) {
+		case attr_impl_object:
+			if (!attributes[i].read_only) {
+				fprintf(c_code, "NI_err\n"
+						"NI_set_%s(NewIfcObj obj, %s value) {\n"
+						"	NI_err ret;\n"
+						"	if (obj == NULL)\n"
+						"		return NewIfc_error_invalid_arg;\n"
+						"	if (NI_set_locked(obj, true)) {\n"
+						"		ret = call_%s_change_handlers(obj, NewIfc_%s, value);\n"
+						"		if (ret != NewIfc_error_none)\n"
+						"			return ret;\n"
+						"		ret = obj->set(obj, NewIfc_%s, value);\n"
+						"		NI_set_locked(obj, false);\n"
+						"	}\n"
+						"	else\n"
+						"		ret = NewIfc_error_lock_failed;\n"
+						"	return ret;\n"
+						"}\n\n", alias, type_str[attributes[i].type].type, type_str[attributes[i].type].var_name, attributes[i].name, attributes[i].name);
+			}
+
+			fprintf(c_code, "NI_err\n"
+					"NI_get_%s(NewIfcObj obj, %s* value) {\n"
+					"	NI_err ret;\n"
+					"	if (obj == NULL)\n"
+					"		return NewIfc_error_invalid_arg;\n"
+					"	if (value == NULL)\n"
+					"		return NewIfc_error_invalid_arg;\n"
+					"	if (NI_set_locked(obj, true)) {\n"
+					"		ret = obj->get(obj, NewIfc_%s, value);\n"
+					"		NI_set_locked(obj, false);\n"
+					"	}\n"
+					"	else\n"
+					"		ret = NewIfc_error_lock_failed;\n"
+					"	return ret;\n"
+					"}\n\n", alias, type_str[attributes[i].type].type, attributes[i].name);
+			break;
+		case attr_impl_global:
+			if (!attributes[i].read_only) {
+				fprintf(c_code, "NI_err\n"
+						"NI_set_%s(NewIfcObj obj, %s value) {\n"
+						"	NI_err ret;\n"
+						"	if (obj == NULL)\n"
+						"		return NewIfc_error_invalid_arg;\n"
+						"	if (NI_set_locked(obj, true)) {\n"
+						"		ret = obj->set(obj, NewIfc_%s, value);\n"
+						"		if (ret != NewIfc_error_none && obj->last_error != NewIfc_error_not_implemented) {\n"
+						"			obj->%s = value;\n"
+						"			obj->last_error = NewIfc_error_none;\n"
+						"		}\n"
+						"		NI_set_locked(obj, false);\n"
+						"	}\n"
+						"	else\n"
+						"		ret = NewIfc_error_lock_failed;\n"
+						"	return ret;\n"
+						"}\n\n", alias, type_str[attributes[i].type].type, attributes[i].name, attributes[i].name);
+			}
+
+			// Fall-through
+		case attr_impl_global_custom_setter:
+			fprintf(c_code, "NI_err\n"
+					"NI_get_%s(NewIfcObj obj, %s* value) {\n"
+					"	NI_err ret;\n"
+					"	if (obj == NULL)\n"
+					"		return NewIfc_error_invalid_arg;\n"
+					"	if (value == NULL)\n"
+					"		return NewIfc_error_invalid_arg;\n"
+					"	if (NI_set_locked(obj, true)) {\n"
+					"		ret = obj->get(obj, NewIfc_%s, value);\n"
+					"		if ((ret != NewIfc_error_none) && obj->last_error != NewIfc_error_not_implemented) {\n"
+					"			*value = obj->%s;\n"
+					"			obj->last_error = NewIfc_error_none;\n"
+					"		}\n"
+					"		NI_set_locked(obj, false);\n"
+					"	}\n"
+					"	else\n"
+					"		ret = NewIfc_error_lock_failed;\n"
+					"	return ret;\n"
+					"}\n\n", alias, type_str[attributes[i].type].type, attributes[i].name, attributes[i].name);
+			break;
+		case attr_impl_root:
+			if (!attributes[i].read_only) {
+				fprintf(c_code, "NI_err\n"
+						"NI_set_%s(NewIfcObj obj, %s value) {\n"
+						"	if (obj == NULL)\n"
+						"		return NewIfc_error_invalid_arg;\n"
+						"	NI_err ret = obj->root->set(obj, NewIfc_%s, value);\n"
+						"	obj->last_error = obj->root->last_error;\n"
+						"	return ret;\n"
+						"}\n\n", alias, type_str[attributes[i].type].type, attributes[i].name);
+			}
+
+			fprintf(c_code, "NI_err\n"
+					"NI_get_%s(NewIfcObj obj, %s* value) {\n"
+					"	if (obj == NULL)\n"
+					"		return NewIfc_error_invalid_arg;\n"
+					"	if (value == NULL)\n"
+					"		return NewIfc_error_invalid_arg;\n"
+					"	NI_err ret = obj->root->get(obj, NewIfc_%s, value);\n"
+					"	obj->last_error = obj->root->last_error;\n"
+					"	return ret;\n"
+					"}\n\n", alias, type_str[attributes[i].type].type, attributes[i].name);
+			break;
+	}
+	fprintf(c_code, "NI_err\n"
+			"NI_add_%s_handler(NewIfcObj obj, NI_err (*handler)(NewIfcObj obj, %s newval, void *cbdata), void *cbdata)\n"
+			"{\n"
+			"	NI_err ret;\n"
+			"	if (obj == NULL || handler == NULL)\n"
+			"		return NewIfc_error_invalid_arg;\n"
+			"	if (NI_set_locked(obj, true)) {\n"
+			"		struct NewIfc_handler *h = malloc(sizeof(struct NewIfc_handler));\n"
+			"		if (h == NULL)\n"
+			"			return NewIfc_error_allocation_failure;\n"
+			"		h->on_%s_change = handler;\n"
+			"		h->cbdata = cbdata;\n"
+			"		h->event = NewIfc_on_%s_change;\n"
+			"		h->next = NULL;\n"
+			"		ret = NI_install_handler(obj, h);\n"
+			"		NI_set_locked(obj, false);\n"
+			"	}\n"
+			"	else\n"
+			"		ret = NewIfc_error_lock_failed;\n"
+			"	return ret;\n"
+			"}\n\n", alias, type_str[attributes[i].type].type, type_str[attributes[i].type].var_name, attributes[i].name);
+}
+
 int
 main(int argc, char **argv)
 {
@@ -158,6 +319,8 @@ main(int argc, char **argv)
 	}
 	fputs("};\n\n", header);
 
+	fputs("#define NI_TRANSPARENT UINT32_MAX\n\n", header);
+
 	fputs("NI_err NI_copy(NewIfcObj obj, NewIfcObj *newobj);\n", header);
 	fputs("NI_err NI_create(enum NewIfc_object obj, NewIfcObj parent, NewIfcObj *newobj);\n", header);
 	fputs("NI_err NI_error(NewIfcObj obj);\n", header);
@@ -171,6 +334,15 @@ main(int argc, char **argv)
 		}
 		fprintf(header, "NI_err NI_get_%s(NewIfcObj obj, %s* value);\n", attributes[i].name, type_str[attributes[i].type].type);
 	}
+	nitems = sizeof(aliases) / sizeof(aliases[0]);
+	for (i = 0; i < nitems; i++) {
+		size_t a = find_attribute(aliases[i].attribute_name);
+		if (!attributes[a].read_only) {
+			fprintf(header, "NI_err NI_set_%s(NewIfcObj obj, %s value);\n", aliases[i].alias_name, type_str[attributes[a].type].type);
+		}
+		fprintf(header, "NI_err NI_add_%s_handler(NewIfcObj obj, NI_err (*handler)(NewIfcObj obj, %s newval, void *cbdata), void *cbdata);\n", aliases[i].alias_name, type_str[attributes[a].type].type);
+		fprintf(header, "NI_err NI_get_%s(NewIfcObj obj, %s* value);\n", aliases[i].alias_name, type_str[attributes[a].type].type);
+	}
 	fputs("\n#endif\n", header);
 	fclose(header);
 
@@ -219,13 +391,15 @@ main(int argc, char **argv)
 	      "	NI_err (*get)(NewIfcObj niobj, const int attr, ...);\n"
 	      "	NI_err (*copy)(NewIfcObj obj, NewIfcObj *newobj);\n"
 	      "	struct NewIfc_handler **handlers;\n"
-	      "	size_t handlers_sz;\n"
 	      "	NewIfcObj root;\n"
 	      "	NewIfcObj parent;\n"
 	      "	NewIfcObj higherpeer;\n"
 	      "	NewIfcObj lowerpeer;\n"
 	      "	NewIfcObj topchild;\n"
 	      "	NewIfcObj bottomchild;\n"
+	      "	size_t handlers_sz;\n"
+	      "	uint32_t fill_character_colour;\n"
+	      "	uint32_t fill_colour;\n"
 	      "	enum NewIfc_object type;\n"
 	      "	NI_err last_error;\n"
 	      "	uint16_t height;\n"
@@ -238,6 +412,8 @@ main(int argc, char **argv)
 	      "	uint16_t child_width;\n"
 	      "	uint16_t child_xpos;\n"
 	      "	uint16_t child_ypos;\n"
+	      "	uint8_t fill_character;\n"
+	      "	uint8_t fill_font;\n"
 	      "	unsigned focus:1;\n"
 	      "	unsigned hidden:1;\n"
 	      "};\n\n", internal_header);
@@ -272,7 +448,8 @@ main(int argc, char **argv)
 	fputs("\n", c_code);
 
 	fputs("NI_err\n"
-	      "NI_create(enum NewIfc_object obj, NewIfcObj parent, NewIfcObj *newobj) {\n"
+	      "NI_create(enum NewIfc_object obj, NewIfcObj parent, NewIfcObj *newobj)\n"
+	      "{\n"
 	      "	NI_err ret = NewIfc_error_none;\n"
 	      "\n"
 	      "	if (newobj == NULL)\n"
@@ -349,131 +526,12 @@ main(int argc, char **argv)
 
 	nitems = sizeof(attributes) / sizeof(attributes[0]);
 	for (i = 0; i < nitems; i++) {
-		switch (attributes[i].impl) {
-			case attr_impl_object:
-				if (!attributes[i].read_only) {
-					fprintf(c_code, "NI_err\n"
-					                "NI_set_%s(NewIfcObj obj, %s value) {\n"
-					                "	NI_err ret;\n"
-					                "	if (obj == NULL)\n"
-					                "		return NewIfc_error_invalid_arg;\n"
-					                "	if (NI_set_locked(obj, true)) {\n"
-					                "		ret = call_%s_change_handlers(obj, NewIfc_%s, value);\n"
-					                "		if (ret != NewIfc_error_none)\n"
-					                "			return ret;\n"
-					                "		ret = obj->set(obj, NewIfc_%s, value);\n"
-					                "		NI_set_locked(obj, false);\n"
-					                "	}\n"
-					                "	else\n"
-					                "		ret = NewIfc_error_lock_failed;\n"
-					                "	return ret;\n"
-					                "}\n\n", attributes[i].name, type_str[attributes[i].type].type, type_str[attributes[i].type].var_name, attributes[i].name, attributes[i].name);
-				}
-
-				fprintf(c_code, "NI_err\n"
-				                "NI_get_%s(NewIfcObj obj, %s* value) {\n"
-				                "	NI_err ret;\n"
-				                "	if (obj == NULL)\n"
-				                "		return NewIfc_error_invalid_arg;\n"
-				                "	if (value == NULL)\n"
-				                "		return NewIfc_error_invalid_arg;\n"
-				                "	if (NI_set_locked(obj, true)) {\n"
-				                "		ret = obj->get(obj, NewIfc_%s, value);\n"
-				                "		NI_set_locked(obj, false);\n"
-				                "	}\n"
-				                "	else\n"
-				                "		ret = NewIfc_error_lock_failed;\n"
-				                "	return ret;\n"
-				                "}\n\n", attributes[i].name, type_str[attributes[i].type].type, attributes[i].name);
-				break;
-			case attr_impl_global:
-				if (!attributes[i].read_only) {
-					fprintf(c_code, "NI_err\n"
-					                "NI_set_%s(NewIfcObj obj, %s value) {\n"
-					                "	NI_err ret;\n"
-					                "	if (obj == NULL)\n"
-					                "		return NewIfc_error_invalid_arg;\n"
-					                "	if (NI_set_locked(obj, true)) {\n"
-					                "		ret = obj->set(obj, NewIfc_%s, value);\n"
-					                "		if (ret != NewIfc_error_none && obj->last_error != NewIfc_error_not_implemented) {\n"
-					                "			obj->%s = value;\n"
-					                "			obj->last_error = NewIfc_error_none;\n"
-					                "		}\n"
-					                "		NI_set_locked(obj, false);\n"
-					                "	}\n"
-					                "	else\n"
-					                "		ret = NewIfc_error_lock_failed;\n"
-					                "	return ret;\n"
-					                "}\n\n", attributes[i].name, type_str[attributes[i].type].type, attributes[i].name, attributes[i].name);
-				}
-
-				// Fall-through
-			case attr_impl_global_custom_setter:
-				fprintf(c_code, "NI_err\n"
-				                "NI_get_%s(NewIfcObj obj, %s* value) {\n"
-				                "	NI_err ret;\n"
-				                "	if (obj == NULL)\n"
-				                "		return NewIfc_error_invalid_arg;\n"
-				                "	if (value == NULL)\n"
-				                "		return NewIfc_error_invalid_arg;\n"
-				                "	if (NI_set_locked(obj, true)) {\n"
-				                "		ret = obj->get(obj, NewIfc_%s, value);\n"
-				                "		if ((ret != NewIfc_error_none) && obj->last_error != NewIfc_error_not_implemented) {\n"
-				                "			*value = obj->%s;\n"
-				                "			obj->last_error = NewIfc_error_none;\n"
-				                "		}\n"
-				                "		NI_set_locked(obj, false);\n"
-				                "	}\n"
-				                "	else\n"
-				                "		ret = NewIfc_error_lock_failed;\n"
-				                "	return ret;\n"
-				                "}\n\n", attributes[i].name, type_str[attributes[i].type].type, attributes[i].name, attributes[i].name);
-				break;
-			case attr_impl_root:
-				if (!attributes[i].read_only) {
-					fprintf(c_code, "NI_err\n"
-					                "NI_set_%s(NewIfcObj obj, %s value) {\n"
-					                "	if (obj == NULL)\n"
-					                "		return NewIfc_error_invalid_arg;\n"
-					                "	NI_err ret = obj->root->set(obj, NewIfc_%s, value);\n"
-					                "	obj->last_error = obj->root->last_error;\n"
-					                "	return ret;\n"
-					                "}\n\n", attributes[i].name, type_str[attributes[i].type].type, attributes[i].name);
-				}
-
-				fprintf(c_code, "NI_err\n"
-				                "NI_get_%s(NewIfcObj obj, %s* value) {\n"
-				                "	if (obj == NULL)\n"
-				                "		return NewIfc_error_invalid_arg;\n"
-				                "	if (value == NULL)\n"
-				                "		return NewIfc_error_invalid_arg;\n"
-				                "	NI_err ret = obj->root->get(obj, NewIfc_%s, value);\n"
-				                "	obj->last_error = obj->root->last_error;\n"
-				                "	return ret;\n"
-				                "}\n\n", attributes[i].name, type_str[attributes[i].type].type, attributes[i].name);
-				break;
-		}
-		fprintf(c_code, "NI_err\n"
-		                "NI_add_%s_handler(NewIfcObj obj, NI_err (*handler)(NewIfcObj obj, %s newval, void *cbdata), void *cbdata)\n"
-		                "{\n"
-		                "	NI_err ret;\n"
-		                "	if (obj == NULL || handler == NULL)\n"
-		                "		return NewIfc_error_invalid_arg;\n"
-		                "	if (NI_set_locked(obj, true)) {\n"
-		                "		struct NewIfc_handler *h = malloc(sizeof(struct NewIfc_handler));\n"
-		                "		if (h == NULL)\n"
-		                "			return NewIfc_error_allocation_failure;\n"
-		                "		h->on_%s_change = handler;\n"
-		                "		h->cbdata = cbdata;\n"
-		                "		h->event = NewIfc_on_%s_change;\n"
-		                "		h->next = NULL;\n"
-		                "		ret = NI_install_handler(obj, h);\n"
-		                "		NI_set_locked(obj, false);\n"
-		                "	}\n"
-		                "	else\n"
-		                "		ret = NewIfc_error_lock_failed;\n"
-		                "	return ret;\n"
-		                "}\n\n", attributes[i].name, type_str[attributes[i].type].type, type_str[attributes[i].type].var_name, attributes[i].name);
+		attribute_functions(i, c_code, attributes[i].name);
+	}
+	nitems = sizeof(aliases) / sizeof(aliases[0]);
+	for (i = 0; i < nitems; i++) {
+		size_t a = find_attribute(aliases[i].attribute_name);
+		attribute_functions(a, c_code, aliases[i].alias_name);
 	}
 
 	fputs("#include \"newifc_nongen_after.c\"\n\n", c_code);
diff --git a/src/newifc/newifc_nongen.c b/src/newifc/newifc_nongen.c
index b9c7a861f1..f07ba84fce 100644
--- a/src/newifc/newifc_nongen.c
+++ b/src/newifc/newifc_nongen.c
@@ -136,3 +136,16 @@ remove_focus_cb(NewIfcObj obj, void *cbdata)
 	obj->set(obj, NewIfc_focus, false);
 	return NewIfc_error_none;
 }
+
+static NI_err
+NI_resize(NewIfcObj obj, uint16_t width, uint16_t height)
+{
+	/* First, make sure all children will fit in new size...
+	 * walk through them and check that the minsize is smaller than
+	 * or equal to the updated client size accounting for X/Y position */
+
+	/* Now walk through them again actually setting the size...
+	 * This is where sizers will need to get beefy */
+
+	return NewIfc_error_none;
+}
diff --git a/src/newifc/root_window.c b/src/newifc/root_window.c
index 36d40332bc..b3dd6e6448 100644
--- a/src/newifc/root_window.c
+++ b/src/newifc/root_window.c
@@ -33,45 +33,6 @@ struct rw_recalc_child_cb_params {
 	uint16_t width;
 };
 
-static NI_err
-rw_recalc_child_cb(NewIfcObj obj, void *cbdata)
-{
-	struct rw_recalc_child_cb_params *nsz = cbdata;
-
-	if (obj->height > nsz->height)
-		return NewIfc_error_wont_fit;
-	if (obj->width > nsz->width)
-		return NewIfc_error_wont_fit;
-	return NewIfc_error_none;
-}
-
-static void
-rw_recalc_child(struct root_window *rw, uint16_t height, uint16_t width)
-{
-	uint16_t losty = 0;
-	struct rw_recalc_child_cb_params nsz = {height, width};
-
-	if (rw->show_title) {
-		nsz.height--;
-		losty++;
-	}
-	if (rw->help) {
-		nsz.height--;
-		losty++;
-	}
-	if (losty > height) {
-		rw->api.last_error = NewIfc_error_wont_fit;
-		return;
-	}
-	if (NI_walk_children((NewIfcObj)rw, false, rw_recalc_child_cb, &nsz) != NewIfc_error_none) {
-		rw->api.last_error = NewIfc_error_wont_fit;
-		return;
-	}
-	rw->api.child_height = nsz.height;
-	rw->api.child_ypos = rw->show_title ? 1 : 0;
-	return;
-}
-
 static NI_err
 rw_set(NewIfcObj obj, int attr, ...)
 {
@@ -81,23 +42,6 @@ rw_set(NewIfcObj obj, int attr, ...)
 	rw->api.last_error = NewIfc_error_none;
 	va_start(ap, attr);
 	switch (attr) {
-		case NewIfc_show_title:
-			SET_BOOL(rw, show_title);
-			break;
-		case NewIfc_show_help:
-			SET_BOOL(rw, help);
-			rw_recalc_child(rw, rw->api.height, rw->api.width);
-			break;
-		case NewIfc_title:
-			SET_STRING(rw, title, title_sz);
-			rw_recalc_child(rw, rw->api.height, rw->api.width);
-			break;
-		case NewIfc_height:
-			rw_recalc_child(rw, va_arg(ap, int), rw->api.width);
-			break;
-		case NewIfc_width:
-			rw_recalc_child(rw, rw->api.height, va_arg(ap, int));
-			break;
 		case NewIfc_locked:
 			if (va_arg(ap, int)) {
 				if (pthread_mutex_lock(&rw->mtx) != 0) {
@@ -151,15 +95,6 @@ rw_get(NewIfcObj obj, int attr, ...)
 	rw->api.last_error = NewIfc_error_none;
 	va_start(ap, attr);
 	switch (attr) {
-		case NewIfc_show_title:
-			GET_BOOL(rw, show_title);
-			break;
-		case NewIfc_show_help:
-			GET_BOOL(rw, help);
-			break;
-		case NewIfc_title:
-			GET_STRING(rw, title);
-			break;
 		case NewIfc_locked:
 			if (pthread_mutex_trylock(&rw->mtx) != 0)
 				*(va_arg(ap, bool *)) = true;
@@ -207,11 +142,6 @@ rw_copy(NewIfcObj old, NewIfcObj *newobj)
 		return NewIfc_error_allocation_failure;
 	}
 	memcpy(*newrw, old, sizeof(struct root_window));
-	(*newrw)->title = strdup(oldrw->title);
-	if ((*newrw)->title == NULL) {
-		free(*newrw);
-		return NewIfc_error_allocation_failure;
-	}
 
 	return NewIfc_error_none;
 }
@@ -232,26 +162,18 @@ NewIFC_root_window(NewIfcObj *newobj)
 	(*newrw)->api.last_error = NewIfc_error_none;
 	(*newrw)->api.width = 80;
 	(*newrw)->api.height = 25;
+	(*newrw)->api.child_width = 80;
+	(*newrw)->api.child_height = 25;
 	(*newrw)->api.xpos = 0;
 	(*newrw)->api.ypos = 0;
 	(*newrw)->api.child_xpos = 0;
 	(*newrw)->api.child_ypos = 1;
-	(*newrw)->api.child_width = 80;
-	(*newrw)->api.child_height = 23;
 	(*newrw)->api.min_height = 2;
 	(*newrw)->api.min_width = 40;
 	// TODO: This is only needed by the unit tests...
 	(*newrw)->api.root = *newobj;
 	(*newrw)->api.focus = true;
-	(*newrw)->show_title = true;
-	(*newrw)->help = true;
-	(*newrw)->title_sz = 0;
-	(*newrw)->title = strdup(default_title);
 	(*newrw)->locks = 0;
-	if ((*newrw)->title == NULL) {
-		free(*newrw);
-		return NewIfc_error_allocation_failure;
-	}
 	(*newrw)->mtx = pthread_mutex_initializer_np(true);
 
 	return NewIfc_error_none;
@@ -278,24 +200,11 @@ void test_root_window(CuTest *ct)
 	CuAssertTrue(ct, obj->min_height == 2);
 	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
 	CuAssertTrue(ct, obj->focus == true);
-	CuAssertTrue(ct, obj->get(obj, NewIfc_show_title, &b) == NewIfc_error_none && b);
-	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
-	CuAssertTrue(ct, obj->get(obj, NewIfc_show_help, &b) == NewIfc_error_none && b);
-	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
-	CuAssertTrue(ct, obj->get(obj, NewIfc_title, &s) == NewIfc_error_none);
-	CuAssertStrEquals(ct, s, default_title);
-	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
 	CuAssertTrue(ct, obj->get(obj, NewIfc_locked, &b) == NewIfc_error_none && !b);
 	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
 	CuAssertTrue(ct, obj->get(obj, NewIfc_locked_by_me, &b) == NewIfc_error_none && !b);
 	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
 
-	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
-	CuAssertTrue(ct, obj->set(obj, NewIfc_show_title, false) == NewIfc_error_none);
-	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
-	CuAssertTrue(ct, obj->set(obj, NewIfc_show_help, false) == NewIfc_error_none);
-	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
-	CuAssertTrue(ct, obj->set(obj, NewIfc_title, new_title) == NewIfc_error_none);
 	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
 	CuAssertTrue(ct, obj->set(obj, NewIfc_locked, false) == NewIfc_error_lock_failed);
 	CuAssertTrue(ct, obj->last_error == NewIfc_error_lock_failed);
@@ -304,13 +213,6 @@ void test_root_window(CuTest *ct)
 	CuAssertTrue(ct, obj->set(obj, NewIfc_locked_by_me, &b) == NewIfc_error_not_implemented);
 	CuAssertTrue(ct, obj->last_error == NewIfc_error_not_implemented);
 
-	CuAssertTrue(ct, obj->get(obj, NewIfc_show_title, &b) == NewIfc_error_none && !b);
-	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
-	CuAssertTrue(ct, obj->get(obj, NewIfc_show_help, &b) == NewIfc_error_none && !b);
-	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
-	CuAssertTrue(ct, obj->get(obj, NewIfc_title, &s) == NewIfc_error_none);
-	CuAssertStrEquals(ct, s, new_title);
-	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
 	CuAssertTrue(ct, obj->get(obj, NewIfc_locked, &b) == NewIfc_error_none && b);
 	CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
 	CuAssertTrue(ct, obj->get(obj, NewIfc_locked_by_me, &b) == NewIfc_error_none && b);
-- 
GitLab