diff options
author | 2024-02-14 13:26:44 +0200 | |
---|---|---|
committer | 2024-02-22 13:51:33 +0000 | |
commit | 754636273ffc6b872d6fb194009c857e76e7cec1 (patch) | |
tree | a922bfd843d5a6ad6a9ae6914eb394c7e7426a56 | |
parent | 16d8d1af63ea1bbdaa9223cbf3e01cb6698f1eb0 (diff) |
layout/shell: Keep track of previous role
And with it also handle the re-mapping/unmapping of previous active
window such we don't run into weird behaviours, and be able to revert
back to the original output dimensions when going back to normal
windows.
Bug-AGL: SPEC-4839
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I3703de998b0baa8a2b9d72276dcd56b315d3ca1a
-rw-r--r-- | src/ivi-compositor.h | 1 | ||||
-rw-r--r-- | src/layout.c | 5 | ||||
-rw-r--r-- | src/shell.c | 38 |
3 files changed, 28 insertions, 16 deletions
diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h index 5250dba..ca40fff 100644 --- a/src/ivi-compositor.h +++ b/src/ivi-compositor.h @@ -314,6 +314,7 @@ struct ivi_surface { } state; enum ivi_surface_role role; + enum ivi_surface_role prev_role; union { struct ivi_desktop_surface desktop; struct ivi_background_surface bg; diff --git a/src/layout.c b/src/layout.c index a2cf48c..a06b1e5 100644 --- a/src/layout.c +++ b/src/layout.c @@ -1137,7 +1137,7 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) return; } - if (surf->sticky && surf->role == IVI_SURFACE_ROLE_TILE) { + if (surf->sticky && surf->role == IVI_SURFACE_ROLE_TILE && output->active == surf) { weston_log("Application %s is already active on output %s (split role)\n", app_id, output->output->name); return; @@ -1179,7 +1179,8 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) /* the background surface is already "maximized" so we don't need to * add to the hidden layer */ - if (surf->role == IVI_SURFACE_ROLE_BACKGROUND) { + if (surf->role == IVI_SURFACE_ROLE_BACKGROUND && + output->active->role != IVI_SURFACE_ROLE_TILE) { ivi_layout_activate_complete(output, surf); return; } diff --git a/src/shell.c b/src/shell.c index 2e27742..16d924c 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1829,6 +1829,7 @@ _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *iou bool to_activate) { struct ivi_compositor *ivi = surface->ivi; + struct weston_view *ev = surface->view; struct weston_geometry geom = {}; struct ivi_output *output = NULL; @@ -1884,8 +1885,8 @@ _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *iou weston_log("Resetting sticky window\n"); } - surface->role = IVI_SURFACE_ROLE_DESKTOP; - weston_log("Resetting tile role to desktop\n"); + surface->role = surface->prev_role; + weston_log("Resetting tile role to previous role\n"); break; default: /* nothing */ @@ -1903,7 +1904,6 @@ _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *iou if (to_activate) { - struct weston_view *ev = surface->view; struct ivi_shell_seat *ivi_seat = NULL; struct weston_seat *wseat = get_ivi_shell_weston_first_seat(ivi); @@ -1936,7 +1936,6 @@ _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *iou ivi_shell_activate_surface(surface, ivi_seat, WESTON_ACTIVATE_FLAG_NONE); } - weston_view_set_position(surface->view, x, y); weston_desktop_surface_set_size(surface->dsurface, new_width, new_height); weston_desktop_surface_set_orientation(surface->dsurface, orientation); @@ -1948,6 +1947,7 @@ _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *iou surface->sticky = sticky; if (orientation != AGL_SHELL_TILE_ORIENTATION_NONE) { + surface->prev_role = surface->role; surface->role = IVI_SURFACE_ROLE_TILE; weston_log("Found split orientation different that none, " "setting surface role to orientation tile\n"); @@ -2010,23 +2010,33 @@ void shell_set_app_split(struct wl_client *client, struct wl_resource *res, } if (output->previous_active && output->background != output->previous_active) { - struct weston_view *ev = output->previous_active->view; int width_prev_app = 0; + struct weston_view *ev = output->previous_active->view; const char *prev_app_id = weston_desktop_surface_get_app_id(output->previous_active->dsurface); - if (!weston_view_is_mapped(ev)) - weston_view_update_transform(ev); - else - weston_layer_entry_remove(&ev->layer_link); + if (orientation != AGL_SHELL_TILE_ORIENTATION_NONE) { + if (!weston_view_is_mapped(ev)) + weston_view_update_transform(ev); + else + weston_layer_entry_remove(&ev->layer_link); - ev->is_mapped = true; - ev->surface->is_mapped = true; - output->previous_active->mapped = true; + ev->is_mapped = true; + ev->surface->is_mapped = true; + output->previous_active->mapped = true; - weston_view_set_output(ev, woutput); + weston_view_set_output(ev, woutput); + weston_layer_entry_insert(&ivi->normal.view_list, + &ev->layer_link); + } else { + ev->is_mapped = false; + ev->surface->is_mapped = false; - weston_layer_entry_insert(&ivi->normal.view_list, &ev->layer_link); + weston_layer_entry_remove(&ev->layer_link); + + weston_view_geometry_dirty(ev); + weston_surface_damage(ev->surface); + } /* a 0 width means we have no explicit width set-up */ if (width > 0) { |