[PATCH 5/7] shell: update position of surfaces with type none on map()
Pekka Paalanen
ppaalanen at gmail.com
Wed Feb 15 23:56:56 PST 2012
On Wed, 15 Feb 2012 17:02:56 +0200
Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
wrote:
> 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 at intel.com>
> ---
> src/compositor.c | 2 +-
> src/compositor.h | 2 +-
> src/shell.c | 8 ++++++--
> src/tablet-shell.c | 2 +-
> 4 files changed, 9 insertions(+), 5 deletions(-)
...
> diff --git a/src/shell.c b/src/shell.c
> index d48633e..d9ba168 100644
> --- a/src/shell.c
> +++ b/src/shell.c
> @@ -1267,8 +1267,8 @@ center_on_output(struct weston_surface *surface, struct weston_output *output)
> }
>
> 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;
> @@ -1308,6 +1308,10 @@ map(struct weston_shell *base,
> 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);
I'd like to have a comment here saying that we are ignoring surface
transformations on purpose. The pattern "geometry.x + sx" is
usually a bug, especially without checking surface->transform.enabled,
because it mixes two different coordinate systems.
Thanks,
pq
More information about the wayland-devel
mailing list