[PATCH v2 weston] zoom: Store the seat that initiated a zoom
Bryce Harrington
bryce at osg.samsung.com
Wed Jul 29 19:57:38 PDT 2015
On Mon, Jul 27, 2015 at 01:09:34PM -0500, Derek Foreman wrote:
> Track the seat that initiated a zoom instead of picking the first one.
>
> Previously, if there are multiple seats then any seat can adjust the zoom
> level but the zoom tracks the first seat's pointer.
>
> Now the zoom will follow the pointer of the seat that initiated the zoom.
>
> Additionally, if there's no pointer in the first seat, starting a zoom
> with the second seat will no longer crash weston.
>
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
Pushed:
To ssh://git.freedesktop.org/git/wayland/weston
25bd8a7..22276a5 master -> master
> ---
>
> Fixed a typo in the commit log
>
> desktop-shell/shell.c | 2 +-
> src/compositor.h | 4 +++-
> src/zoom.c | 17 ++++++-----------
> 3 files changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index 48bee34..dec9169 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -4808,7 +4808,7 @@ do_zoom(struct weston_seat *seat, uint32_t time, uint32_t key, uint32_t axis,
> if (!output->zoom.active) {
> if (output->zoom.level <= 0.0)
> continue;
> - weston_output_activate_zoom(output);
> + weston_output_activate_zoom(output, seat);
> }
>
> output->zoom.spring_z.target = output->zoom.level;
> diff --git a/src/compositor.h b/src/compositor.h
> index b69547f..b74f7e8 100644
> --- a/src/compositor.h
> +++ b/src/compositor.h
> @@ -152,6 +152,7 @@ struct weston_output_zoom {
> float level;
> float max_level;
> float trans_x, trans_y;
> + struct weston_seat *seat;
> struct weston_animation animation_z;
> struct weston_spring spring_z;
> struct weston_fixed_point current;
> @@ -1370,7 +1371,8 @@ weston_output_init_zoom(struct weston_output *output);
> void
> weston_output_update_zoom(struct weston_output *output);
> void
> -weston_output_activate_zoom(struct weston_output *output);
> +weston_output_activate_zoom(struct weston_output *output,
> + struct weston_seat *seat);
> void
> weston_output_update_matrix(struct weston_output *output);
> void
> diff --git a/src/zoom.c b/src/zoom.c
> index 18fc7ca..efc658c 100644
> --- a/src/zoom.c
> +++ b/src/zoom.c
> @@ -50,6 +50,7 @@ weston_zoom_frame_z(struct weston_animation *animation,
> if (weston_spring_done(&output->zoom.spring_z)) {
> if (output->zoom.active && output->zoom.level <= 0.0) {
> output->zoom.active = false;
> + output->zoom.seat = NULL;
> output->disable_planes--;
> wl_list_remove(&output->zoom.motion_listener.link);
> }
> @@ -62,13 +63,6 @@ weston_zoom_frame_z(struct weston_animation *animation,
> weston_output_damage(output);
> }
>
> -static struct weston_seat *
> -weston_zoom_pick_seat(struct weston_compositor *compositor)
> -{
> - return container_of(compositor->seat_list.next,
> - struct weston_seat, link);
> -}
> -
> static void
> zoom_area_center_from_point(struct weston_output *output,
> wl_fixed_t *x, wl_fixed_t *y)
> @@ -134,7 +128,7 @@ weston_zoom_transition(struct weston_output *output)
> WL_EXPORT void
> weston_output_update_zoom(struct weston_output *output)
> {
> - struct weston_seat *seat = weston_zoom_pick_seat(output->compositor);
> + struct weston_seat *seat = output->zoom.seat;
>
> assert(output->zoom.active);
>
> @@ -157,14 +151,14 @@ motion(struct wl_listener *listener, void *data)
> }
>
> WL_EXPORT void
> -weston_output_activate_zoom(struct weston_output *output)
> +weston_output_activate_zoom(struct weston_output *output,
> + struct weston_seat *seat)
> {
> - struct weston_seat *seat = weston_zoom_pick_seat(output->compositor);
> -
> if (output->zoom.active)
> return;
>
> output->zoom.active = true;
> + output->zoom.seat = seat;
> output->disable_planes++;
> wl_signal_add(&seat->pointer->motion_signal,
> &output->zoom.motion_listener);
> @@ -174,6 +168,7 @@ WL_EXPORT void
> weston_output_init_zoom(struct weston_output *output)
> {
> output->zoom.active = false;
> + output->zoom.seat = NULL;
> output->zoom.increment = 0.07;
> output->zoom.max_level = 0.95;
> output->zoom.level = 0.0;
> --
> 2.4.6
More information about the wayland-devel
mailing list