[PATCH weston 14/19] desktop-shell: Make surface_rotate take a pointer instead of a seat

Jonas Ådahl jadahl at gmail.com
Wed Jul 1 01:55:02 PDT 2015


On Wed, Jun 03, 2015 at 03:53:33PM -0500, Derek Foreman wrote:
> It doesn't actually need the seat and we have to validate that the seat
> has a pointer before making the call, so it's safer just to pass
> the validated pointer.
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>

Reviewed-by: Jonas Ådahl <jadahl at gmail.com>

> ---
>  desktop-shell/shell.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index b234214..f42d345 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -249,7 +249,7 @@ static struct desktop_shell *
>  shell_surface_get_shell(struct shell_surface *shsurf);
>  
>  static void
> -surface_rotate(struct shell_surface *surface, struct weston_seat *seat);
> +surface_rotate(struct shell_surface *surface, struct weston_pointer *pointer);
>  
>  static void
>  shell_fade_startup(struct desktop_shell *shell);
> @@ -2043,7 +2043,7 @@ busy_cursor_grab_button(struct weston_pointer_grab *base,
>  		surface_move(shsurf, pointer, false);
>  	} else if (shsurf && button == BTN_RIGHT && state) {
>  		activate(shsurf->shell, shsurf->surface, seat, true);
> -		surface_rotate(shsurf, seat);
> +		surface_rotate(shsurf, pointer);
>  	}
>  }
>  
> @@ -4986,7 +4986,7 @@ static const struct weston_pointer_grab_interface rotate_grab_interface = {
>  };
>  
>  static void
> -surface_rotate(struct shell_surface *surface, struct weston_seat *seat)
> +surface_rotate(struct shell_surface *surface, struct weston_pointer *pointer)
>  {
>  	struct rotate_grab *rotate;
>  	float dx, dy;
> @@ -5001,8 +5001,8 @@ surface_rotate(struct shell_surface *surface, struct weston_seat *seat)
>  				    surface->surface->height * 0.5f,
>  				    &rotate->center.x, &rotate->center.y);
>  
> -	dx = wl_fixed_to_double(seat->pointer->x) - rotate->center.x;
> -	dy = wl_fixed_to_double(seat->pointer->y) - rotate->center.y;
> +	dx = wl_fixed_to_double(pointer->x) - rotate->center.x;
> +	dy = wl_fixed_to_double(pointer->y) - rotate->center.y;
>  	r = sqrtf(dx * dx + dy * dy);
>  	if (r > 20.0f) {
>  		struct weston_matrix inverse;
> @@ -5019,7 +5019,7 @@ surface_rotate(struct shell_surface *surface, struct weston_seat *seat)
>  	}
>  
>  	shell_grab_start(&rotate->base, &rotate_grab_interface, surface,
> -			 seat->pointer, DESKTOP_SHELL_CURSOR_ARROW);
> +			 pointer, DESKTOP_SHELL_CURSOR_ARROW);
>  }
>  
>  static void
> @@ -5044,7 +5044,7 @@ rotate_binding(struct weston_pointer *pointer, uint32_t time, uint32_t button,
>  	    surface->state.maximized)
>  		return;
>  
> -	surface_rotate(surface, pointer->seat);
> +	surface_rotate(surface, pointer);
>  }
>  
>  /* Move all fullscreen layers down to the current workspace and hide their
> -- 
> 2.1.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list