diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2023-02-09 14:06:49 +0200 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2023-03-01 12:38:14 +0200 |
commit | 359a0612e48d7d21d5247199ca57063bd5965f71 (patch) | |
tree | c90fc1f6ea15395d564cc12b6e68d0661a2c6a65 /src/shell.c | |
parent | 4af44df30c1784a69b96d310f152133a507bc2e1 (diff) |
protocol: Add set_app_normal request
This request allows transitioning back from other roles like
float/split/fullscreen to regular maximized, normal state.
Bug-AGL: SPEC-4673
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Id7f04ffee193677621bd32860998457498acc388
Diffstat (limited to 'src/shell.c')
-rw-r--r-- | src/shell.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/shell.c b/src/shell.c index 4a1a954..fbd1b72 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1483,6 +1483,7 @@ shell_set_app_float(struct wl_client *client, struct wl_resource *shell_res, surf->popup.y = y_pos; surf->popup.bb = bb; + /* change the role */ surf->role = IVI_SURFACE_ROLE_NONE; @@ -1505,6 +1506,56 @@ shell_set_app_float(struct wl_client *client, struct wl_resource *shell_res, } static void +shell_set_app_normal(struct wl_client *client, struct wl_resource *shell_res, + const char *app_id) +{ + struct ivi_compositor *ivi = wl_resource_get_user_data(shell_res); + struct ivi_surface *surf = ivi_find_app(ivi, app_id); + struct weston_output *output = get_focused_output(ivi->compositor); + struct ivi_output *ivi_output; + struct weston_desktop_surface *dsurf; + struct weston_geometry area = {}; + + + if (!surf || (surf && surf->role == IVI_SURFACE_ROLE_DESKTOP)) + return; + + if (!output) + output = get_default_output(ivi->compositor); + + dsurf = surf->dsurface; + ivi_output = to_ivi_output(output); + + weston_layer_entry_remove(&surf->view->layer_link); + weston_view_geometry_dirty(surf->view); + weston_surface_damage(surf->view->surface); + + /* change the role */ + surf->role = IVI_SURFACE_ROLE_NONE; + surf->desktop.pending_output = ivi_output; + + wl_list_remove(&surf->link); + wl_list_init(&surf->link); + + ivi_set_desktop_surface(surf); + + if (ivi_output->area_activation.width || + ivi_output->area_activation.height) + area = ivi_output->area_activation; + else + area = ivi_output->area; + + weston_desktop_surface_set_maximized(dsurf, true); + weston_desktop_surface_set_size(dsurf, area.width, area.height); + + /* add to hidden layer */ + weston_layer_entry_insert(&ivi->hidden.view_list, + &surf->view->layer_link); + weston_compositor_schedule_repaint(ivi->compositor); + +} + +static void shell_desktop_activate_app(struct wl_client *client, struct wl_resource *shell_res, const char *app_id, const char *data, @@ -1587,6 +1638,7 @@ static const struct agl_shell_interface agl_shell_implementation = { .set_activate_region = shell_set_activate_region, .deactivate_app = shell_new_deactivate_app, .set_app_float = shell_set_app_float, + .set_app_normal = shell_set_app_normal, }; static const struct agl_shell_ext_interface agl_shell_ext_implementation = { |