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>
diff --git a/clients/ivi-shell-user-interface.c b/clients/ivi-shell-user-interface.c
index 460ca27..2e0622b 100644
--- a/clients/ivi-shell-user-interface.c
+++ b/clients/ivi-shell-user-interface.c
@@ -158,6 +158,8 @@
char *cursor_theme;
int32_t cursor_size;
uint32_t transition_duration;
+ uint32_t surface_id_offset;
+ int32_t screen_num;
};
static void *
@@ -621,6 +623,8 @@
ivi_hmi_controller_add_listener(p_wlCtx->hmiCtrl,
&hmi_controller_listener, p_wlCtx);
+ } else if (!strcmp(interface, "wl_output")) {
+ p_wlCtx->hmi_setting->screen_num++;
}
}
@@ -1161,6 +1165,9 @@
shellSection, "workspace-background-id",
&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;
while (weston_config_next_section(config, §ion, &name)) {
@@ -1201,8 +1208,8 @@
int main(int argc, char **argv)
{
struct wlContextCommon wlCtxCommon;
- struct wlContextStruct wlCtx_BackGround;
- struct wlContextStruct wlCtx_Panel;
+ struct wlContextStruct *wlCtx_BackGround;
+ struct wlContextStruct *wlCtx_Panel;
struct wlContextStruct wlCtx_Button_1;
struct wlContextStruct wlCtx_Button_2;
struct wlContextStruct wlCtx_Button_3;
@@ -1213,12 +1220,11 @@
int ret = 0;
struct hmi_homescreen_setting *hmi_setting;
struct wlContextStruct *pWlCtxSt = NULL;
+ int i = 0;
hmi_setting = hmi_homescreen_setting_create();
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_2, 0x00, sizeof(wlCtx_Button_2));
memset(&wlCtx_Button_3, 0x00, sizeof(wlCtx_Button_3));
@@ -1256,6 +1262,9 @@
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) {
create_cursors(&wlCtxCommon);
@@ -1265,8 +1274,6 @@
wlCtxCommon.current_cursor = CURSOR_LEFT_PTR;
}
- wlCtx_BackGround.cmm = &wlCtxCommon;
- wlCtx_Panel.cmm = &wlCtxCommon;
wlCtx_Button_1.cmm = &wlCtxCommon;
wlCtx_Button_2.cmm = &wlCtxCommon;
wlCtx_Button_3.cmm = &wlCtxCommon;
@@ -1275,11 +1282,18 @@
wlCtx_WorkSpaceBackGround.cmm = &wlCtxCommon;
/* create desktop widgets */
- create_background(&wlCtx_BackGround, hmi_setting->background.id,
- hmi_setting->background.filePath);
+ for (i = 0; i < hmi_setting->screen_num; i++) {
+ wlCtx_BackGround[i].cmm = &wlCtxCommon;
+ create_background(&wlCtx_BackGround[i],
+ hmi_setting->background.id +
+ (i * hmi_setting->surface_id_offset),
+ hmi_setting->background.filePath);
- create_panel(&wlCtx_Panel, hmi_setting->panel.id,
- hmi_setting->panel.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,
hmi_setting->tiling.filePath, 0);
@@ -1310,6 +1324,9 @@
destroyWLContextStruct(pWlCtxSt);
}
+ free(wlCtx_BackGround);
+ free(wlCtx_Panel);
+
destroyWLContextCommon(&wlCtxCommon);
return 0;