shell: update position of surfaces with type none on map()
Needed for implementing drag'n'drop icons. When a drag starts, the
compositor will position the top-left corner of the client supplied
icon surface at the cursor hotspot. On the first attach to that
surface, the client may want to reposition it but shell->map did not
take sx and sy parameters.
This changes shell->map interface to take sx and sy parameters and
change dekstop shell implementation to update the position of a
surface of type none according to those parameters. Since a surface
of type none won't actually be mapped, the effect of this change is
only visible for surfaces that are made visible by the compositor.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
diff --git a/src/shell.c b/src/shell.c
index 78db0cb..e8c739b 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1339,8 +1339,8 @@
}
static void
-map(struct weston_shell *base,
- struct weston_surface *surface, int32_t width, int32_t height)
+map(struct weston_shell *base, struct weston_surface *surface,
+ int32_t width, int32_t height, int32_t sx, int32_t sy)
{
struct wl_shell *shell = container_of(base, struct wl_shell, shell);
struct weston_compositor *compositor = shell->compositor;
@@ -1387,6 +1387,10 @@
break;
case SHELL_SURFACE_POPUP:
shell_map_popup(shsurf, shsurf->popup.time);
+ case SHELL_SURFACE_NONE:
+ weston_surface_set_position(surface,
+ surface->geometry.x + sx,
+ surface->geometry.y + sy);
break;
default:
;