struct weston_fixed_point from;
struct weston_fixed_point to;
struct weston_fixed_point current;
+ struct wl_listener motion_listener;
};
/* bit compatible with drm definitions. */
void
weston_output_update_zoom(struct weston_output *output);
void
+weston_output_activate_zoom(struct weston_output *output);
+void
weston_output_update_matrix(struct weston_output *output);
void
weston_output_move(struct weston_output *output, int x, int y);
static void
move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y)
{
- struct weston_compositor *ec = seat->compositor;
struct weston_pointer *pointer = seat->pointer;
- struct weston_output *output;
int32_t ix, iy;
weston_pointer_clamp (pointer, &x, &y);
ix = wl_fixed_to_int(x);
iy = wl_fixed_to_int(y);
- wl_list_for_each(output, &ec->output_list, link)
- if (output->zoom.active &&
- pixman_region32_contains_point(&output->region,
- ix, iy, NULL))
- weston_output_update_zoom(output);
-
if (pointer->sprite) {
weston_view_set_position(pointer->sprite,
ix - pointer->hotspot_x,
else if (output->zoom.level > output->zoom.max_level)
output->zoom.level = output->zoom.max_level;
else if (!output->zoom.active) {
- output->zoom.active = 1;
- output->disable_planes++;
+ weston_output_activate_zoom(output);
}
output->zoom.spring_z.target = output->zoom.level;
if (output->zoom.active && output->zoom.level <= 0.0) {
output->zoom.active = 0;
output->disable_planes--;
+ wl_list_remove(&output->zoom.motion_listener.link);
}
output->zoom.spring_z.current = output->zoom.level;
wl_list_remove(&animation->link);
weston_output_update_zoom_transform(output);
}
+static void
+motion(struct wl_listener *listener, void *data)
+{
+ struct weston_output_zoom *zoom =
+ container_of(listener, struct weston_output_zoom, motion_listener);
+ struct weston_output *output =
+ container_of(zoom, struct weston_output, zoom);
+
+ weston_output_update_zoom(output);
+}
+
+WL_EXPORT void
+weston_output_activate_zoom(struct weston_output *output)
+{
+ struct weston_seat *seat = weston_zoom_pick_seat(output->compositor);
+
+ if (output->zoom.active)
+ return;
+
+ output->zoom.active = 1;
+ output->disable_planes++;
+ wl_signal_add(&seat->pointer->motion_signal,
+ &output->zoom.motion_listener);
+}
+
WL_EXPORT void
weston_output_init_zoom(struct weston_output *output)
{
output->zoom.spring_xy.friction = 1000;
output->zoom.animation_xy.frame = weston_zoom_frame_xy;
wl_list_init(&output->zoom.animation_xy.link);
+ output->zoom.motion_listener.notify = motion;
}