+
+ weston_log("Placed app_id %s, type %s in hidden layer\n",
+ app_id, ivi_layout_get_surface_role_name(surf));
+ }
+}
+
+void
+ivi_layout_activate(struct ivi_output *output, const char *app_id)
+{
+ struct ivi_surface *surf;
+ struct ivi_compositor *ivi = output->ivi;
+
+ if (!app_id)
+ return;
+
+ surf = ivi_find_app(ivi, app_id);
+ if (!surf)
+ return;
+
+ ivi_layout_activate_by_surf(output, surf);
+}
+
+struct ivi_output *
+ivi_layout_get_output_from_surface(struct ivi_surface *surf)
+{
+ struct ivi_output *ivi_output = NULL;
+
+ switch (surf->role) {
+ case IVI_SURFACE_ROLE_DESKTOP:
+ if (surf->desktop.pending_output)
+ ivi_output = surf->desktop.pending_output;
+ else
+ ivi_output = surf->desktop.last_output;
+ break;
+ case IVI_SURFACE_ROLE_POPUP:
+ ivi_output = surf->popup.output;
+ break;
+ case IVI_SURFACE_ROLE_BACKGROUND:
+ ivi_output = surf->bg.output;
+ break;
+ case IVI_SURFACE_ROLE_PANEL:
+ ivi_output = surf->panel.output;
+ break;
+ case IVI_SURFACE_ROLE_FULLSCREEN:
+ ivi_output = surf->fullscreen.output;
+ break;
+ case IVI_SURFACE_ROLE_SPLIT_H:
+ case IVI_SURFACE_ROLE_SPLIT_V:
+ ivi_output = surf->split.output;
+ break;
+ case IVI_SURFACE_ROLE_REMOTE:
+ ivi_output = surf->remote.output;
+ break;
+ case IVI_SURFACE_ROLE_NONE:
+ default:
+ break;
+ }
+
+ return ivi_output;
+}
+
+void
+ivi_layout_deactivate(struct ivi_compositor *ivi, const char *app_id)
+{
+ struct ivi_surface *surf;
+ struct ivi_output *ivi_output;
+ struct ivi_policy *policy = ivi->policy;
+
+ if (!app_id)
+ return;
+
+ surf = ivi_find_app(ivi, app_id);
+ if (!surf)
+ return;
+
+ if (policy && policy->api.surface_deactivate &&
+ !policy->api.surface_deactivate(surf, surf->ivi)) {
+ return;