[PATCH wayland 2/2] server: Send differentiated errors on wl_registry.bind

Philipp Kerling pkerling at casix.org
Mon Jan 22 12:32:31 UTC 2018


This now uses the new error codes introduced to wl_registry instead
of abusing WL_DISPLAY_ERROR_INVALID_OBJECT.
---
 src/wayland-server.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/wayland-server.c b/src/wayland-server.c
index 7225b4e..e33af62 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -882,21 +882,21 @@ registry_bind(struct wl_client *client,
 
 	if (&global->link == &display->global_list)
 		wl_resource_post_error(resource,
-				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       WL_REGISTRY_ERROR_INVALID_GLOBAL,
 				       "invalid global %s (%d)", interface, name);
 	else if (version == 0)
 		wl_resource_post_error(resource,
-				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       WL_REGISTRY_ERROR_INVALID_VERSION,
 				       "invalid version for global %s (%d): 0 is not a valid version",
 				       interface, name);
 	else if (global->version < version)
 		wl_resource_post_error(resource,
-				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       WL_REGISTRY_ERROR_INCOMPATIBLE_VERSION,
 				       "invalid version for global %s (%d): have %d, wanted %d",
 				       interface, name, global->version, version);
 	else if (!wl_global_is_visible(client, global))
 		wl_resource_post_error(resource,
-				       WL_DISPLAY_ERROR_INVALID_OBJECT,
+				       WL_REGISTRY_ERROR_INVALID_GLOBAL,
 				       "invalid global %s (%d)", interface, name);
 	else
 		global->bind(client, global->data, version, id);
-- 
2.15.1



More information about the wayland-devel mailing list