[PATCH weston v2 06/14] ivi-shell: remove ivi_layout_layer_get_position API

Ucan, Emre (ADITG/SW1) eucan at de.adit-jv.com
Fri Mar 4 12:50:24 UTC 2016


Signed-off-by: Emre Ucan <eucan at de.adit-jv.com>
---
 ivi-shell/hmi-controller.c        |   11 ++++++++---
 ivi-shell/ivi-layout-export.h     |    9 ---------
 ivi-shell/ivi-layout-private.h    |    3 ---
 ivi-shell/ivi-layout-transition.c |    6 ++----
 ivi-shell/ivi-layout.c            |   16 ----------------
 tests/ivi_layout-internal-test.c  |   33 +++++----------------------------
 6 files changed, 15 insertions(+), 63 deletions(-)

diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
index 8da3d3c..e97fa0a 100644
--- a/ivi-shell/hmi-controller.c
+++ b/ivi-shell/hmi-controller.c
@@ -1423,6 +1423,7 @@ move_workspace_grab_end(struct move_grab *move, struct wl_resource* resource,
 {
 	struct hmi_controller *hmi_ctrl = wl_resource_get_user_data(resource);
 	int32_t width = hmi_ctrl->workspace_background_layer.width;
+	const struct ivi_layout_layer_properties *prop;
 
 	struct timespec time = {0};
 	double grab_time = 0.0;
@@ -1449,8 +1450,9 @@ move_workspace_grab_end(struct move_grab *move, struct wl_resource* resource,
 	if (200 < from_motion_time)
 		pointer_v = 0.0;
 
-	ivi_layout_interface->layer_get_position(layer, &pos_x, &pos_y);
-
+	prop = ivi_layout_interface->get_properties_of_layer(layer);
+	pos_x = prop->dest_x;
+	pos_y = prop->dest_y;
 
 	if (is_flick) {
 		int orgx = wl_fixed_to_int(move->dst[0] + grab_x);
@@ -1739,6 +1741,7 @@ move_grab_init_workspace(struct move_grab* move,
 {
 	struct hmi_controller *hmi_ctrl = wl_resource_get_user_data(resource);
 	struct ivi_layout_layer *layer = hmi_ctrl->workspace_layer.ivilayer;
+	const struct ivi_layout_layer_properties *prop;
 	int32_t workspace_count = hmi_ctrl->workspace_count;
 	int32_t workspace_width = hmi_ctrl->workspace_background_layer.width;
 	int32_t layer_pos_x = 0;
@@ -1747,7 +1750,9 @@ move_grab_init_workspace(struct move_grab* move,
 	wl_fixed_t rgn[2][2] = {{0}};
 	wl_fixed_t grab_pos[2] = { grab_x, grab_y };
 
-	ivi_layout_interface->layer_get_position(layer, &layer_pos_x, &layer_pos_y);
+	prop = ivi_layout_interface->get_properties_of_layer(layer);
+	layer_pos_x = prop->dest_x;
+	layer_pos_y = prop->dest_y;
 
 	start_pos[0] = wl_fixed_from_int(layer_pos_x);
 	start_pos[1] = wl_fixed_from_int(layer_pos_y);
diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
index 4dbac50..6428ef0 100644
--- a/ivi-shell/ivi-layout-export.h
+++ b/ivi-shell/ivi-layout-export.h
@@ -555,15 +555,6 @@ struct ivi_layout_interface {
 				      int32_t dest_x, int32_t dest_y);
 
 	/**
-	 * \brief Get the horizontal and vertical position of the ivi_layer.
-	 *
-	 * \return IVI_SUCCEEDED if the method call was successful
-	 * \return IVI_FAILED if the method call was failed
-	 */
-	int32_t (*layer_get_position)(struct ivi_layout_layer *ivilayer,
-				      int32_t *dest_x, int32_t *dest_y);
-
-	/**
 	 * \brief Set the horizontal and vertical dimension of the layer.
 	 *
 	 * \return IVI_SUCCEEDED if the method call was successful
diff --git a/ivi-shell/ivi-layout-private.h b/ivi-shell/ivi-layout-private.h
index 9f0ca79..913bb0c 100644
--- a/ivi-shell/ivi-layout-private.h
+++ b/ivi-shell/ivi-layout-private.h
@@ -206,9 +206,6 @@ int32_t
 ivi_layout_layer_set_position(struct ivi_layout_layer *ivilayer,
 			      int32_t dest_x, int32_t dest_y);
 int32_t
-ivi_layout_layer_get_position(struct ivi_layout_layer *ivilayer,
-			      int32_t *dest_x, int32_t *dest_y);
-int32_t
 ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
 				  struct ivi_layout_surface **pSurface,
 				  int32_t number);
diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c
index 529bd56..df6112d 100644
--- a/ivi-shell/ivi-layout-transition.c
+++ b/ivi-shell/ivi-layout-transition.c
@@ -736,12 +736,10 @@ ivi_layout_transition_move_layer(struct ivi_layout_layer *layer,
 				 int32_t dest_x, int32_t dest_y,
 				 uint32_t duration)
 {
-	int32_t start_pos_x = 0;
-	int32_t start_pos_y = 0;
+	int32_t start_pos_x = layer->prop.dest_x;
+	int32_t start_pos_y = layer->prop.dest_y;
 	struct ivi_layout_transition *transition = NULL;
 
-	ivi_layout_layer_get_position(layer, &start_pos_x, &start_pos_y);
-
 	transition = create_move_layer_transition(
 		layer,
 		start_pos_x, start_pos_y,
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 81fea95..8119af4 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -1907,21 +1907,6 @@ ivi_layout_layer_set_dimension(struct ivi_layout_layer *ivilayer,
 }
 
 int32_t
-ivi_layout_layer_get_position(struct ivi_layout_layer *ivilayer,
-			      int32_t *dest_x, int32_t *dest_y)
-{
-	if (ivilayer == NULL || dest_x == NULL || dest_y == NULL) {
-		weston_log("ivi_layout_layer_get_position: invalid argument\n");
-		return IVI_FAILED;
-	}
-
-	*dest_x = ivilayer->prop.dest_x;
-	*dest_y = ivilayer->prop.dest_y;
-
-	return IVI_SUCCEEDED;
-}
-
-int32_t
 ivi_layout_layer_set_position(struct ivi_layout_layer *ivilayer,
 			      int32_t dest_x, int32_t dest_y)
 {
@@ -2723,7 +2708,6 @@ static struct ivi_layout_interface ivi_layout_interface = {
 	.layer_set_source_rectangle		= ivi_layout_layer_set_source_rectangle,
 	.layer_set_destination_rectangle	= ivi_layout_layer_set_destination_rectangle,
 	.layer_set_position			= ivi_layout_layer_set_position,
-	.layer_get_position			= ivi_layout_layer_get_position,
 	.layer_set_dimension			= ivi_layout_layer_set_dimension,
 	.layer_get_dimension			= ivi_layout_layer_get_dimension,
 	.layer_set_orientation			= ivi_layout_layer_set_orientation,
diff --git a/tests/ivi_layout-internal-test.c b/tests/ivi_layout-internal-test.c
index cb34fc1..2c52ed4 100644
--- a/tests/ivi_layout-internal-test.c
+++ b/tests/ivi_layout-internal-test.c
@@ -281,31 +281,21 @@ test_layer_position(struct test_context *ctx)
 	const struct ivi_layout_interface *lyt = ctx->layout_interface;
 	struct ivi_layout_layer *ivilayer;
 	const struct ivi_layout_layer_properties *prop;
-	int32_t dest_x;
-	int32_t dest_y;
 
 	ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
 	iassert(ivilayer != NULL);
 
-	iassert(lyt->layer_get_position(
-		ivilayer, &dest_x, &dest_y) == IVI_SUCCEEDED);
-	iassert(dest_x == 0);
-	iassert(dest_y == 0);
+	prop = lyt->get_properties_of_layer(ivilayer);
+	iassert(prop->dest_x == 0);
+	iassert(prop->dest_y == 0);
 
 	iassert(lyt->layer_set_position(ivilayer, 20, 30) == IVI_SUCCEEDED);
 
-	iassert(lyt->layer_get_position(
-		ivilayer, &dest_x, &dest_y) == IVI_SUCCEEDED);
-	iassert(dest_x == 0);
-	iassert(dest_y == 0);
+	iassert(prop->dest_x == 0);
+	iassert(prop->dest_y == 0);
 
 	lyt->commit_changes();
 
-	iassert(lyt->layer_get_position(
-		ivilayer, &dest_x, &dest_y) == IVI_SUCCEEDED);
-	iassert(dest_x == 20);
-	iassert(dest_y == 30);
-
 	prop = lyt->get_properties_of_layer(ivilayer);
 	iassert(prop->dest_x == 20);
 	iassert(prop->dest_y == 30);
@@ -321,8 +311,6 @@ test_layer_destination_rectangle(struct test_context *ctx)
 	const struct ivi_layout_layer_properties *prop;
 	int32_t dest_width;
 	int32_t dest_height;
-	int32_t dest_x;
-	int32_t dest_y;
 
 	ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
 	iassert(ivilayer != NULL);
@@ -349,11 +337,6 @@ test_layer_destination_rectangle(struct test_context *ctx)
 	iassert(dest_width == 400);
 	iassert(dest_height == 600);
 
-	iassert(lyt->layer_get_position(
-		ivilayer, &dest_x, &dest_y) == IVI_SUCCEEDED);
-	iassert(dest_x == 20);
-	iassert(dest_y == 30);
-
 	prop = lyt->get_properties_of_layer(ivilayer);
 	iassert(prop->dest_width == 400);
 	iassert(prop->dest_height == 600);
@@ -507,8 +490,6 @@ test_layer_bad_position(struct test_context *ctx)
 {
 	const struct ivi_layout_interface *lyt = ctx->layout_interface;
 	struct ivi_layout_layer *ivilayer;
-	int32_t dest_x;
-	int32_t dest_y;
 
 	ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
 	iassert(ivilayer != NULL);
@@ -517,10 +498,6 @@ test_layer_bad_position(struct test_context *ctx)
 
 	lyt->commit_changes();
 
-	iassert(lyt->layer_get_position(NULL, &dest_x, &dest_y) == IVI_FAILED);
-	iassert(lyt->layer_get_position(ivilayer, NULL, &dest_y) == IVI_FAILED);
-	iassert(lyt->layer_get_position(ivilayer, &dest_x, NULL) == IVI_FAILED);
-
 	lyt->layer_destroy(ivilayer);
 }
 
-- 
1.7.9.5



More information about the wayland-devel mailing list