aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2023-03-10 11:44:20 +0100
committerIsaac Freund <mail@isaacfreund.com>2023-03-10 11:44:20 +0100
commit87969c1c7c6a85420456b2d6c075944c4b029840 (patch)
treea2fadf3a4ddfa2226780f911c1e400e4ea817c96
parent039cca8a51ed0783d45fb7a5215e9ae83e4e02e2 (diff)
xdg-decoration: send missing protocol errors
-rw-r--r--types/wlr_xdg_decoration_v1.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/types/wlr_xdg_decoration_v1.c b/types/wlr_xdg_decoration_v1.c
index fcd97a5c..d20461ed 100644
--- a/types/wlr_xdg_decoration_v1.c
+++ b/types/wlr_xdg_decoration_v1.c
@@ -78,6 +78,11 @@ static void toplevel_decoration_handle_surface_destroy(
struct wl_listener *listener, void *data) {
struct wlr_xdg_toplevel_decoration_v1 *decoration =
wl_container_of(listener, decoration, surface_destroy);
+
+ wl_resource_post_error(decoration->resource,
+ ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ORPHANED,
+ "xdg_toplevel destroyed before xdg_toplevel_decoration");
+
wl_resource_destroy(decoration->resource);
}
@@ -182,6 +187,16 @@ static void decoration_manager_handle_get_toplevel_decoration(
return;
}
+ struct wlr_xdg_toplevel_decoration_v1 *existing;
+ wl_list_for_each(existing, &manager->decorations, link) {
+ if (existing->surface == toplevel->base) {
+ wl_resource_post_error(manager_resource,
+ ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ALREADY_CONSTRUCTED,
+ "xdg_toplevel already has a decoration object");
+ return;
+ }
+ }
+
struct wlr_xdg_toplevel_decoration_v1 *decoration =
calloc(1, sizeof(struct wlr_xdg_toplevel_decoration_v1));
if (decoration == NULL) {