Commit f8bfd058 authored by Jonny Lamb's avatar Jonny Lamb Committed by Kristian Høgsberg

animation: ensure repaints are always scheduled during animations

Animations are run off the repaint cycle so if there's nothing to
repaint, an animation will stop running. This is usually not a problem
as each frame function of an animation causes something to change and
therefore a repaint to happen. This patch helps detect when the
animation isn't in said case and triggers a repaint to keep the
animation running.

This problem was found by using weston_move_scale_run() to move a view
onscreen from completely off. The very first time the animation frame
function was called the progress wasn't enough to move it into
view. The compositor saw there was nothing to repaint and stopped
doing anything else. When something else (like a pointer move) forced
a redraw, the view's position was very much onscreen and jumped into
view in an ugly way.
parent 5905ebcc
......@@ -161,6 +161,8 @@ weston_view_animation_frame(struct weston_animation *base,
struct weston_view_animation *animation =
struct weston_view_animation, animation);
struct weston_compositor *compositor =
if (base->frame_counter <= 1)
animation->spring.timestamp = msecs;
......@@ -178,6 +180,15 @@ weston_view_animation_frame(struct weston_animation *base,
/* 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)
static struct weston_view_animation *
......@@ -40,6 +40,11 @@ weston_view_schedule_repaint(struct weston_view *view)
weston_compositor_schedule_repaint(struct weston_compositor *compositor)
main(int argc, char *argv[])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment