[PATCH weston 13/19] desktop-shell: Make surface_move take a pointer instead of a seat
Jonas Ådahl
jadahl at gmail.com
Wed Jul 1 01:54:40 PDT 2015
On Wed, Jun 03, 2015 at 03:53:32PM -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 | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index 0b9af41..b234214 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -1742,7 +1742,7 @@ static const struct weston_pointer_grab_interface move_grab_interface = {
> };
>
> static int
> -surface_move(struct shell_surface *shsurf, struct weston_seat *seat,
> +surface_move(struct shell_surface *shsurf, struct weston_pointer *pointer,
> bool client_initiated)
> {
> struct weston_move_grab *move;
> @@ -1759,13 +1759,13 @@ surface_move(struct shell_surface *shsurf, struct weston_seat *seat,
> return -1;
>
> move->dx = wl_fixed_from_double(shsurf->view->geometry.x) -
> - seat->pointer->grab_x;
> + pointer->grab_x;
> move->dy = wl_fixed_from_double(shsurf->view->geometry.y) -
> - seat->pointer->grab_y;
> + pointer->grab_y;
> move->client_initiated = client_initiated;
>
> shell_grab_start(&move->base, &move_grab_interface, shsurf,
> - seat->pointer, DESKTOP_SHELL_CURSOR_MOVE);
> + pointer, DESKTOP_SHELL_CURSOR_MOVE);
>
> return 0;
> }
> @@ -1784,7 +1784,7 @@ common_surface_move(struct wl_resource *resource,
> seat->pointer->grab_serial == serial) {
> surface = weston_surface_get_main_surface(seat->pointer->focus->surface);
> if ((surface == shsurf->surface) &&
> - (surface_move(shsurf, seat, true) < 0))
> + (surface_move(shsurf, seat->pointer, true) < 0))
> wl_resource_post_no_memory(resource);
> } else if (seat->touch &&
> seat->touch->focus &&
> @@ -2035,11 +2035,12 @@ busy_cursor_grab_button(struct weston_pointer_grab *base,
> {
> struct shell_grab *grab = (struct shell_grab *) base;
> struct shell_surface *shsurf = grab->shsurf;
> - struct weston_seat *seat = grab->grab.pointer->seat;
> + struct weston_pointer *pointer = grab->grab.pointer;
> + struct weston_seat *seat = pointer->seat;
>
> if (shsurf && button == BTN_LEFT && state) {
> activate(shsurf->shell, shsurf->surface, seat, true);
> - surface_move(shsurf, seat, false);
> + surface_move(shsurf, pointer, false);
> } else if (shsurf && button == BTN_RIGHT && state) {
> activate(shsurf->shell, shsurf->surface, seat, true);
> surface_rotate(shsurf, seat);
> @@ -3052,7 +3053,7 @@ shell_interface_set_maximized(struct shell_surface *shsurf)
> static int
> shell_interface_move(struct shell_surface *shsurf, struct weston_seat *ws)
> {
> - return surface_move(shsurf, ws, true);
> + return surface_move(shsurf, ws->pointer, true);
> }
>
> static const struct weston_pointer_grab_interface popup_grab_interface;
> @@ -4663,7 +4664,7 @@ move_binding(struct weston_pointer *pointer, uint32_t time,
> shsurf->state.maximized)
> return;
>
> - surface_move(shsurf, pointer->seat, false);
> + surface_move(shsurf, pointer, false);
> }
>
> static void
> --
> 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