Track the seat that initiated a seat instead of picking the first one.

Signed-off-by: Derek Foreman <[email protected]>
---
 desktop-shell/shell.c |  2 +-
 src/compositor.h      |  4 +++-
 src/zoom.c            | 20 +++++++-------------
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index a55eb7f..973b5b3 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4697,7 +4697,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 311bea0..48e40b9 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -157,6 +157,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_animation animation_xy;
@@ -1283,7 +1284,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 dc92ee4..d1358a2 100644
--- a/src/zoom.c
+++ b/src/zoom.c
@@ -46,6 +46,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);
                }
@@ -58,19 +59,11 @@ 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
 weston_zoom_frame_xy(struct weston_animation *animation,
                struct weston_output *output, uint32_t msecs)
 {
-       struct weston_seat *seat = weston_zoom_pick_seat(output->compositor);
+       struct weston_seat *seat = output->zoom.seat;
        wl_fixed_t x, y;
 
        if (animation->frame_counter <= 1)
@@ -174,7 +167,7 @@ weston_zoom_transition(struct weston_output *output, 
wl_fixed_t x, wl_fixed_t y)
 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;
        wl_fixed_t x = seat->pointer->x;
        wl_fixed_t y = seat->pointer->y;
 
@@ -205,14 +198,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);
@@ -222,6 +215,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.1.4

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to