summaryrefslogtreecommitdiff
path: root/src/data-device.c
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-10-01 15:02:41 +0300
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-10-08 13:16:30 +0300
commit50b67479033709d8ab32744c7b8346b130ace9e0 (patch)
tree277ea29fd7bec395faf960f8b7796434767dc03e /src/data-device.c
parentd7cd1480d4c75cfdeb28b34202707bfe3595b0ea (diff)
downloadweston-50b67479033709d8ab32744c7b8346b130ace9e0.tar.gz
compositor: send error for surface role resets
With the more accurate definition of wl_surface roles in Wayland, enforce the restriction: a role is always set permanently, and attempting to change it is a protocol error. This patch is based on Jasper's patch: http://lists.freedesktop.org/archives/wayland-devel/2014-August/016811.html The difference in this patch compared to his are: - send role errors on the interface whose request triggers it, not on wl_surface - an interface could have several requests assigning different roles, cannot use wl_interface as the unique key; use an arbitary string instead - ensure in window-manager.c that create_shell_surface() -> create_common_surface() is never called with surface->configure set, to avoid compositor abort - use wl_resource_post_no_memory() where appropriate instead of hand-rolling it with wl_resource_post_error() Ideally we would not add weston_surface::role_name field, but use weston_surface::configure. At the moment this is not possible though, because at least shell.c uses several different roles with the same configure function. Drag'n'drop uses two configure functions for the same role. The configure hook is also reset in several places, which is not good for role tracking. This patch overlooks the wl_surface roles assigned in privileged extensions: screensaver, panel, background, lock, input panel. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Diffstat (limited to 'src/data-device.c')
-rw-r--r--src/data-device.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/data-device.c b/src/data-device.c
index 75fc60cb..a8ab4e8c 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -666,11 +666,12 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
source = wl_resource_get_user_data(source_resource);
if (icon_resource)
icon = wl_resource_get_user_data(icon_resource);
- if (icon && icon->configure) {
- wl_resource_post_error(icon_resource,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "surface->configure already set");
- return;
+
+ if (icon) {
+ if (weston_surface_set_role(icon, "wl_data_device-icon",
+ resource,
+ WL_DATA_DEVICE_ERROR_ROLE) < 0)
+ return;
}
if (is_pointer_grab)