[PATCH weston] hmi-controller: fix the laucher layer width

Nobuhiko Tanibata nobuhiko_tanibata at xddp.denso.co.jp
Sun Aug 23 17:12:23 PDT 2015


From: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>

A layer for workspace is used to display icons for invoking applications
in several pages. These pages are swapped from one to next page. The
width of the layer was decided as a size of screen before reading
weston.ini. This worked correctly because there was no feature of
clipping of layer so the width of layer was not taken account.

Now clipping feature is supported. So the width shall be set to correct
one after reading weston.ini.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 ivi-shell/hmi-controller.c | 71 ++++++++++++++++++++++++++++------------------
 1 file changed, 44 insertions(+), 27 deletions(-)

diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
index 760bf06..19ceef2 100644
--- a/ivi-shell/hmi-controller.c
+++ b/ivi-shell/hmi-controller.c
@@ -725,27 +725,9 @@ hmi_controller_create(struct weston_compositor *ec)
 	ivi_controller_interface->layer_set_visibility(
 		hmi_ctrl->workspace_background_layer.ivilayer, false);
 
-	/* init workspace ivi_layer */
-	hmi_ctrl->workspace_layer.x = hmi_ctrl->workspace_background_layer.x;
-	hmi_ctrl->workspace_layer.y = hmi_ctrl->workspace_background_layer.y;
-	hmi_ctrl->workspace_layer.width =
-		hmi_ctrl->workspace_background_layer.width;
-	hmi_ctrl->workspace_layer.height =
-		hmi_ctrl->workspace_background_layer.height;
-	hmi_ctrl->workspace_layer.id_layer =
-		hmi_ctrl->hmi_setting->workspace_layer_id;
-
-	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,
-					false);
 
 	wl_list_init(&hmi_ctrl->workspace_fade.layer_list);
 	tmp_link_layer = MEM_ALLOC(sizeof(*tmp_link_layer));
-	tmp_link_layer->layout_layer = hmi_ctrl->workspace_layer.ivilayer;
-	wl_list_insert(&hmi_ctrl->workspace_fade.layer_list,
-		       &tmp_link_layer->link);
-	tmp_link_layer = MEM_ALLOC(sizeof(*tmp_link_layer));
 	tmp_link_layer->layout_layer =
 		hmi_ctrl->workspace_background_layer.ivilayer;
 	wl_list_insert(&hmi_ctrl->workspace_fade.layer_list,
@@ -980,12 +962,11 @@ static void
 ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
 				 int32_t icon_size)
 {
-	struct ivi_layout_layer *layer = hmi_ctrl->workspace_layer.ivilayer;
 	int32_t minspace_x = 10;
 	int32_t minspace_y = minspace_x;
 
-	int32_t width  = hmi_ctrl->workspace_layer.width;
-	int32_t height = hmi_ctrl->workspace_layer.height;
+	int32_t width  = hmi_ctrl->workspace_background_layer.width;
+	int32_t height = hmi_ctrl->workspace_background_layer.height;
 
 	int32_t x_count = (width - minspace_x) / (minspace_x + icon_size);
 	int32_t space_x = (int32_t)((width - x_count * icon_size) / (1.0 + x_count));
@@ -1015,6 +996,11 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
 	struct ivi_layout_surface* layout_surface = NULL;
 	uint32_t *add_surface_id = NULL;
 
+	struct ivi_layout_screen *iviscrn = NULL;
+	struct link_layer *tmp_link_layer = NULL;
+	struct ivi_layout_screen **pp_screen = NULL;
+	int32_t screen_length  = 0;
+
 	if (0 == x_count)
 		x_count = 1;
 
@@ -1091,16 +1077,10 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
 			ivi_controller_interface->get_surface_from_id(data->surface_id);
 		assert(layout_surface);
 
-		ret = ivi_controller_interface->layer_add_surface(layer, layout_surface);
-		assert(!ret);
-
 		ret = ivi_controller_interface->surface_set_destination_rectangle(
 				layout_surface, x, y, icon_size, icon_size);
 		assert(!ret);
 
-		ret = ivi_controller_interface->surface_set_visibility(layout_surface, true);
-		assert(!ret);
-
 		nx++;
 
 		if (x_count == nx) {
@@ -1109,6 +1089,43 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
 		}
 	}
 
+	/* init workspace ivi_layer */
+	hmi_ctrl->workspace_layer.x = hmi_ctrl->workspace_background_layer.x;
+	hmi_ctrl->workspace_layer.y = hmi_ctrl->workspace_background_layer.y;
+	hmi_ctrl->workspace_layer.width =
+		hmi_ctrl->workspace_background_layer.width * hmi_ctrl->workspace_count;
+	hmi_ctrl->workspace_layer.height =
+		hmi_ctrl->workspace_background_layer.height;
+	hmi_ctrl->workspace_layer.id_layer =
+		hmi_ctrl->hmi_setting->workspace_layer_id;
+
+	ivi_controller_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,
+					false);
+
+	tmp_link_layer = MEM_ALLOC(sizeof(*tmp_link_layer));
+	tmp_link_layer->layout_layer = hmi_ctrl->workspace_layer.ivilayer;
+	wl_list_insert(&hmi_ctrl->workspace_fade.layer_list,
+		       &tmp_link_layer->link);
+
+	/* Add surface to layer */
+	wl_array_for_each(data, &launchers) {
+		layout_surface =
+			ivi_controller_interface->get_surface_from_id(data->surface_id);
+		assert(layout_surface);
+
+		ret = ivi_controller_interface->layer_add_surface(hmi_ctrl->workspace_layer.ivilayer,
+								  layout_surface);
+		assert(!ret);
+
+		ret = ivi_controller_interface->surface_set_visibility(layout_surface, true);
+		assert(!ret);
+	}
+
 	wl_array_release(&launchers);
 	ivi_controller_interface->commit_changes();
 }
-- 
1.8.3.1



More information about the wayland-devel mailing list