[weston,7/9] ivi-shell: allow to set transitions only once

Submitted by Ucan, Emre (ADITG/ESB) on May 23, 2018, 8:27 a.m.

Details

Message ID 1527064044-13395-3-git-send-email-eucan@de.adit-jv.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Ucan, Emre (ADITG/ESB) May 23, 2018, 8:27 a.m.
Transitions are only atomically set during commit_changes.
Therefore, it should not be possible to set same type of
transition to same surface/layer more than once.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
---
 ivi-shell/ivi-layout-transition.c | 74 +++++----------------------------------
 1 file changed, 9 insertions(+), 65 deletions(-)

Patch hide | download patch | download mbox

diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c
index cb11a01..13c35f1 100644
--- a/ivi-shell/ivi-layout-transition.c
+++ b/ivi-shell/ivi-layout-transition.c
@@ -416,22 +416,7 @@  ivi_layout_transition_move_resize_view(struct ivi_layout_surface *surface,
 	transition = get_transition_from_type_and_id(
 					IVI_LAYOUT_TRANSITION_VIEW_MOVE_RESIZE,
 					surface);
-	if (transition) {
-		struct move_resize_view_data *data = transition->private_data;
-		transition->time_start = 0;
-		transition->time_duration = duration;
-
-		data->start_x = start_pos[0];
-		data->start_y = start_pos[1];
-		data->end_x   = dest_x;
-		data->end_y   = dest_y;
-
-		data->start_width  = start_size[0];
-		data->start_height = start_size[1];
-		data->end_width    = dest_width;
-		data->end_height   = dest_height;
-		return;
-	}
+	assert(!transition);
 
 	transition = create_move_resize_view_transition(
 		surface,
@@ -567,25 +552,11 @@  ivi_layout_transition_visibility_on(struct ivi_layout_surface *surface,
 	bool is_visible = surface->prop.visibility;
 	wl_fixed_t dest_alpha = surface->prop.opacity;
 	struct store_alpha *user_data = NULL;
-	wl_fixed_t start_alpha = 0.0;
-	struct fade_view_data *data = NULL;
 
 	transition = get_transition_from_type_and_id(
 					IVI_LAYOUT_TRANSITION_VIEW_FADE,
 					surface);
-	if (transition) {
-		start_alpha = surface->prop.opacity;
-		user_data = transition->user_data;
-		data = transition->private_data;
-
-		transition->time_start = 0;
-		transition->time_duration = duration;
-		transition->destroy_func = visibility_on_transition_destroy;
-
-		data->start_alpha = wl_fixed_to_double(start_alpha);
-		data->end_alpha = user_data->alpha;
-		return;
-	}
+	assert(!transition);
 
 	if (is_visible)
 		return;
@@ -631,22 +602,11 @@  ivi_layout_transition_visibility_off(struct ivi_layout_surface *surface,
 	struct ivi_layout_transition *transition;
 	wl_fixed_t start_alpha = surface->prop.opacity;
 	struct store_alpha* user_data = NULL;
-	struct fade_view_data* data = NULL;
 
 	transition =
 		get_transition_from_type_and_id(IVI_LAYOUT_TRANSITION_VIEW_FADE,
 						surface);
-	if (transition) {
-		data = transition->private_data;
-
-		transition->time_start = 0;
-		transition->time_duration = duration;
-		transition->destroy_func = visibility_off_transition_destroy;
-
-		data->start_alpha = wl_fixed_to_double(start_alpha);
-		data->end_alpha = 0;
-		return;
-	}
+	assert(!transition);
 
 	user_data = malloc(sizeof(*user_data));
 	if (user_data == NULL) {
@@ -766,6 +726,11 @@  ivi_layout_transition_move_layer(struct ivi_layout_layer *layer,
 	int32_t start_pos_y = layer->prop.dest_y;
 	struct ivi_layout_transition *transition = NULL;
 
+	transition = get_transition_from_type_and_id(
+					IVI_LAYOUT_TRANSITION_LAYER_MOVE,
+					layer);
+	assert(!transition);
+
 	transition = create_move_layer_transition(
 		layer,
 		start_pos_x, start_pos_y,
@@ -843,32 +808,11 @@  ivi_layout_transition_fade_layer(
 {
 	struct ivi_layout_transition *transition;
 	struct fade_layer_data *data;
-	wl_fixed_t fixed_opacity;
-	double now_opacity;
-	double remain;
 
 	transition = get_transition_from_type_and_id(
 					IVI_LAYOUT_TRANSITION_LAYER_FADE,
 					layer);
-	if (transition) {
-		/* transition update */
-		data = transition->private_data;
-
-		/* FIXME */
-		fixed_opacity = layer->prop.opacity;
-		now_opacity = wl_fixed_to_double(fixed_opacity);
-
-		data->is_fade_in = is_fade_in;
-		data->start_alpha = now_opacity;
-		data->end_alpha = end_alpha;
-
-		remain = is_fade_in? 1.0 - now_opacity : now_opacity;
-		transition->time_start = 0;
-		transition->time_elapsed = 0;
-		transition->time_duration = duration * remain;
-
-		return;
-	}
+	assert(!transition);
 
 	transition = create_layout_transition();
 	if (transition == NULL)