From 7dbb166de6fbbea2867a3aae66bf55550dbfcaa7 Mon Sep 17 00:00:00 2001 From: Tomohito Esaki Date: Wed, 19 Jul 2023 11:54:47 +0900 Subject: [PATCH] hmi-controller: activate and deactivate sruface Activate when a surface is created and change focus when an active surface is removed. The Surface is added to layers when it is created, because it must be added to a layer to be active. Signed-off-by: Tomohito Esaki --- ivi-shell/hmi-controller.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c index ce5f1013c..d3bf2641c 100644 --- a/ivi-shell/hmi-controller.c +++ b/ivi-shell/hmi-controller.c @@ -583,9 +583,25 @@ set_notification_remove_surface(struct wl_listener *listener, void *data) struct hmi_controller *hmi_ctrl = wl_container_of(listener, hmi_ctrl, surface_removed); - (void)data; + struct ivi_layout_surface *ivisurf = data; switch_mode(hmi_ctrl, hmi_ctrl->layout_mode); + + /* set focus */ + if (hmi_ctrl->interface->surface_is_active(ivisurf)) { + struct ivi_layout_surface **pp_surface = NULL; + int32_t surface_length = 0; + int32_t i; + + hmi_ctrl->interface->get_surfaces(&surface_length, &pp_surface); + + for (i = 0; i < surface_length; i++) { + if (pp_surface[i] != ivisurf) { + hmi_ctrl->interface->surface_activate(pp_surface[i]); + break; + } + } + } } static void @@ -643,6 +659,9 @@ set_notification_configure_surface(struct wl_listener *listener, void *data) ivisurfs = NULL; } + hmi_ctrl->interface->layer_add_surface(application_layer, ivisurf); + hmi_ctrl->interface->surface_activate(ivisurf); + switch_mode(hmi_ctrl, hmi_ctrl->layout_mode); } @@ -678,7 +697,9 @@ set_notification_configure_desktop_surface(struct wl_listener *listener, void *d 0, surface->width, surface->height); } + hmi_ctrl->interface->surface_activate(ivisurf); hmi_ctrl->interface->commit_changes(); + switch_mode(hmi_ctrl, hmi_ctrl->layout_mode); }