summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2014-05-22 22:41:33 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-06-25 16:30:42 +0300
commit4d7338e121f14b696d66737fa0c2dc7a42287b38 (patch)
tree6f750570f93f74acfe3be0e46eb6fbdb53f4788a
parent5995d5ab3ba8abc4b8c7767c5b923aa7f0184153 (diff)
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.
-rw-r--r--src/animation.c11
-rw-r--r--src/spring-tool.c5
2 files changed, 16 insertions, 0 deletions
diff --git a/src/animation.c b/src/animation.c
index 392e32dc..5ded3adc 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -161,6 +161,8 @@ weston_view_animation_frame(struct weston_animation *base,
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;
@@ -178,6 +180,15 @@ weston_view_animation_frame(struct weston_animation *base,
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);
}
static struct weston_view_animation *
diff --git a/src/spring-tool.c b/src/spring-tool.c
index 41cc52ce..685bfd9f 100644
--- a/src/spring-tool.c
+++ b/src/spring-tool.c
@@ -40,6 +40,11 @@ weston_view_schedule_repaint(struct weston_view *view)
{
}
+WL_EXPORT void
+weston_compositor_schedule_repaint(struct weston_compositor *compositor)
+{
+}
+
int
main(int argc, char *argv[])
{