static void weston_view_animation_frame(struct weston_animation *base, struct weston_output *output, uint32_t msecs) { struct weston_view_animation *animation = container_of(base, struct weston_view_animation, animation); if (base->frame_counter <= 1) animation->spring.timestamp = msecs; weston_spring_update(&animation->spring, msecs); if (weston_spring_done(&animation->spring)) { weston_view_schedule_repaint(animation->view); weston_view_animation_destroy(animation); return; } if (animation->frame) animation->frame(animation); weston_view_geometry_dirty(animation->view); weston_view_schedule_repaint(animation->view); }
static void drag_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time, int touch_id, wl_fixed_t sx, wl_fixed_t sy) { struct weston_touch_drag *touch_drag = container_of(grab, struct weston_touch_drag, grab); struct weston_touch *touch = grab->touch; wl_fixed_t view_x, view_y; float fx, fy; if (touch_id != touch->grab_touch_id) return; drag_grab_touch_focus(touch_drag); if (touch_drag->base.icon) { fx = wl_fixed_to_double(touch->grab_x) + touch_drag->base.dx; fy = wl_fixed_to_double(touch->grab_y) + touch_drag->base.dy; weston_view_set_position(touch_drag->base.icon, fx, fy); weston_view_schedule_repaint(touch_drag->base.icon); } if (touch_drag->base.focus_resource) { weston_view_from_global_fixed(touch_drag->base.focus, touch->grab_x, touch->grab_y, &view_x, &view_y); wl_data_device_send_motion(touch_drag->base.focus_resource, time, view_x, view_y); } }
static void drag_grab_motion(struct weston_pointer_grab *grab, uint32_t time, wl_fixed_t x, wl_fixed_t y) { struct weston_pointer_drag *drag = container_of(grab, struct weston_pointer_drag, grab); struct weston_pointer *pointer = drag->grab.pointer; float fx, fy; wl_fixed_t sx, sy; weston_pointer_move(pointer, x, y); if (drag->base.icon) { fx = wl_fixed_to_double(pointer->x) + drag->base.dx; fy = wl_fixed_to_double(pointer->y) + drag->base.dy; weston_view_set_position(drag->base.icon, fx, fy); weston_view_schedule_repaint(drag->base.icon); } if (drag->base.focus_resource) { weston_view_from_global_fixed(drag->base.focus, pointer->x, pointer->y, &sx, &sy); wl_data_device_send_motion(drag->base.focus_resource, time, sx, sy); } }
static void weston_view_animation_frame(struct weston_animation *base, struct weston_output *output, uint32_t msecs) { struct weston_view_animation *animation = container_of(base, struct weston_view_animation, animation); struct weston_compositor *compositor = animation->view->surface->compositor; if (base->frame_counter <= 1) animation->spring.timestamp = msecs; weston_spring_update(&animation->spring, msecs); if (weston_spring_done(&animation->spring)) { weston_view_schedule_repaint(animation->view); weston_view_animation_destroy(animation); return; } if (animation->frame) animation->frame(animation); weston_view_geometry_dirty(animation->view); weston_view_schedule_repaint(animation->view); /* The view's output_mask will be zero if its position is * offscreen. Animations should always run but as they are also * run off the repaint cycle, if there's nothing to repaint * the animation stops running. Therefore if we catch this situation * and schedule a repaint on all outputs it will be avoided. */ if (animation->view->output_mask == 0) weston_compositor_schedule_repaint(compositor); }