shell: forbid multiple wl_shell_surface objects

Do not allow multiple wl_shell_surface objects to be created for a
wl_surface object.

Multiple shell_surface objects would confuse the compositor as they
contain separate instances of the shell-private data.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
dev
Pekka Paalanen 13 years ago committed by Kristian Høgsberg
parent 4622967586
commit f32f1fc743
  1. 7
      compositor/shell.c

@ -410,6 +410,13 @@ shell_get_shell_surface(struct wl_client *client,
struct wlsc_surface *surface = surface_resource->data; struct wlsc_surface *surface = surface_resource->data;
struct shell_surface *shsurf; struct shell_surface *shsurf;
if (get_shell_surface(surface)) {
wl_resource_post_error(surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"wl_shell::get_shell_surface already requested");
return;
}
shsurf = calloc(1, sizeof *shsurf); shsurf = calloc(1, sizeof *shsurf);
if (!shsurf) { if (!shsurf) {
wl_resource_post_no_memory(resource); wl_resource_post_no_memory(resource);

Loading…
Cancel
Save