diff options
author | 2024-01-25 18:55:15 +0200 | |
---|---|---|
committer | 2024-02-22 13:51:33 +0000 | |
commit | 09fa5536e759792c80341305a536cd59aa801c6d (patch) | |
tree | 407b3133e0915a8f70238c40be9bb8452532ca45 /src/layout.c | |
parent | 8a7f3fbbf0fd94bb1c29c59663392506a213c4b1 (diff) |
layout/shell: Add basic support for split window
This introduces a new set_split request to allow changing the tile
orientation of the window. See the protocol XML for more implementation
details.
Of importance difference from the previous implementation is that
this patch makes use of the xdg-shell protocol, such that orientation
is being handled over the configure event to the client.
The protocol specifies a width to allow the client to control how much
of the output be assign the split window and also a sticky window
functionality.
Bug-AGL: SPEC-4839
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Ia8b7d04a7514f55d647c3ea76b13bab51a3586aa
Diffstat (limited to 'src/layout.c')
-rw-r--r-- | src/layout.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/layout.c b/src/layout.c index 4b8a691..b3a7329 100644 --- a/src/layout.c +++ b/src/layout.c @@ -48,6 +48,7 @@ static const char *ivi_roles_as_string[] = { [IVI_SURFACE_ROLE_SPLIT_V] = "SPLIT_V", [IVI_SURFACE_ROLE_FULLSCREEN] = "FULLSCREEN", [IVI_SURFACE_ROLE_REMOTE] = "REMOTE", + [IVI_SURFACE_ROLE_TILE] = "SPLIT", }; bool @@ -284,6 +285,13 @@ ivi_layout_activate_complete(struct ivi_output *output, woutput->x + output->area.x, woutput->y + output->area.y); + /* reset any previous orientation */ + if (surf->orientation != AGL_SHELL_TILE_ORIENTATION_NONE) { + weston_log("%s() resetting itself to none orientation\n", __func__); + surf->orientation = AGL_SHELL_TILE_ORIENTATION_NONE; + weston_desktop_surface_set_orientation(surf->dsurface, + surf->orientation); + } view->is_mapped = true; surf->mapped = true; view->surface->is_mapped = true; @@ -1025,6 +1033,22 @@ ivi_layout_surface_is_split_or_fullscreen(struct ivi_surface *surf) } void +ivi_layout_reset_split_surfaces(struct ivi_compositor *ivi) +{ + struct ivi_surface *ivisurf; + + wl_list_for_each(ivisurf, &ivi->surfaces, link) { + struct weston_desktop_surface *dsurf = ivisurf->dsurface; + + if (ivisurf->orientation != AGL_SHELL_TILE_ORIENTATION_NONE) { + weston_log("%s() resetting apps to none orientation\n", __func__); + ivisurf->orientation = AGL_SHELL_TILE_ORIENTATION_NONE; + weston_desktop_surface_set_orientation(dsurf, ivisurf->orientation); + } + } +} + +void ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) { struct ivi_compositor *ivi = output->ivi; @@ -1058,15 +1082,26 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) ivi_layout_fullscreen_re_add(surf); return; } +#if 0 + /* reset tile to desktop to allow to resize correctly */ + if (surf->role == IVI_SURFACE_ROLE_TILE && output->active == surf) { + weston_log("%s() resetting tile role!\n", __func__); + surf->role = IVI_SURFACE_ROLE_DESKTOP; + } +#endif /* do not 're'-activate surfaces that are split or active */ if (surf == output->active || - ivi_layout_surface_is_split_or_fullscreen(surf)) { + ivi_layout_surface_is_split_or_fullscreen(surf) || + surf->role != IVI_SURFACE_ROLE_DESKTOP) { weston_log("Application %s is already active on output %s\n", app_id, output->output->name); return; } + // destroy any split types to allow correct re-activation + ivi_layout_reset_split_surfaces(surf->ivi); + if (surf->role == IVI_SURFACE_ROLE_REMOTE) { struct ivi_output *remote_output = ivi_layout_find_with_app_id(app_id, ivi); @@ -1149,8 +1184,13 @@ ivi_layout_get_output_from_surface(struct ivi_surface *surf) case IVI_SURFACE_ROLE_REMOTE: ivi_output = surf->remote.output; break; + case IVI_SURFACE_ROLE_TILE: + ivi_output = surf->current_completed_output; + break; case IVI_SURFACE_ROLE_NONE: default: + if (surf->view->output) + return to_ivi_output(surf->view->output); break; } |