From 2cc479fd8f3e53265efa093ca52e6e6f6b0faea7 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Tue, 21 Jun 2022 14:13:56 +0300 Subject: layout: Add a wrapper for adding the view to the hidden layer And with it, use it *as well* when detecting a surface shouldn't be presented if activate-by-default is disabled. The reason for doing that is to allow application the resize and receive frame events right after the client shell has been started. Doing it a later point it time, right when a potential activation could come from a client, wouldn't really be useful as the client won't react to configure events. This particular fix is for cases where the activate by default is disabled and the application itself was added *before* the client shell sent the ready request. Bug-AGL: SPEC-4423 Signed-off-by: Marius Vlad Reported-by: Vasyl Vavrychuk Change-Id: I5b08d2ff65fca28126608c2677ec9b558a34caa1 --- src/layout.c | 65 ++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/src/layout.c b/src/layout.c index be65c6c..5d24a1f 100644 --- a/src/layout.c +++ b/src/layout.c @@ -275,6 +275,40 @@ ivi_layout_find_bg_output(struct ivi_compositor *ivi) return NULL; } + +static void +ivi_layout_add_to_hidden_layer(struct ivi_surface *surf, + struct ivi_output *ivi_output) +{ + struct weston_desktop_surface *dsurf = surf->dsurface; + struct weston_view *ev = surf->view; + struct ivi_compositor *ivi = surf->ivi; + const char *app_id = weston_desktop_surface_get_app_id(dsurf); + + weston_desktop_surface_set_maximized(dsurf, true); + weston_desktop_surface_set_size(dsurf, + ivi_output->area.width, + ivi_output->area.height); + + weston_log("Setting app_id %s, role %s, set to maximized (%dx%d)\n", + app_id, ivi_layout_get_surface_role_name(surf), + ivi_output->area.width, ivi_output->area.height); + /* + * If the view isn't mapped, we put it onto the hidden layer so it will + * start receiving frame events, and will be able to act on our + * configure event. + */ + if (!weston_view_is_mapped(ev)) { + ev->is_mapped = true; + ev->surface->is_mapped = true; + + weston_view_set_output(ev, ivi_output->output); + weston_layer_entry_insert(&ivi->hidden.view_list, &ev->layer_link); + weston_log("Placed app_id %s, type %s in hidden layer\n", + app_id, ivi_layout_get_surface_role_name(surf)); + } +} + void ivi_layout_desktop_committed(struct ivi_surface *surf) { @@ -336,6 +370,12 @@ ivi_layout_desktop_committed(struct ivi_surface *surf) if (!surf->ivi->activate_by_default) { weston_log("Refusing to activate surface role %d, app_id %s\n", surf->role, app_id); + + if (!weston_desktop_surface_get_maximized(dsurf) || + geom.width != r_output->area.width || + geom.height != r_output->area.height) + ivi_layout_add_to_hidden_layer(surf, r_output); + return; } @@ -739,12 +779,10 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) { struct ivi_compositor *ivi = output->ivi; struct weston_desktop_surface *dsurf; - struct weston_view *view; struct weston_geometry geom; struct ivi_policy *policy = output->ivi->policy; dsurf = surf->dsurface; - view = surf->view; const char *app_id = weston_desktop_surface_get_app_id(dsurf); @@ -793,28 +831,7 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) return; } - weston_desktop_surface_set_maximized(dsurf, true); - weston_desktop_surface_set_size(dsurf, - output->area.width, - output->area.height); - - weston_log("Setting app_id %s, role %s, set to maximized (%dx%d)\n", - app_id, ivi_layout_get_surface_role_name(surf), - output->area.width, output->area.height); - /* - * If the view isn't mapped, we put it onto the hidden layer so it will - * start receiving frame events, and will be able to act on our - * configure event. - */ - if (!weston_view_is_mapped(view)) { - view->is_mapped = true; - view->surface->is_mapped = true; - - weston_view_set_output(view, output->output); - weston_layer_entry_insert(&ivi->hidden.view_list, &view->layer_link); - weston_log("Placed app_id %s, type %s in hidden layer\n", - app_id, ivi_layout_get_surface_role_name(surf)); - } + ivi_layout_add_to_hidden_layer(surf, output); } void -- cgit 1.2.3-korg