From 359a0612e48d7d21d5247199ca57063bd5965f71 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Thu, 9 Feb 2023 14:06:49 +0200 Subject: 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 Change-Id: Id7f04ffee193677621bd32860998457498acc388 --- src/shell.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'src/shell.c') 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; @@ -1504,6 +1505,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, @@ -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 = { -- cgit 1.2.3-korg