hmi-controller: allocate background surfaces for multi-screen

A surface ID for layer of background/panel image is set by key: background-id
or panel-id at weston.ini. To support multi screens, it also support offset,
surface-id-offset, to offset the surface ID to next ID for a layer on next
screen.

According to the above key, hmi-controller and ivi-shell-user-interface
who increments the number of screens per notification of wl_output.
crate surface and draw background/panel image on multi surface on screens.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Nobuhiko Tanibata 9 years ago committed by Pekka Paalanen
parent 744b03093b
commit 2e656769b6
  1. 39
      clients/ivi-shell-user-interface.c
  2. 76
      ivi-shell/hmi-controller.c
  3. 1
      ivi-shell/weston.ini.in

@ -158,6 +158,8 @@ hmi_homescreen_setting {
char *cursor_theme; char *cursor_theme;
int32_t cursor_size; int32_t cursor_size;
uint32_t transition_duration; uint32_t transition_duration;
uint32_t surface_id_offset;
int32_t screen_num;
}; };
static void * static void *
@ -621,6 +623,8 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
ivi_hmi_controller_add_listener(p_wlCtx->hmiCtrl, ivi_hmi_controller_add_listener(p_wlCtx->hmiCtrl,
&hmi_controller_listener, p_wlCtx); &hmi_controller_listener, p_wlCtx);
} else if (!strcmp(interface, "wl_output")) {
p_wlCtx->hmi_setting->screen_num++;
} }
} }
@ -1161,6 +1165,9 @@ hmi_homescreen_setting_create(void)
shellSection, "workspace-background-id", shellSection, "workspace-background-id",
&setting->workspace_background.id, 2001); &setting->workspace_background.id, 2001);
weston_config_section_get_uint(
shellSection, "surface-id-offset", &setting->surface_id_offset, 10);
icon_surface_id = workspace_layer_id + 1; icon_surface_id = workspace_layer_id + 1;
while (weston_config_next_section(config, &section, &name)) { while (weston_config_next_section(config, &section, &name)) {
@ -1201,8 +1208,8 @@ hmi_homescreen_setting_create(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct wlContextCommon wlCtxCommon; struct wlContextCommon wlCtxCommon;
struct wlContextStruct wlCtx_BackGround; struct wlContextStruct *wlCtx_BackGround;
struct wlContextStruct wlCtx_Panel; struct wlContextStruct *wlCtx_Panel;
struct wlContextStruct wlCtx_Button_1; struct wlContextStruct wlCtx_Button_1;
struct wlContextStruct wlCtx_Button_2; struct wlContextStruct wlCtx_Button_2;
struct wlContextStruct wlCtx_Button_3; struct wlContextStruct wlCtx_Button_3;
@ -1213,12 +1220,11 @@ int main(int argc, char **argv)
int ret = 0; int ret = 0;
struct hmi_homescreen_setting *hmi_setting; struct hmi_homescreen_setting *hmi_setting;
struct wlContextStruct *pWlCtxSt = NULL; struct wlContextStruct *pWlCtxSt = NULL;
int i = 0;
hmi_setting = hmi_homescreen_setting_create(); hmi_setting = hmi_homescreen_setting_create();
memset(&wlCtxCommon, 0x00, sizeof(wlCtxCommon)); memset(&wlCtxCommon, 0x00, sizeof(wlCtxCommon));
memset(&wlCtx_BackGround, 0x00, sizeof(wlCtx_BackGround));
memset(&wlCtx_Panel, 0x00, sizeof(wlCtx_Panel));
memset(&wlCtx_Button_1, 0x00, sizeof(wlCtx_Button_1)); memset(&wlCtx_Button_1, 0x00, sizeof(wlCtx_Button_1));
memset(&wlCtx_Button_2, 0x00, sizeof(wlCtx_Button_2)); memset(&wlCtx_Button_2, 0x00, sizeof(wlCtx_Button_2));
memset(&wlCtx_Button_3, 0x00, sizeof(wlCtx_Button_3)); memset(&wlCtx_Button_3, 0x00, sizeof(wlCtx_Button_3));
@ -1256,6 +1262,9 @@ int main(int argc, char **argv)
exit(1); exit(1);
} }
wlCtx_BackGround = MEM_ALLOC(hmi_setting->screen_num * sizeof(struct wlContextStruct));
wlCtx_Panel= MEM_ALLOC(hmi_setting->screen_num * sizeof(struct wlContextStruct));
if (wlCtxCommon.hmi_setting->cursor_theme) { if (wlCtxCommon.hmi_setting->cursor_theme) {
create_cursors(&wlCtxCommon); create_cursors(&wlCtxCommon);
@ -1265,8 +1274,6 @@ int main(int argc, char **argv)
wlCtxCommon.current_cursor = CURSOR_LEFT_PTR; wlCtxCommon.current_cursor = CURSOR_LEFT_PTR;
} }
wlCtx_BackGround.cmm = &wlCtxCommon;
wlCtx_Panel.cmm = &wlCtxCommon;
wlCtx_Button_1.cmm = &wlCtxCommon; wlCtx_Button_1.cmm = &wlCtxCommon;
wlCtx_Button_2.cmm = &wlCtxCommon; wlCtx_Button_2.cmm = &wlCtxCommon;
wlCtx_Button_3.cmm = &wlCtxCommon; wlCtx_Button_3.cmm = &wlCtxCommon;
@ -1275,11 +1282,18 @@ int main(int argc, char **argv)
wlCtx_WorkSpaceBackGround.cmm = &wlCtxCommon; wlCtx_WorkSpaceBackGround.cmm = &wlCtxCommon;
/* create desktop widgets */ /* create desktop widgets */
create_background(&wlCtx_BackGround, hmi_setting->background.id, for (i = 0; i < hmi_setting->screen_num; i++) {
hmi_setting->background.filePath); wlCtx_BackGround[i].cmm = &wlCtxCommon;
create_background(&wlCtx_BackGround[i],
create_panel(&wlCtx_Panel, hmi_setting->panel.id, hmi_setting->background.id +
hmi_setting->panel.filePath); (i * hmi_setting->surface_id_offset),
hmi_setting->background.filePath);
wlCtx_Panel[i].cmm = &wlCtxCommon;
create_panel(&wlCtx_Panel[i],
hmi_setting->panel.id + (i * hmi_setting->surface_id_offset),
hmi_setting->panel.filePath);
}
create_button(&wlCtx_Button_1, hmi_setting->tiling.id, create_button(&wlCtx_Button_1, hmi_setting->tiling.id,
hmi_setting->tiling.filePath, 0); hmi_setting->tiling.filePath, 0);
@ -1310,6 +1324,9 @@ int main(int argc, char **argv)
destroyWLContextStruct(pWlCtxSt); destroyWLContextStruct(pWlCtxSt);
} }
free(wlCtx_BackGround);
free(wlCtx_Panel);
destroyWLContextCommon(&wlCtxCommon); destroyWLContextCommon(&wlCtxCommon);
return 0; return 0;

@ -105,6 +105,7 @@ struct ui_setting {
uint32_t random_id; uint32_t random_id;
uint32_t home_id; uint32_t home_id;
uint32_t workspace_background_id; uint32_t workspace_background_id;
uint32_t surface_id_offset;
}; };
struct hmi_controller { struct hmi_controller {
@ -830,33 +831,37 @@ ivi_hmi_controller_set_background(struct hmi_controller *hmi_ctrl,
uint32_t id_surface) uint32_t id_surface)
{ {
struct ivi_layout_surface *ivisurf = NULL; struct ivi_layout_surface *ivisurf = NULL;
struct hmi_controller_layer *base_layer = struct hmi_controller_layer *base_layer = NULL;
wl_container_of(hmi_ctrl->base_layer_list.prev, struct ivi_layout_layer *ivilayer = NULL;
base_layer,
link);
struct ivi_layout_layer *ivilayer = base_layer->ivilayer;
const int32_t dstx = hmi_ctrl->application_layer.x; const int32_t dstx = hmi_ctrl->application_layer.x;
const int32_t dsty = hmi_ctrl->application_layer.y; const int32_t dsty = hmi_ctrl->application_layer.y;
const int32_t width = hmi_ctrl->application_layer.width; const int32_t width = hmi_ctrl->application_layer.width;
const int32_t height = hmi_ctrl->application_layer.height; const int32_t height = hmi_ctrl->application_layer.height;
int32_t ret = 0; int32_t ret = 0;
int32_t i = 0;
uint32_t *add_surface_id = wl_array_add(&hmi_ctrl->ui_widgets, wl_list_for_each_reverse(base_layer, &hmi_ctrl->base_layer_list, link) {
sizeof(*add_surface_id)); uint32_t *add_surface_id = wl_array_add(&hmi_ctrl->ui_widgets,
*add_surface_id = id_surface; sizeof(*add_surface_id));
*add_surface_id = id_surface + (i * hmi_ctrl->ui_setting.surface_id_offset);
ivisurf = ivi_layout_interface->get_surface_from_id(id_surface); ivilayer = base_layer->ivilayer;
assert(ivisurf != NULL);
ret = ivi_layout_interface->layer_add_surface(ivilayer, ivisurf); ivisurf = ivi_layout_interface->get_surface_from_id(*add_surface_id);
assert(!ret); assert(ivisurf != NULL);
ret = ivi_layout_interface->surface_set_destination_rectangle(ivisurf, ret = ivi_layout_interface->layer_add_surface(ivilayer, ivisurf);
dstx, dsty, width, height); assert(!ret);
assert(!ret);
ret = ivi_layout_interface->surface_set_visibility(ivisurf, true); ret = ivi_layout_interface->surface_set_destination_rectangle(ivisurf,
assert(!ret); dstx, dsty, width, height);
assert(!ret);
ret = ivi_layout_interface->surface_set_visibility(ivisurf, true);
assert(!ret);
i++;
}
} }
/** /**
@ -875,33 +880,37 @@ ivi_hmi_controller_set_panel(struct hmi_controller *hmi_ctrl,
wl_container_of(hmi_ctrl->base_layer_list.prev, wl_container_of(hmi_ctrl->base_layer_list.prev,
base_layer, base_layer,
link); link);
struct ivi_layout_layer *ivilayer = base_layer->ivilayer; struct ivi_layout_layer *ivilayer = NULL;
const int32_t width = base_layer->width; const int32_t width = base_layer->width;
int32_t ret = 0; int32_t ret = 0;
int32_t panel_height = 0; int32_t panel_height = hmi_ctrl->hmi_setting->panel_height;
const int32_t dstx = 0; const int32_t dstx = 0;
int32_t dsty = 0; int32_t dsty = 0;
int32_t i = 0;
uint32_t *add_surface_id = wl_array_add(&hmi_ctrl->ui_widgets, wl_list_for_each_reverse(base_layer, &hmi_ctrl->base_layer_list, link) {
sizeof(*add_surface_id)); uint32_t *add_surface_id = wl_array_add(&hmi_ctrl->ui_widgets,
*add_surface_id = id_surface; sizeof(*add_surface_id));
*add_surface_id = id_surface + (i * hmi_ctrl->ui_setting.surface_id_offset);
ivisurf = ivi_layout_interface->get_surface_from_id(id_surface); ivilayer = base_layer->ivilayer;
assert(ivisurf != NULL); ivisurf = ivi_layout_interface->get_surface_from_id(*add_surface_id);
assert(ivisurf != NULL);
ret = ivi_layout_interface->layer_add_surface(ivilayer, ivisurf); ret = ivi_layout_interface->layer_add_surface(ivilayer, ivisurf);
assert(!ret); assert(!ret);
panel_height = hmi_ctrl->hmi_setting->panel_height; dsty = base_layer->height - panel_height;
dsty = base_layer->height - panel_height; ret = ivi_layout_interface->surface_set_destination_rectangle(
ivisurf, dstx, dsty, width, panel_height);
assert(!ret);
ret = ivi_layout_interface->surface_set_destination_rectangle( ret = ivi_layout_interface->surface_set_visibility(ivisurf, true);
ivisurf, dstx, dsty, width, panel_height); assert(!ret);
assert(!ret);
ret = ivi_layout_interface->surface_set_visibility(ivisurf, true); i++;
assert(!ret); }
} }
/** /**
@ -1816,6 +1825,7 @@ initialize(struct hmi_controller *hmi_ctrl)
{ "random-id", &hmi_ctrl->ui_setting.random_id }, { "random-id", &hmi_ctrl->ui_setting.random_id },
{ "home-id", &hmi_ctrl->ui_setting.home_id }, { "home-id", &hmi_ctrl->ui_setting.home_id },
{ "workspace-background-id", &hmi_ctrl->ui_setting.workspace_background_id }, { "workspace-background-id", &hmi_ctrl->ui_setting.workspace_background_id },
{ "surface-id-offset", &hmi_ctrl->ui_setting.surface_id_offset },
{ NULL, NULL } { NULL, NULL }
}; };

@ -23,6 +23,7 @@ background-image=@abs_top_srcdir@/data/background.png
background-id=1001 background-id=1001
panel-image=@abs_top_srcdir@/data/panel.png panel-image=@abs_top_srcdir@/data/panel.png
panel-id=1002 panel-id=1002
surface-id-offset=10
tiling-image=@abs_top_srcdir@/data/tiling.png tiling-image=@abs_top_srcdir@/data/tiling.png
tiling-id=1003 tiling-id=1003
sidebyside-image=@abs_top_srcdir@/data/sidebyside.png sidebyside-image=@abs_top_srcdir@/data/sidebyside.png

Loading…
Cancel
Save