struct ui_setting ui_setting;
int32_t screen_num;
- struct ivi_layout_screen **pp_screen;
};
struct launcher_info {
free(pp_surface);
}
-/**
- * Internal method to get screens from weston core
- * TODO: shall support hotplug of screens
- */
-static int32_t
-get_screens(struct hmi_controller *hmi_ctrl)
-{
- hmi_ctrl->pp_screen = NULL;
- hmi_ctrl->screen_num = 0;
- ivi_layout_interface->get_screens(&hmi_ctrl->screen_num, &hmi_ctrl->pp_screen);
-
- if (hmi_ctrl->pp_screen == NULL)
- return -1;
- else
- return 0;
-}
/**
* Internal method to get ivi_layout_screen
if (screen_idx > hmi_ctrl->screen_num - 1)
weston_log("Invalid index. Return NULL\n");
else
- iviscrn = hmi_ctrl->pp_screen[screen_idx];
+ iviscrn = ivi_layout_interface->get_screen_from_id(screen_idx);
return iviscrn;
}
wl_array_release(&hmi_ctrl->ui_widgets);
free(hmi_ctrl->hmi_setting);
- free(hmi_ctrl->pp_screen);
free(hmi_ctrl);
}
hmi_ctrl->layout_mode = IVI_HMI_CONTROLLER_LAYOUT_MODE_TILING;
hmi_ctrl->hmi_setting = hmi_server_setting_create(ec);
hmi_ctrl->compositor = ec;
+ hmi_ctrl->screen_num = wl_list_length(&ec->output_list);
/* TODO: shall support hotplug of screens */
- if (get_screens(hmi_ctrl) < 0) {
- weston_log("ivi-shell: Failed to get screens\n");
- hmi_ctrl = NULL;
- return hmi_ctrl;
- }
-
iviscrn = get_screen(0, hmi_ctrl);
/* init base ivi_layer*/
}
static int32_t
-ivi_layout_get_screens(int32_t *pLength, struct ivi_layout_screen ***ppArray)
-{
- struct ivi_layout *layout = get_instance();
- struct ivi_layout_screen *iviscrn = NULL;
- int32_t length = 0;
- int32_t n = 0;
-
- if (pLength == NULL || ppArray == NULL) {
- weston_log("ivi_layout_get_screens: invalid argument\n");
- return IVI_FAILED;
- }
-
- length = wl_list_length(&layout->screen_list);
-
- if (length != 0) {
- /* the Array must be free by module which called this function */
- *ppArray = calloc(length, sizeof(struct ivi_layout_screen *));
- if (*ppArray == NULL) {
- weston_log("fails to allocate memory\n");
- return IVI_FAILED;
- }
-
- wl_list_for_each(iviscrn, &layout->screen_list, link) {
- (*ppArray)[n++] = iviscrn;
- }
- }
-
- *pLength = length;
-
- return IVI_SUCCEEDED;
-}
-
-static int32_t
ivi_layout_get_screens_under_layer(struct ivi_layout_layer *ivilayer,
int32_t *pLength,
struct ivi_layout_screen ***ppArray)
* screen controller interfaces part1
*/
.get_screen_from_id = ivi_layout_get_screen_from_id,
- .get_screens = ivi_layout_get_screens,
.get_screens_under_layer = ivi_layout_get_screens_under_layer,
.screen_add_layer = ivi_layout_screen_add_layer,
.screen_set_render_order = ivi_layout_screen_set_render_order,
}
static void
-test_screen_id(struct test_context *ctx)
-{
- const struct ivi_layout_interface *lyt = ctx->layout_interface;
- struct ivi_layout_screen **iviscrns;
- struct weston_output *output;
- int32_t screen_length = 0;
- int32_t i;
-
- iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
- iassert(screen_length > 0);
-
- for (i = 0; i < screen_length; ++i) {
- output = lyt->screen_get_output(iviscrns[i]);
- iassert(lyt->get_screen_from_id(output->id) == iviscrns[i]);
- }
-
- if (screen_length > 0)
- free(iviscrns);
-}
-
-static void
test_screen_render_order(struct test_context *ctx)
{
#define LAYER_NUM (3)
const struct ivi_layout_interface *lyt = ctx->layout_interface;
- struct ivi_layout_screen **iviscrns;
- int32_t screen_length = 0;
struct ivi_layout_screen *iviscrn;
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
struct ivi_layout_layer **array;
int32_t length = 0;
uint32_t i;
- iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
- iassert(screen_length > 0);
-
- if (screen_length <= 0)
+ if (wl_list_empty(&ctx->compositor->output_list))
return;
- iviscrn = iviscrns[0];
+ iviscrn = lyt->get_screen_from_id(0);
for (i = 0; i < LAYER_NUM; i++)
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
for (i = 0; i < LAYER_NUM; i++)
lyt->layer_destroy(ivilayers[i]);
- free(iviscrns);
#undef LAYER_NUM
}
{
#define LAYER_NUM (3)
const struct ivi_layout_interface *lyt = ctx->layout_interface;
- struct ivi_layout_screen **iviscrns;
- int32_t screen_length;
struct ivi_layout_screen *iviscrn;
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
struct ivi_layout_layer **array;
int32_t length = 0;
uint32_t i;
- iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
- iassert(screen_length > 0);
-
- if (screen_length <= 0)
+ if (wl_list_empty(&ctx->compositor->output_list))
return;
- iviscrn = iviscrns[0];
+ iviscrn = lyt->get_screen_from_id(0);
for (i = 0; i < LAYER_NUM; i++)
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
for (i = 0; i < LAYER_NUM; i++)
lyt->layer_destroy(ivilayers[i]);
- free(iviscrns);
#undef LAYER_NUM
}
{
#define LAYER_NUM (3)
const struct ivi_layout_interface *lyt = ctx->layout_interface;
- struct ivi_layout_screen **iviscrns;
- int32_t screen_length;
struct ivi_layout_screen *iviscrn;
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
uint32_t i;
- iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
- iassert(screen_length > 0);
-
- if (screen_length <= 0)
+ if (wl_list_empty(&ctx->compositor->output_list))
return;
- iviscrn = iviscrns[0];
+ iviscrn = lyt->get_screen_from_id(0);
for (i = 0; i < LAYER_NUM; i++)
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
lyt->layer_destroy(ivilayers[0]);
lyt->layer_destroy(ivilayers[2]);
-
- free(iviscrns);
#undef LAYER_NUM
}
test_layer_create_duplicate(ctx);
test_get_layer_after_destory_layer(ctx);
- test_screen_id(ctx);
test_screen_render_order(ctx);
test_screen_bad_render_order(ctx);
test_commit_changes_after_render_order_set_layer_destroy(ctx);