libweston: Add move (without scale) animation

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
diff --git a/libweston/animation.c b/libweston/animation.c
index 24fc4ad..914135a 100644
--- a/libweston/animation.c
+++ b/libweston/animation.c
@@ -434,7 +434,8 @@
 struct weston_move_animation {
 	int dx;
 	int dy;
-	int reverse;
+	bool reverse;
+	bool scale;
 	weston_view_animation_done_func_t done;
 };
 
@@ -452,7 +453,9 @@
                 (animation->stop - animation->start) *
                 progress;
 	weston_matrix_init(&animation->transform.matrix);
-	weston_matrix_scale(&animation->transform.matrix, scale, scale, 1.0f);
+	if (move->scale)
+		weston_matrix_scale(&animation->transform.matrix, scale, scale,
+				    1.0f);
 	weston_matrix_translate(&animation->transform.matrix,
                                 move->dx * progress, move->dy * progress,
 				0);
@@ -469,10 +472,11 @@
 	free(move);
 }
 
-WL_EXPORT struct weston_view_animation *
-weston_move_scale_run(struct weston_view *view, int dx, int dy,
-		      float start, float end, int reverse,
-		      weston_view_animation_done_func_t done, void *data)
+static struct weston_view_animation *
+weston_move_scale_run_internal(struct weston_view *view, int dx, int dy,
+			       float start, float end, bool reverse, bool scale,
+			       weston_view_animation_done_func_t done,
+			       void *data)
 {
 	struct weston_move_animation *move;
 	struct weston_view_animation *animation;
@@ -483,6 +487,7 @@
 	move->dx = dx;
 	move->dy = dy;
 	move->reverse = reverse;
+	move->scale = scale;
 	move->done = done;
 
 	animation = weston_view_animation_create(view, start, end, move_frame,
@@ -500,3 +505,21 @@
 
 	return animation;
 }
+
+WL_EXPORT struct weston_view_animation *
+weston_move_scale_run(struct weston_view *view, int dx, int dy,
+		      float start, float end, bool reverse,
+		      weston_view_animation_done_func_t done, void *data)
+{
+	return weston_move_scale_run_internal(view, dx, dy, start, end, reverse,
+					      true, done, data);
+}
+
+WL_EXPORT struct weston_view_animation *
+weston_move_run(struct weston_view *view, int dx, int dy,
+		float start, float end, bool reverse,
+		weston_view_animation_done_func_t done, void *data)
+{
+	return weston_move_scale_run_internal(view, dx, dy, start, end, reverse,
+					      false, done, data);
+}
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 534c8c2..c78cc3b 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1707,9 +1707,14 @@
 
 struct weston_view_animation *
 weston_move_scale_run(struct weston_view *view, int dx, int dy,
-		      float start, float end, int reverse,
+		      float start, float end, bool reverse,
 		      weston_view_animation_done_func_t done, void *data);
 
+struct weston_view_animation *
+weston_move_run(struct weston_view *view, int dx, int dy,
+		float start, float end, bool reverse,
+		weston_view_animation_done_func_t done, void *data);
+
 void
 weston_fade_update(struct weston_view_animation *fade, float target);