ivi-shell: hmi-controller implements internal method to get screen.
- get screens from weston core - provide screens as internel method - the iviscn is stored in array inverse order in index. Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
committed by
Pekka Paalanen
parent
1c2618e9ff
commit
35711df126
+47
-13
@@ -124,6 +124,9 @@ struct hmi_controller {
|
|||||||
|
|
||||||
struct wl_client *user_interface;
|
struct wl_client *user_interface;
|
||||||
struct ui_setting ui_setting;
|
struct ui_setting ui_setting;
|
||||||
|
|
||||||
|
int32_t screen_num;
|
||||||
|
struct ivi_layout_screen **pp_screen;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct launcher_info {
|
struct launcher_info {
|
||||||
@@ -461,6 +464,39 @@ switch_mode(struct hmi_controller *hmi_ctrl,
|
|||||||
free(pp_surface);
|
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
|
||||||
|
*/
|
||||||
|
static struct ivi_layout_screen *
|
||||||
|
get_screen(int32_t screen_idx, struct hmi_controller *hmi_ctrl)
|
||||||
|
{
|
||||||
|
struct ivi_layout_screen *iviscrn = NULL;
|
||||||
|
|
||||||
|
if (screen_idx > hmi_ctrl->screen_num - 1)
|
||||||
|
weston_log("Invalid index. Return NULL\n");
|
||||||
|
else
|
||||||
|
iviscrn = hmi_ctrl->pp_screen[screen_idx];
|
||||||
|
|
||||||
|
return iviscrn;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal method for transition
|
* Internal method for transition
|
||||||
*/
|
*/
|
||||||
@@ -646,6 +682,7 @@ hmi_controller_destroy(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
wl_array_release(&hmi_ctrl->ui_widgets);
|
wl_array_release(&hmi_ctrl->ui_widgets);
|
||||||
free(hmi_ctrl->hmi_setting);
|
free(hmi_ctrl->hmi_setting);
|
||||||
|
free(hmi_ctrl->pp_screen);
|
||||||
free(hmi_ctrl);
|
free(hmi_ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,9 +704,7 @@ hmi_controller_destroy(struct wl_listener *listener, void *data)
|
|||||||
static struct hmi_controller *
|
static struct hmi_controller *
|
||||||
hmi_controller_create(struct weston_compositor *ec)
|
hmi_controller_create(struct weston_compositor *ec)
|
||||||
{
|
{
|
||||||
struct ivi_layout_screen **pp_screen = NULL;
|
|
||||||
struct ivi_layout_screen *iviscrn = NULL;
|
struct ivi_layout_screen *iviscrn = NULL;
|
||||||
int32_t screen_length = 0;
|
|
||||||
int32_t screen_width = 0;
|
int32_t screen_width = 0;
|
||||||
int32_t screen_height = 0;
|
int32_t screen_height = 0;
|
||||||
struct link_layer *tmp_link_layer = NULL;
|
struct link_layer *tmp_link_layer = NULL;
|
||||||
@@ -681,10 +716,14 @@ hmi_controller_create(struct weston_compositor *ec)
|
|||||||
hmi_ctrl->hmi_setting = hmi_server_setting_create(ec);
|
hmi_ctrl->hmi_setting = hmi_server_setting_create(ec);
|
||||||
hmi_ctrl->compositor = ec;
|
hmi_ctrl->compositor = ec;
|
||||||
|
|
||||||
ivi_layout_interface->get_screens(&screen_length, &pp_screen);
|
/* TODO: shall support hotplug of screens */
|
||||||
|
if (get_screens(hmi_ctrl) < 0) {
|
||||||
iviscrn = pp_screen[0];
|
weston_log("ivi-shell: Failed to get screens\n");
|
||||||
|
hmi_ctrl = NULL;
|
||||||
|
return hmi_ctrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
iviscrn = get_screen(0, hmi_ctrl);
|
||||||
ivi_layout_interface->get_screen_resolution(iviscrn, &screen_width,
|
ivi_layout_interface->get_screen_resolution(iviscrn, &screen_width,
|
||||||
&screen_height);
|
&screen_height);
|
||||||
|
|
||||||
@@ -744,9 +783,6 @@ hmi_controller_create(struct weston_compositor *ec)
|
|||||||
wl_signal_add(&hmi_ctrl->compositor->destroy_signal,
|
wl_signal_add(&hmi_ctrl->compositor->destroy_signal,
|
||||||
&hmi_ctrl->destroy_listener);
|
&hmi_ctrl->destroy_listener);
|
||||||
|
|
||||||
free(pp_screen);
|
|
||||||
pp_screen = NULL;
|
|
||||||
|
|
||||||
return hmi_ctrl;
|
return hmi_ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -998,8 +1034,6 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
|
|||||||
|
|
||||||
struct ivi_layout_screen *iviscrn = NULL;
|
struct ivi_layout_screen *iviscrn = NULL;
|
||||||
struct link_layer *tmp_link_layer = NULL;
|
struct link_layer *tmp_link_layer = NULL;
|
||||||
struct ivi_layout_screen **pp_screen = NULL;
|
|
||||||
int32_t screen_length = 0;
|
|
||||||
|
|
||||||
if (0 == x_count)
|
if (0 == x_count)
|
||||||
x_count = 1;
|
x_count = 1;
|
||||||
@@ -1099,9 +1133,7 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
|
|||||||
hmi_ctrl->workspace_layer.id_layer =
|
hmi_ctrl->workspace_layer.id_layer =
|
||||||
hmi_ctrl->hmi_setting->workspace_layer_id;
|
hmi_ctrl->hmi_setting->workspace_layer_id;
|
||||||
|
|
||||||
ivi_layout_interface->get_screens(&screen_length, &pp_screen);
|
iviscrn = get_screen(0, hmi_ctrl);
|
||||||
iviscrn = pp_screen[0];
|
|
||||||
free(pp_screen);
|
|
||||||
create_layer(iviscrn, &hmi_ctrl->workspace_layer);
|
create_layer(iviscrn, &hmi_ctrl->workspace_layer);
|
||||||
ivi_layout_interface->layer_set_opacity(hmi_ctrl->workspace_layer.ivilayer, 0);
|
ivi_layout_interface->layer_set_opacity(hmi_ctrl->workspace_layer.ivilayer, 0);
|
||||||
ivi_layout_interface->layer_set_visibility(hmi_ctrl->workspace_layer.ivilayer,
|
ivi_layout_interface->layer_set_visibility(hmi_ctrl->workspace_layer.ivilayer,
|
||||||
@@ -1797,6 +1829,8 @@ controller_module_init(struct weston_compositor *ec,
|
|||||||
ivi_layout_interface = interface;
|
ivi_layout_interface = interface;
|
||||||
|
|
||||||
hmi_ctrl = hmi_controller_create(ec);
|
hmi_ctrl = hmi_controller_create(ec);
|
||||||
|
if (hmi_ctrl == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (!initialize(hmi_ctrl)) {
|
if (!initialize(hmi_ctrl)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user