diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2024-01-23 15:39:47 +0200 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2024-01-24 14:41:08 +0200 |
commit | 699bdf5e69517f2e7d7238377b41121b1470af3f (patch) | |
tree | 57836724f79f28998ebea2fdd7d37894a4a93c12 | |
parent | e3f8379e48433d1ba9236f959c2cb4c78da4c38a (diff) |
layout: Add the ability to deactivate fullscreen surfaces
Deactivating fullscreen is a special case so we need to handle it
similarly to dialog/popups.
This adds an additional schedule for repaint in the fullscreen part to
force a redraw, otherwise deactivation/activation would need to inflict
any sort of damage to trigger a redraw.
Bug-AGL: SPEC-4348
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I258543f43514af07dfed7b36531816e90561cc61
-rw-r--r-- | src/layout.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/layout.c b/src/layout.c index c11dacb..4b8a691 100644 --- a/src/layout.c +++ b/src/layout.c @@ -730,6 +730,7 @@ ivi_layout_fullscreen_committed(struct ivi_surface *surface) ivi_layout_get_surface_role_name(surface), output->name); + weston_compositor_schedule_repaint(ivi->compositor); } } @@ -974,6 +975,32 @@ ivi_layout_popup_re_add(struct ivi_surface *surface) ivi_layout_popup_committed(surface); } +static void +ivi_layout_fullscreen_re_add(struct ivi_surface *surface) +{ + assert(surface->role == IVI_SURFACE_ROLE_FULLSCREEN); + struct weston_view *view = surface->view; + + if (weston_view_is_mapped(view)) { + struct weston_desktop_surface *dsurface = surface->dsurface; + struct weston_surface *wsurface = + weston_desktop_surface_get_surface(dsurface); + + weston_layer_entry_remove(&view->layer_link); + + wsurface->is_mapped = false; + view->is_mapped = false; + } + + /* reset the activate by default in order to (still) allow the surface + * to be activaved using the request */ + if (!surface->mapped) + surface->mapped = true; + + surface->state = NORMAL; + ivi_layout_fullscreen_committed(surface); +} + static bool ivi_layout_surface_is_split_or_fullscreen(struct ivi_surface *surf) { @@ -1027,6 +1054,11 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) return; } + if (surf->role == IVI_SURFACE_ROLE_FULLSCREEN) { + ivi_layout_fullscreen_re_add(surf); + return; + } + /* do not 're'-activate surfaces that are split or active */ if (surf == output->active || ivi_layout_surface_is_split_or_fullscreen(surf)) { @@ -1177,7 +1209,8 @@ ivi_layout_deactivate(struct ivi_compositor *ivi, const char *app_id) weston_desktop_surface_get_app_id(dsurface); ivi_layout_activate(ivi_output, previous_active_app_id); } - } else if (surf->role == IVI_SURFACE_ROLE_POPUP) { + } else if (surf->role == IVI_SURFACE_ROLE_POPUP || + surf->role == IVI_SURFACE_ROLE_FULLSCREEN) { struct weston_view *view = surf->view; weston_view_unmap(view); @@ -1188,5 +1221,5 @@ ivi_layout_deactivate(struct ivi_compositor *ivi, const char *app_id) weston_surface_damage(view->surface); } - shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_DEACTIVATED); + shell_send_app_state(ivi, app_id, AGL_SHELL_APP_STATE_DEACTIVATED); } |