ivi-shell: rename ivi_controller_interface

The name of ivi_controller_interface is changed to ivi_layout_interface
with this patch.

This name is better suited to the interface, because it is implemented
in ivi-layout.c and its methods are linked to ivi_layout* functions.

Furthermore, the controller modules (e.g. hmi-controller) are the users
of this interface and they have their own interfaces,
which are called *_controller_interface,
e.g.: ivi_hmi_controller_interface.

This causes confusion about the software architecture.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
index 5cc76d3..d1ed872 100644
--- a/ivi-shell/hmi-controller.c
+++ b/ivi-shell/hmi-controller.c
@@ -132,12 +132,12 @@
 	int32_t index;
 };
 
-const struct ivi_controller_interface *ivi_controller_interface;
+const struct ivi_layout_interface *ivi_layout_interface;
 
 int
 controller_module_init(struct weston_compositor *ec,
 		       int *argc, char *argv[],
-		       const struct ivi_controller_interface *interface,
+		       const struct ivi_layout_interface *interface,
 		       size_t interface_version);
 
 /*****************************************************************************
@@ -166,7 +166,7 @@
 is_surf_in_ui_widget(struct hmi_controller *hmi_ctrl,
 		     struct ivi_layout_surface *ivisurf)
 {
-	uint32_t id = ivi_controller_interface->get_id_of_surface(ivisurf);
+	uint32_t id = ivi_layout_interface->get_id_of_surface(ivisurf);
 
 	uint32_t *ui_widget_id = NULL;
 	wl_array_for_each(ui_widget_id, &hmi_ctrl->ui_widgets) {
@@ -247,11 +247,11 @@
 				surface_y = (int32_t)surface_height;
 			}
 
-			ivi_controller_interface->surface_set_transition(ivisurf,
+			ivi_layout_interface->surface_set_transition(ivisurf,
 					IVI_LAYOUT_TRANSITION_VIEW_DEFAULT,
 					duration);
-			ivi_controller_interface->surface_set_visibility(ivisurf, true);
-			ivi_controller_interface->surface_set_destination_rectangle(ivisurf,
+			ivi_layout_interface->surface_set_visibility(ivisurf, true);
+			ivi_layout_interface->surface_set_destination_rectangle(ivisurf,
 					surface_x, surface_y,
 					(int32_t)surface_width,
 					(int32_t)surface_height);
@@ -259,11 +259,11 @@
 			num++;
 			continue;
 		}
-		ivi_controller_interface->surface_set_visibility(ivisurf, false);
+		ivi_layout_interface->surface_set_visibility(ivisurf, false);
 	}
 
 	if (surf_num > 0) {
-		ivi_controller_interface->layer_set_transition(layer->ivilayer,
+		ivi_layout_interface->layer_set_transition(layer->ivilayer,
 				IVI_LAYOUT_TRANSITION_LAYER_VIEW_ORDER,
 				duration);
 	}
@@ -294,11 +294,11 @@
 			continue;
 
 		if (num == 1) {
-			ivi_controller_interface->surface_set_transition(ivisurf,
+			ivi_layout_interface->surface_set_transition(ivisurf,
 					IVI_LAYOUT_TRANSITION_VIEW_DEFAULT,
 					duration);
-			ivi_controller_interface->surface_set_visibility(ivisurf, true);
-			ivi_controller_interface->surface_set_destination_rectangle(ivisurf,
+			ivi_layout_interface->surface_set_visibility(ivisurf, true);
+			ivi_layout_interface->surface_set_destination_rectangle(ivisurf,
 							0, 0,
 							surface_width,
 							surface_height);
@@ -306,11 +306,11 @@
 			num++;
 			continue;
 		} else if (num == 2) {
-			ivi_controller_interface->surface_set_transition(ivisurf,
+			ivi_layout_interface->surface_set_transition(ivisurf,
 					IVI_LAYOUT_TRANSITION_VIEW_DEFAULT,
 					duration);
-			ivi_controller_interface->surface_set_visibility(ivisurf, true);
-			ivi_controller_interface->surface_set_destination_rectangle(ivisurf,
+			ivi_layout_interface->surface_set_visibility(ivisurf, true);
+			ivi_layout_interface->surface_set_destination_rectangle(ivisurf,
 							surface_width, 0,
 							surface_width,
 							surface_height);
@@ -318,10 +318,10 @@
 			num++;
 			continue;
 		}
-		ivi_controller_interface->surface_set_transition(ivisurf,
+		ivi_layout_interface->surface_set_transition(ivisurf,
 					IVI_LAYOUT_TRANSITION_VIEW_FADE_ONLY,
 					duration);
-		ivi_controller_interface->surface_set_visibility(ivisurf, false);
+		ivi_layout_interface->surface_set_visibility(ivisurf, false);
 	}
 }
 
@@ -344,11 +344,11 @@
 		if (is_surf_in_ui_widget(hmi_ctrl, ivisurf))
 			continue;
 
-		ivi_controller_interface->surface_set_transition(ivisurf,
+		ivi_layout_interface->surface_set_transition(ivisurf,
 					IVI_LAYOUT_TRANSITION_VIEW_DEFAULT,
 					duration);
-		ivi_controller_interface->surface_set_visibility(ivisurf, true);
-		ivi_controller_interface->surface_set_destination_rectangle(ivisurf, 0, 0,
+		ivi_layout_interface->surface_set_visibility(ivisurf, true);
+		ivi_layout_interface->surface_set_destination_rectangle(ivisurf, 0, 0,
 							     surface_width,
 							     surface_height);
 	}
@@ -375,14 +375,14 @@
 		if (is_surf_in_ui_widget(hmi_ctrl, ivisurf))
 			continue;
 
-		ivi_controller_interface->surface_set_transition(ivisurf,
+		ivi_layout_interface->surface_set_transition(ivisurf,
 					IVI_LAYOUT_TRANSITION_VIEW_DEFAULT,
 					duration);
-		ivi_controller_interface->surface_set_visibility(ivisurf, true);
+		ivi_layout_interface->surface_set_visibility(ivisurf, true);
 		surface_x = rand() % (layer->width - surface_width);
 		surface_y = rand() % (layer->height - surface_height);
 
-		ivi_controller_interface->surface_set_destination_rectangle(ivisurf,
+		ivi_layout_interface->surface_set_destination_rectangle(ivisurf,
 							     surface_x,
 							     surface_y,
 							     surface_width,
@@ -429,7 +429,7 @@
 
 	hmi_ctrl->layout_mode = layout_mode;
 
-	ret = ivi_controller_interface->get_surfaces(&surface_length, &pp_surface);
+	ret = ivi_layout_interface->get_surfaces(&surface_length, &pp_surface);
 	assert(!ret);
 
 	if (!has_application_surface(hmi_ctrl, pp_surface, surface_length)) {
@@ -457,7 +457,7 @@
 		break;
 	}
 
-	ivi_controller_interface->commit_changes();
+	ivi_layout_interface->commit_changes();
 	free(pp_surface);
 }
 
@@ -475,10 +475,10 @@
 	fade->is_fade_in = is_fade_in;
 
 	wl_list_for_each(linklayer, &fade->layer_list, link) {
-		ivi_controller_interface->layer_set_transition(linklayer->layout_layer,
+		ivi_layout_interface->layer_set_transition(linklayer->layout_layer,
 					IVI_LAYOUT_TRANSITION_LAYER_FADE,
 					duration);
-		ivi_controller_interface->layer_set_fade_info(linklayer->layout_layer,
+		ivi_layout_interface->layer_set_fade_info(linklayer->layout_layer,
 					is_fade_in, 1.0 - tint, tint);
 	}
 }
@@ -494,21 +494,21 @@
 	int32_t ret = 0;
 
 	layer->ivilayer =
-		ivi_controller_interface->layer_create_with_dimension(layer->id_layer,
+		ivi_layout_interface->layer_create_with_dimension(layer->id_layer,
 						       layer->width,
 						       layer->height);
 	assert(layer->ivilayer != NULL);
 
-	ret = ivi_controller_interface->screen_add_layer(iviscrn, layer->ivilayer);
+	ret = ivi_layout_interface->screen_add_layer(iviscrn, layer->ivilayer);
 	assert(!ret);
 
-	ret = ivi_controller_interface->layer_set_destination_rectangle(layer->ivilayer,
+	ret = ivi_layout_interface->layer_set_destination_rectangle(layer->ivilayer,
 							 layer->x, layer->y,
 							 layer->width,
 							 layer->height);
 	assert(!ret);
 
-	ret = ivi_controller_interface->layer_set_visibility(layer->ivilayer, true);
+	ret = ivi_layout_interface->layer_set_visibility(layer->ivilayer, true);
 	assert(!ret);
 }
 
@@ -528,7 +528,7 @@
 	if (is_surf_in_ui_widget(hmi_ctrl, ivisurf))
 		return;
 
-	ret = ivi_controller_interface->layer_add_surface(application_layer, ivisurf);
+	ret = ivi_layout_interface->layer_add_surface(application_layer, ivisurf);
 	assert(!ret);
 }
 
@@ -562,9 +562,9 @@
 	 * if application changes size of wl_buffer. The source rectangle shall be
 	 * fit to the size.
 	 */
-	surface = ivi_controller_interface->surface_get_weston_surface(ivisurf);
+	surface = ivi_layout_interface->surface_get_weston_surface(ivisurf);
 	if (surface) {
-		ivi_controller_interface->surface_set_source_rectangle(
+		ivi_layout_interface->surface_set_source_rectangle(
 			ivisurf, 0, 0, surface->width,
 			surface->height);
 	}
@@ -573,7 +573,7 @@
 	 *  search if the surface is already added to layer.
 	 *  If not yet, it is newly invoded application to go to switch_mode.
 	 */
-	ivi_controller_interface->get_surfaces_on_layer(application_layer,
+	ivi_layout_interface->get_surfaces_on_layer(application_layer,
 							&length, &ivisurfs);
 	for (i = 0; i < length; i++) {
 		if (ivisurf == ivisurfs[i]) {
@@ -581,7 +581,7 @@
 			 * if it is non new invoked application, just call
 			 * commit_changes to apply source_rectangle.
 			 */
-			ivi_controller_interface->commit_changes();
+			ivi_layout_interface->commit_changes();
 			return;
 		}
 	}
@@ -681,11 +681,11 @@
 	hmi_ctrl->hmi_setting = hmi_server_setting_create(ec);
 	hmi_ctrl->compositor = ec;
 
-	ivi_controller_interface->get_screens(&screen_length, &pp_screen);
+	ivi_layout_interface->get_screens(&screen_length, &pp_screen);
 
 	iviscrn = pp_screen[0];
 
-	ivi_controller_interface->get_screen_resolution(iviscrn, &screen_width,
+	ivi_layout_interface->get_screen_resolution(iviscrn, &screen_width,
 					 &screen_height);
 
 	/* init base ivi_layer*/
@@ -720,9 +720,9 @@
 		hmi_ctrl->hmi_setting->workspace_background_layer_id;
 
 	create_layer(iviscrn, &hmi_ctrl->workspace_background_layer);
-	ivi_controller_interface->layer_set_opacity(
+	ivi_layout_interface->layer_set_opacity(
 		hmi_ctrl->workspace_background_layer.ivilayer, 0);
-	ivi_controller_interface->layer_set_visibility(
+	ivi_layout_interface->layer_set_visibility(
 		hmi_ctrl->workspace_background_layer.ivilayer, false);
 
 
@@ -733,11 +733,11 @@
 	wl_list_insert(&hmi_ctrl->workspace_fade.layer_list,
 		       &tmp_link_layer->link);
 
-	ivi_controller_interface->add_notification_create_surface(
+	ivi_layout_interface->add_notification_create_surface(
 		set_notification_create_surface, hmi_ctrl);
-	ivi_controller_interface->add_notification_remove_surface(
+	ivi_layout_interface->add_notification_remove_surface(
 		set_notification_remove_surface, hmi_ctrl);
-	ivi_controller_interface->add_notification_configure_surface(
+	ivi_layout_interface->add_notification_configure_surface(
 		set_notification_configure_surface, hmi_ctrl);
 
 	hmi_ctrl->destroy_listener.notify = hmi_controller_destroy;
@@ -777,17 +777,17 @@
 						sizeof(*add_surface_id));
 	*add_surface_id = id_surface;
 
-	ivisurf = ivi_controller_interface->get_surface_from_id(id_surface);
+	ivisurf = ivi_layout_interface->get_surface_from_id(id_surface);
 	assert(ivisurf != NULL);
 
-	ret = ivi_controller_interface->layer_add_surface(ivilayer, ivisurf);
+	ret = ivi_layout_interface->layer_add_surface(ivilayer, ivisurf);
 	assert(!ret);
 
-	ret = ivi_controller_interface->surface_set_destination_rectangle(ivisurf,
+	ret = ivi_layout_interface->surface_set_destination_rectangle(ivisurf,
 					dstx, dsty, width, height);
 	assert(!ret);
 
-	ret = ivi_controller_interface->surface_set_visibility(ivisurf, true);
+	ret = ivi_layout_interface->surface_set_visibility(ivisurf, true);
 	assert(!ret);
 }
 
@@ -814,21 +814,21 @@
 						sizeof(*add_surface_id));
 	*add_surface_id = id_surface;
 
-	ivisurf = ivi_controller_interface->get_surface_from_id(id_surface);
+	ivisurf = ivi_layout_interface->get_surface_from_id(id_surface);
 	assert(ivisurf != NULL);
 
-	ret = ivi_controller_interface->layer_add_surface(ivilayer, ivisurf);
+	ret = ivi_layout_interface->layer_add_surface(ivilayer, ivisurf);
 	assert(!ret);
 
 	panel_height = hmi_ctrl->hmi_setting->panel_height;
 
 	dsty = hmi_ctrl->base_layer.height - panel_height;
 
-	ret = ivi_controller_interface->surface_set_destination_rectangle(
+	ret = ivi_layout_interface->surface_set_destination_rectangle(
 		ivisurf, dstx, dsty, width, panel_height);
 	assert(!ret);
 
-	ret = ivi_controller_interface->surface_set_visibility(ivisurf, true);
+	ret = ivi_layout_interface->surface_set_visibility(ivisurf, true);
 	assert(!ret);
 }
 
@@ -857,10 +857,10 @@
 						sizeof(*add_surface_id));
 	*add_surface_id = id_surface;
 
-	ivisurf = ivi_controller_interface->get_surface_from_id(id_surface);
+	ivisurf = ivi_layout_interface->get_surface_from_id(id_surface);
 	assert(ivisurf != NULL);
 
-	ret = ivi_controller_interface->layer_add_surface(ivilayer, ivisurf);
+	ret = ivi_layout_interface->layer_add_surface(ivilayer, ivisurf);
 	assert(!ret);
 
 	panel_height = hmi_ctrl->hmi_setting->panel_height;
@@ -868,11 +868,11 @@
 	dstx = (60 * number) + 15;
 	dsty = (hmi_ctrl->base_layer.height - panel_height) + 5;
 
-	ret = ivi_controller_interface->surface_set_destination_rectangle(
+	ret = ivi_layout_interface->surface_set_destination_rectangle(
 		ivisurf,dstx, dsty, width, height);
 	assert(!ret);
 
-	ret = ivi_controller_interface->surface_set_visibility(ivisurf, true);
+	ret = ivi_layout_interface->surface_set_visibility(ivisurf, true);
 	assert(!ret);
 }
 
@@ -899,17 +899,17 @@
 						sizeof(*add_surface_id));
 	*add_surface_id = id_surface;
 
-	ivisurf = ivi_controller_interface->get_surface_from_id(id_surface);
+	ivisurf = ivi_layout_interface->get_surface_from_id(id_surface);
 	assert(ivisurf != NULL);
 
-	ret = ivi_controller_interface->layer_add_surface(ivilayer, ivisurf);
+	ret = ivi_layout_interface->layer_add_surface(ivilayer, ivisurf);
 	assert(!ret);
 
-	ret = ivi_controller_interface->surface_set_destination_rectangle(
+	ret = ivi_layout_interface->surface_set_destination_rectangle(
 			ivisurf, dstx, dsty, size, size);
 	assert(!ret);
 
-	ret = ivi_controller_interface->surface_set_visibility(ivisurf, true);
+	ret = ivi_layout_interface->surface_set_visibility(ivisurf, true);
 	assert(!ret);
 }
 
@@ -935,17 +935,17 @@
 	*add_surface_id = id_surface;
 	ivilayer = hmi_ctrl->workspace_background_layer.ivilayer;
 
-	ivisurf = ivi_controller_interface->get_surface_from_id(id_surface);
+	ivisurf = ivi_layout_interface->get_surface_from_id(id_surface);
 	assert(ivisurf != NULL);
 
-	ret = ivi_controller_interface->layer_add_surface(ivilayer, ivisurf);
+	ret = ivi_layout_interface->layer_add_surface(ivilayer, ivisurf);
 	assert(!ret);
 
-	ret = ivi_controller_interface->surface_set_destination_rectangle(ivisurf,
+	ret = ivi_layout_interface->surface_set_destination_rectangle(ivisurf,
 							   0, 0, width, height);
 	assert(!ret);
 
-	ret = ivi_controller_interface->surface_set_visibility(ivisurf, true);
+	ret = ivi_layout_interface->surface_set_visibility(ivisurf, true);
 	assert(!ret);
 }
 
@@ -1074,10 +1074,10 @@
 		y = ny * fcell_size_y  + space_y;
 
 		layout_surface =
-			ivi_controller_interface->get_surface_from_id(data->surface_id);
+			ivi_layout_interface->get_surface_from_id(data->surface_id);
 		assert(layout_surface);
 
-		ret = ivi_controller_interface->surface_set_destination_rectangle(
+		ret = ivi_layout_interface->surface_set_destination_rectangle(
 				layout_surface, x, y, icon_size, icon_size);
 		assert(!ret);
 
@@ -1099,12 +1099,12 @@
 	hmi_ctrl->workspace_layer.id_layer =
 		hmi_ctrl->hmi_setting->workspace_layer_id;
 
-	ivi_controller_interface->get_screens(&screen_length, &pp_screen);
+	ivi_layout_interface->get_screens(&screen_length, &pp_screen);
 	iviscrn = pp_screen[0];
 	free(pp_screen);
 	create_layer(iviscrn, &hmi_ctrl->workspace_layer);
-	ivi_controller_interface->layer_set_opacity(hmi_ctrl->workspace_layer.ivilayer, 0);
-	ivi_controller_interface->layer_set_visibility(hmi_ctrl->workspace_layer.ivilayer,
+	ivi_layout_interface->layer_set_opacity(hmi_ctrl->workspace_layer.ivilayer, 0);
+	ivi_layout_interface->layer_set_visibility(hmi_ctrl->workspace_layer.ivilayer,
 					false);
 
 	tmp_link_layer = MEM_ALLOC(sizeof(*tmp_link_layer));
@@ -1115,19 +1115,19 @@
 	/* Add surface to layer */
 	wl_array_for_each(data, &launchers) {
 		layout_surface =
-			ivi_controller_interface->get_surface_from_id(data->surface_id);
+			ivi_layout_interface->get_surface_from_id(data->surface_id);
 		assert(layout_surface);
 
-		ret = ivi_controller_interface->layer_add_surface(hmi_ctrl->workspace_layer.ivilayer,
+		ret = ivi_layout_interface->layer_add_surface(hmi_ctrl->workspace_layer.ivilayer,
 								  layout_surface);
 		assert(!ret);
 
-		ret = ivi_controller_interface->surface_set_visibility(layout_surface, true);
+		ret = ivi_layout_interface->surface_set_visibility(layout_surface, true);
 		assert(!ret);
 	}
 
 	wl_array_release(&launchers);
-	ivi_controller_interface->commit_changes();
+	ivi_layout_interface->commit_changes();
 }
 
 static void
@@ -1144,7 +1144,7 @@
 	ivi_hmi_controller_set_button(hmi_ctrl, hmi_ctrl->ui_setting.random_id, 3);
 	ivi_hmi_controller_set_home_button(hmi_ctrl, hmi_ctrl->ui_setting.home_id);
 	ivi_hmi_controller_set_workspacebackground(hmi_ctrl, hmi_ctrl->ui_setting.workspace_background_id);
-	ivi_controller_interface->commit_changes();
+	ivi_layout_interface->commit_changes();
 
 	ivi_hmi_controller_add_launchers(hmi_ctrl, 256);
 	hmi_ctrl->is_initialized = 1;
@@ -1262,7 +1262,7 @@
 	if (200 < from_motion_time)
 		pointer_v = 0.0;
 
-	ivi_controller_interface->layer_get_position(layer, &pos_x, &pos_y);
+	ivi_layout_interface->layer_get_position(layer, &pos_x, &pos_y);
 
 
 	if (is_flick) {
@@ -1282,14 +1282,14 @@
 
 	duration = hmi_ctrl->hmi_setting->transition_duration;
 	ivi_hmi_controller_send_workspace_end_control(resource, move->is_moved);
-	ivi_controller_interface->layer_set_transition(layer,
+	ivi_layout_interface->layer_set_transition(layer,
 					IVI_LAYOUT_TRANSITION_LAYER_MOVE,
 					duration);
-	ivi_controller_interface->layer_set_destination_rectangle(layer,
+	ivi_layout_interface->layer_set_destination_rectangle(layer,
 				end_pos, pos_y,
 				hmi_ctrl->workspace_layer.width,
 				hmi_ctrl->workspace_layer.height);
-	ivi_controller_interface->commit_changes();
+	ivi_layout_interface->commit_changes();
 }
 
 static void
@@ -1367,8 +1367,8 @@
 
 	layout_pos_x = wl_fixed_to_int(pos_x);
 	layout_pos_y = wl_fixed_to_int(pos_y);
-	ivi_controller_interface->layer_set_position(layer, layout_pos_x, layout_pos_y);
-	ivi_controller_interface->commit_changes();
+	ivi_layout_interface->layer_set_position(layer, layout_pos_x, layout_pos_y);
+	ivi_layout_interface->commit_changes();
 }
 
 static void
@@ -1534,7 +1534,7 @@
 	wl_fixed_t rgn[2][2] = {{0}};
 	wl_fixed_t grab_pos[2] = { grab_x, grab_y };
 
-	ivi_controller_interface->layer_get_position(layer, &layer_pos_x, &layer_pos_y);
+	ivi_layout_interface->layer_get_position(layer, &layer_pos_x, &layer_pos_y);
 
 	start_pos[0] = wl_fixed_from_int(layer_pos_x);
 	start_pos[1] = wl_fixed_from_int(layer_pos_y);
@@ -1605,7 +1605,7 @@
 
 	layer = hmi_ctrl->workspace_layer.ivilayer;
 
-	ivi_controller_interface->transition_move_layer_cancel(layer);
+	ivi_layout_interface->transition_move_layer_cancel(layer);
 
 	switch (device) {
 	case HMI_GRAB_DEVICE_POINTER:
@@ -1667,7 +1667,7 @@
 					&hmi_ctrl->workspace_fade);
 	}
 
-	ivi_controller_interface->commit_changes();
+	ivi_layout_interface->commit_changes();
 }
 
 /**
@@ -1773,18 +1773,18 @@
 WL_EXPORT int
 controller_module_init(struct weston_compositor *ec,
 		       int *argc, char *argv[],
-		       const struct ivi_controller_interface *interface,
+		       const struct ivi_layout_interface *interface,
 		       size_t interface_version)
 {
 	struct hmi_controller *hmi_ctrl = NULL;
 	struct wl_event_loop *loop = NULL;
 
-	if (interface_version < sizeof(struct ivi_controller_interface)) {
+	if (interface_version < sizeof(struct ivi_layout_interface)) {
 		weston_log("ivi-shell: version mismatch of controller interface\n");
 		return -1;
 	}
 
-	ivi_controller_interface = interface;
+	ivi_layout_interface = interface;
 
 	hmi_ctrl = hmi_controller_create(ec);