summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>2014-04-17 10:15:27 +0200
committerNobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>2014-05-30 16:58:01 +0900
commit17209dffd0395da6145323f1cb65ed15ba8f9998 (patch)
tree08cb2e40b6de76aa48582137c9a1ed3f9a99f299
parent708d0c769bbc98068a5a9f38b674e5b6b83d4131 (diff)
downloadwayland-ivi-extension-17209dffd0395da6145323f1cb65ed15ba8f9998.tar.gz
fixed layer order returned in ilm_getLayerIDsOnScreen
layer ids are reported in opposite order than expected by ILM API. Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
-rw-r--r--ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
index e0ad07c..df688f1 100644
--- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
+++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
@@ -2029,19 +2029,28 @@ wayland_getLayerIDsOnScreen(t_ilm_uint screenId,
struct layer_context *ctx_layer = NULL;
t_ilm_int length = wl_list_length(&ctx_screen->order.list_layer);
- *ppArray = (t_ilm_layer*)malloc(length * sizeof *ppArray);
- if (*ppArray != NULL) {
- t_ilm_layer* ids = *ppArray;
- wl_list_for_each(ctx_layer,
- &ctx_screen->order.list_layer,
- order.link) {
- *ids = ctx_layer->id_layer;
- ids++;
- }
- *pLength = length;
+ if (0 < length)
+ {
+ *ppArray = (t_ilm_layer*)malloc(length * sizeof *ppArray);
+ if (*ppArray != NULL) {
+ // compositor sends layers in opposite order
+ // write ids from back to front to turn them around
+ t_ilm_layer* ids = &((*ppArray)[length - 1]);
+ wl_list_for_each(ctx_layer, &ctx->main_ctx.list_layer, link)
+ {
+ *ids = ctx_layer->id_layer;
+ --ids;
+ }
- returnValue = ILM_SUCCESS;
+ }
+ }
+ else
+ {
+ *ppArray = NULL;
}
+
+ *pLength = length;
+ returnValue = ILM_SUCCESS;
}
}