From: Marius Vlad Date: Fri, 10 Jul 2020 12:01:28 +0000 (+0300) Subject: layout: Add missing hooks for other surface roles X-Git-Tag: 9.99.3^0 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=c7bc55dce459ea25f725410fc1b86dd9534a9ed5;p=src%2Fagl-compositor.git layout: Add missing hooks for other surface roles We are missing the activate_by_default hooks for split, pop-up and and fullscreen roles. Part of that is due to the fact that these roles are handled a bit differently that the remote and desktop roles. Note, these hooks are different than the commit ones -- which are 'installed' a bit earlier. This means that there was still a possiblity one might've used that hook to retrieve the surface role for instance, and act accordingly. Also, note that we allow for pop-up/dialogs be activated by using the deliberate 'activate' request, which allows one to customize the policy to deny certain pop-up/dialogs to be activated by default, but allow do so explictly when using the 'activate' request. Bug-AGL: SPEC-3494 Reported-by: Scott Murray Signed-off-by: Marius Vlad Change-Id: I634bbb5915e65880c1d47363cf6dae529feac9d2 --- diff --git a/src/layout.c b/src/layout.c index d8d0196..fa49163 100644 --- a/src/layout.c +++ b/src/layout.c @@ -366,6 +366,7 @@ void ivi_layout_fullscreen_committed(struct ivi_surface *surface) { struct ivi_compositor *ivi = surface->ivi; + struct ivi_policy *policy = ivi->policy; struct weston_desktop_surface *dsurface = surface->dsurface; struct weston_surface *wsurface = @@ -378,6 +379,11 @@ ivi_layout_fullscreen_committed(struct ivi_surface *surface) struct weston_view *view = surface->view; struct weston_geometry geom; + if (policy && policy->api.surface_activate_by_default && + !policy->api.surface_activate_by_default(surface, surface->ivi) && + !surface->activated_by_default) + return; + if (surface->view->is_mapped) return; @@ -430,6 +436,7 @@ void ivi_layout_split_committed(struct ivi_surface *surface) { struct ivi_compositor *ivi = surface->ivi; + struct ivi_policy *policy = ivi->policy; struct weston_desktop_surface *dsurface = surface->dsurface; struct weston_surface *wsurface = @@ -448,6 +455,11 @@ ivi_layout_split_committed(struct ivi_surface *surface) x = woutput->x; y = woutput->y; + if (policy && policy->api.surface_activate_by_default && + !policy->api.surface_activate_by_default(surface, surface->ivi) && + !surface->activated_by_default) + return; + if (surface->view->is_mapped) return; @@ -522,6 +534,7 @@ void ivi_layout_popup_committed(struct ivi_surface *surface) { struct ivi_compositor *ivi = surface->ivi; + struct ivi_policy *policy = ivi->policy; struct weston_desktop_surface *dsurface = surface->dsurface; struct weston_surface *wsurface = @@ -533,6 +546,11 @@ ivi_layout_popup_committed(struct ivi_surface *surface) struct weston_view *view = surface->view; + if (policy && policy->api.surface_activate_by_default && + !policy->api.surface_activate_by_default(surface, surface->ivi) && + !surface->activated_by_default) + return; + if (surface->view->is_mapped) return; @@ -580,6 +598,11 @@ ivi_layout_popup_re_add(struct ivi_surface *surface) view->is_mapped = false; } + /* reset the activate by default in order to (still) allow the surface + * to be activaved using the request */ + if (!surface->activated_by_default) + surface->activated_by_default = true; + ivi_layout_popup_committed(surface); } @@ -594,6 +617,11 @@ ivi_layout_surface_is_split_or_fullscreen(struct ivi_surface *surf) surf->role != IVI_SURFACE_ROLE_FULLSCREEN) return false; + /* reset the activate by default in order to (still) allow the surface + * to be activaved using the request */ + if (!surf->activated_by_default) + surf->activated_by_default = true; + wl_list_for_each(is, &ivi->surfaces, link) if (is == surf) return true;