[weston,09/11] ivi-shell: hmi-controller supports multi screens at side-by-side mode.

Submitted by Nobuhiko Tanibata on Dec. 9, 2015, 6:44 a.m.

Details

Message ID 1449643447-23230-1-git-send-email-nobuhiko_tanibata@xddp.denso.co.jp
State Accepted
Commit d156d9c4cf19c56fa72bdde011d11875414a6c10
Headers show
Series "ivi-shell: multi screen supprot" ( rev: 2 ) in Wayland (DEPRECATED)

Not browsing as part of any series.

Commit Message

Nobuhiko Tanibata Dec. 9, 2015, 6:44 a.m.
From: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>

It shows 2 ivi application in a screen at side-by-side. It moves
additinal application more than 2xN to next screen N+1.

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

Patch hide | download patch | download mbox

diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
index d5b11ed..55e70fb 100644
--- a/ivi-shell/hmi-controller.c
+++ b/ivi-shell/hmi-controller.c
@@ -299,7 +299,14 @@  mode_divided_into_sidebyside(struct hmi_controller *hmi_ctrl,
 
 	const uint32_t duration = hmi_ctrl->hmi_setting->transition_duration;
 	int32_t i = 0;
-	int32_t num = 1;
+	struct ivi_layout_surface **surfaces;
+	struct ivi_layout_surface **new_order;
+	struct ivi_layout_layer *ivilayer = NULL;
+	int32_t surf_num = 0;
+	int32_t idx = 0;
+
+	surfaces = MEM_ALLOC(sizeof(*surfaces) * surface_length);
+	new_order = MEM_ALLOC(sizeof(*surfaces) * surface_length);
 
 	for (i = 0; i < surface_length; i++) {
 		ivisurf = pp_surface[i];
@@ -308,36 +315,44 @@  mode_divided_into_sidebyside(struct hmi_controller *hmi_ctrl,
 		if (is_surf_in_ui_widget(hmi_ctrl, ivisurf))
 			continue;
 
-		if (num == 1) {
-			ivi_layout_interface->surface_set_transition(ivisurf,
-					IVI_LAYOUT_TRANSITION_VIEW_DEFAULT,
-					duration);
-			ivi_layout_interface->surface_set_visibility(ivisurf, true);
-			ivi_layout_interface->surface_set_destination_rectangle(ivisurf,
-							0, 0,
-							surface_width,
-							surface_height);
+		surfaces[surf_num++] = ivisurf;
+	}
+
+	wl_list_for_each_reverse(layer, layer_list, link) {
+		if (idx >= surf_num)
+			break;
+
+		ivilayer = layer->ivilayer;
+
+		for (i = 0; i < 2; i++, idx++) {
+			if (idx >= surf_num)
+				break;
+
+			ivisurf = surfaces[idx];
+			new_order[i] = ivisurf;
 
-			num++;
-			continue;
-		} else if (num == 2) {
 			ivi_layout_interface->surface_set_transition(ivisurf,
 					IVI_LAYOUT_TRANSITION_VIEW_DEFAULT,
 					duration);
 			ivi_layout_interface->surface_set_visibility(ivisurf, true);
-			ivi_layout_interface->surface_set_destination_rectangle(ivisurf,
-							surface_width, 0,
-							surface_width,
-							surface_height);
 
-			num++;
-			continue;
+			ivi_layout_interface->surface_set_destination_rectangle(ivisurf,
+								i * surface_width, 0,
+								surface_width,
+								surface_height);
 		}
-		ivi_layout_interface->surface_set_transition(ivisurf,
-					IVI_LAYOUT_TRANSITION_VIEW_FADE_ONLY,
-					duration);
-		ivi_layout_interface->surface_set_visibility(ivisurf, false);
+		ivi_layout_interface->layer_set_render_order(ivilayer, new_order, i);
+	}
+
+	for (i = idx; i < surf_num; i++) {
+		ivi_layout_interface->surface_set_transition(surfaces[i],
+						IVI_LAYOUT_TRANSITION_VIEW_FADE_ONLY,
+						duration);
+		ivi_layout_interface->surface_set_visibility(surfaces[i], false);
 	}
+
+	free(surfaces);
+	free(new_order);
 }
 
 static void