summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-05-12 19:29:11 +0200
committerSimon Ser <contact@emersion.fr>2022-06-15 07:53:19 +0000
commit1b00df864c6816905628a8eae49c24d2aed287af (patch)
tree877e0b3b6afbd780a1b7a1e2012441aa74e5f4dc /src
parentdd00220b1ef6a4c823632a02b535b40602bfb8d4 (diff)
downloadwayland-1b00df864c6816905628a8eae49c24d2aed287af.tar.gz
server: check visibility before sending global/global_remove
See the previous discussion at [1]: libwayland incorrectly skips the visibility checks when sending global/global_remove events. The check is only performed when a client performs a wl_display.get_registry request. [1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/148 Signed-off-by: Simon Ser <contact@emersion.fr>
Diffstat (limited to 'src')
-rw-r--r--src/wayland-server.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 00cfc27..732f153 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -1252,11 +1252,12 @@ wl_global_create(struct wl_display *display,
wl_list_insert(display->global_list.prev, &global->link);
wl_list_for_each(resource, &display->registry_resource_list, link)
- wl_resource_post_event(resource,
- WL_REGISTRY_GLOBAL,
- global->name,
- global->interface->name,
- global->version);
+ if (wl_global_is_visible(resource->client, global))
+ wl_resource_post_event(resource,
+ WL_REGISTRY_GLOBAL,
+ global->name,
+ global->interface->name,
+ global->version);
return global;
}
@@ -1294,8 +1295,9 @@ wl_global_remove(struct wl_global *global)
global->name);
wl_list_for_each(resource, &display->registry_resource_list, link)
- wl_resource_post_event(resource, WL_REGISTRY_GLOBAL_REMOVE,
- global->name);
+ if (wl_global_is_visible(resource->client, global))
+ wl_resource_post_event(resource, WL_REGISTRY_GLOBAL_REMOVE,
+ global->name);
global->removed = true;
}