summaryrefslogtreecommitdiff
path: root/desktop-shell
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-shell')
-rw-r--r--desktop-shell/shell.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 26cadb63..f28fc10e 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -3978,6 +3978,14 @@ xdg_get_xdg_surface(struct wl_client *client,
struct desktop_shell *shell = sc->shell;
struct shell_surface *shsurf;
+ shsurf = get_shell_surface(surface);
+ if (shsurf && shell_surface_is_xdg_surface(shsurf)) {
+ wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE,
+ "This wl_surface is already an "
+ "xdg_surface");
+ return;
+ }
+
if (weston_surface_set_role(surface, "xdg_surface",
resource, XDG_SHELL_ERROR_ROLE) < 0)
return;
@@ -4071,6 +4079,14 @@ xdg_get_xdg_popup(struct wl_client *client,
struct weston_surface *parent;
struct shell_seat *seat;
+ shsurf = get_shell_surface(surface);
+ if (shsurf && shell_surface_is_xdg_popup(shsurf)) {
+ wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE,
+ "This wl_surface is already an "
+ "xdg_popup");
+ return;
+ }
+
if (weston_surface_set_role(surface, "xdg_popup",
resource, XDG_SHELL_ERROR_ROLE) < 0)
return;