[neon/backports-resolute/wayland-resolute/Neon/release] /: scanner: Fix types emitted for new_id arguments

Pekka Paalanen null at kde.org
Sat Aug 22 05:58:19 BST 2026


Git commit b93a50abd99e6eb547a088329b3cf0023801c746 by Pekka Paalanen, on behalf of Hannes Schulze.
Committed on 14/04/2026 at 12:11.
Pushed by carlosdem into branch 'Neon/release'.

scanner: Fix types emitted for new_id arguments

Previously, wayland-scanner would only emit one NULL entry in the
wl_message.types array for every argument, even though requests with
new_id arguments without an interface type additionally take a string
and a uint argument.

Signed-off-by: Hannes Schulze <contact at haschu.me>

M  +11   -1    src/scanner.c
M  +3    -1    tests/data/small-code-core.c
M  +3    -1    tests/data/small-code.c
M  +3    -1    tests/data/small-private-code.c

https://invent.kde.org/neon/backports-resolute/wayland-resolute/-/commit/b93a50abd99e6eb547a088329b3cf0023801c746

diff --git a/src/scanner.c b/src/scanner.c
index 8b1df32..9619b46 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1629,6 +1629,10 @@ emit_types_forward_declarations(struct protocol *protocol,
 		m->all_null = 1;
 		wl_list_for_each(a, &m->arg_list, link) {
 			length++;
+			if (a->type == NEW_ID && !a->interface_name)
+				// adds implicit string and uint arguments
+				length += 2;
+
 			switch (a->type) {
 			case NEW_ID:
 			case OBJECT:
@@ -1866,9 +1870,15 @@ emit_types(struct protocol *protocol, struct wl_list *message_list)
 
 		m->type_index =
 			protocol->null_run_length + protocol->type_index;
-		protocol->type_index += m->arg_count;
 
 		wl_list_for_each(a, &m->arg_list, link) {
+			protocol->type_index++;
+			if (a->type == NEW_ID && !a->interface_name) {
+				// adds implicit string and uint arguments
+				printf("\tNULL,\n\tNULL,\n");
+				protocol->type_index += 2;
+			}
+
 			switch (a->type) {
 			case NEW_ID:
 			case OBJECT:
diff --git a/tests/data/small-code-core.c b/tests/data/small-code-core.c
index b654549..a0e6607 100644
--- a/tests/data/small-code-core.c
+++ b/tests/data/small-code-core.c
@@ -34,6 +34,8 @@ extern const struct wl_interface another_intf_interface;
 extern const struct wl_interface intf_not_here_interface;
 
 static const struct wl_interface *small_test_types[] = {
+	NULL,
+	NULL,
 	NULL,
 	&intf_not_here_interface,
 	NULL,
@@ -46,7 +48,7 @@ static const struct wl_interface *small_test_types[] = {
 
 static const struct wl_message intf_A_requests[] = {
 	{ "rq1", "sun", small_test_types + 0 },
-	{ "rq2", "nsiufho", small_test_types + 1 },
+	{ "rq2", "nsiufho", small_test_types + 3 },
 	{ "destroy", "", small_test_types + 0 },
 };
 
diff --git a/tests/data/small-code.c b/tests/data/small-code.c
index b654549..a0e6607 100644
--- a/tests/data/small-code.c
+++ b/tests/data/small-code.c
@@ -34,6 +34,8 @@ extern const struct wl_interface another_intf_interface;
 extern const struct wl_interface intf_not_here_interface;
 
 static const struct wl_interface *small_test_types[] = {
+	NULL,
+	NULL,
 	NULL,
 	&intf_not_here_interface,
 	NULL,
@@ -46,7 +48,7 @@ static const struct wl_interface *small_test_types[] = {
 
 static const struct wl_message intf_A_requests[] = {
 	{ "rq1", "sun", small_test_types + 0 },
-	{ "rq2", "nsiufho", small_test_types + 1 },
+	{ "rq2", "nsiufho", small_test_types + 3 },
 	{ "destroy", "", small_test_types + 0 },
 };
 
diff --git a/tests/data/small-private-code.c b/tests/data/small-private-code.c
index b2bbf0a..171a3d7 100644
--- a/tests/data/small-private-code.c
+++ b/tests/data/small-private-code.c
@@ -44,6 +44,8 @@ extern const struct wl_interface another_intf_interface;
 extern const struct wl_interface intf_not_here_interface;
 
 static const struct wl_interface *small_test_types[] = {
+	NULL,
+	NULL,
 	NULL,
 	&intf_not_here_interface,
 	NULL,
@@ -56,7 +58,7 @@ static const struct wl_interface *small_test_types[] = {
 
 static const struct wl_message intf_A_requests[] = {
 	{ "rq1", "sun", small_test_types + 0 },
-	{ "rq2", "nsiufho", small_test_types + 1 },
+	{ "rq2", "nsiufho", small_test_types + 3 },
 	{ "destroy", "", small_test_types + 0 },
 };
 



More information about the Neon-commits mailing list