X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fshell.c;h=16d924c2d9932108461fb4d608d57ec9d4a9c2c8;hb=e7ccf51adc37748d3ca000109d16d0495dc0a7e8;hp=eb29316a8b95657c8833933d1bff75cff8277cbd;hpb=3d6199ee18b4807a82c4181d829052029d1ba350;p=src%2Fagl-compositor.git diff --git a/src/shell.c b/src/shell.c index eb29316..16d924c 100644 --- a/src/shell.c +++ b/src/shell.c @@ -52,6 +52,9 @@ create_black_curtain_view(struct ivi_output *output); static uint32_t reverse_orientation(uint32_t orientation); +const char * +split_orientation_to_string(uint32_t orientation); + void agl_shell_desktop_advertise_application_id(struct ivi_compositor *ivi, struct ivi_surface *surface) @@ -662,7 +665,7 @@ ivi_check_pending_desktop_surface(struct ivi_surface *surface) } _ivi_set_shell_surface_split(papp->ioutput->active, NULL, reverse_orientation(papp_tile->orientation), - width_prev_app, false); + width_prev_app, false, false); } surface->role = IVI_SURFACE_ROLE_TILE; @@ -670,7 +673,8 @@ ivi_check_pending_desktop_surface(struct ivi_surface *surface) wl_list_insert(&surface->ivi->surfaces, &surface->link); _ivi_set_shell_surface_split(surface, papp->ioutput, - papp_tile->orientation, papp_tile->width, true); + papp_tile->orientation, papp_tile->width, + papp_tile->sticky, true); /* remove it from pending */ wl_list_remove(&papp->link); @@ -1776,6 +1780,27 @@ _ivi_set_pending_desktop_surface_split(struct wl_resource *output, } +const char * +split_orientation_to_string(uint32_t orientation) +{ + switch (orientation) { + case AGL_SHELL_TILE_ORIENTATION_LEFT: + return "tile_left"; + break; + case AGL_SHELL_TILE_ORIENTATION_RIGHT: + return "tile_right"; + break; + case AGL_SHELL_TILE_ORIENTATION_TOP: + return "title_top"; + break; + case AGL_SHELL_TILE_ORIENTATION_BOTTOM: + return "tile_bottom"; + break; + default: + return "none"; + } +} + static uint32_t reverse_orientation(uint32_t orientation) { @@ -1800,9 +1825,11 @@ reverse_orientation(uint32_t orientation) void _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *ioutput, - uint32_t orientation, uint32_t width, bool to_activate) + uint32_t orientation, uint32_t width, int32_t sticky, + bool to_activate) { struct ivi_compositor *ivi = surface->ivi; + struct weston_view *ev = surface->view; struct weston_geometry geom = {}; struct ivi_output *output = NULL; @@ -1839,8 +1866,27 @@ _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *iou } break; case AGL_SHELL_TILE_ORIENTATION_NONE: - new_width = output->area.width; - new_height = output->area.height; + /* use the current_completed_output because the sticky window + * might have changed the output area */ + new_width = surface->current_completed_output->area_activation.width; + new_height = surface->current_completed_output->area_activation.height; + + if (new_width != output->area.width) + output->area.width = new_width; + + if (new_height != output->area.height) + output->area.height = new_height; + + weston_log("Adjusting activation area " + "to %dX%d\n", output->area.width, output->area.height); + + if (surface->sticky) { + surface->sticky = 0; + weston_log("Resetting sticky window\n"); + } + + surface->role = surface->prev_role; + weston_log("Resetting tile role to previous role\n"); break; default: /* nothing */ @@ -1858,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); @@ -1897,6 +1942,29 @@ _ivi_set_shell_surface_split(struct ivi_surface *surface, struct ivi_output *iou surface->orientation = orientation; weston_compositor_schedule_repaint(ivi->compositor); + + if (sticky) + 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"); + } + + if (surface->sticky) { + if (orientation == AGL_SHELL_TILE_ORIENTATION_LEFT || + orientation == AGL_SHELL_TILE_ORIENTATION_RIGHT) + output->area.width -= new_width; + + if (orientation == AGL_SHELL_TILE_ORIENTATION_TOP || + orientation == AGL_SHELL_TILE_ORIENTATION_BOTTOM) + output->area.height -= new_height; + + weston_log("Found sticky window, adjusting activation area " + "to %dX%d\n", output->area.width, output->area.height); + } } static int @@ -1942,21 +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) { @@ -1967,9 +2047,13 @@ void shell_set_app_split(struct wl_client *client, struct wl_resource *res, width_prev_app = output->area.width - width; } + weston_log("Setting previous application '%s' to orientation '%s' width %d, not sticky\n", + prev_app_id, split_orientation_to_string(reverse_orientation(orientation)), + width_prev_app); + _ivi_set_shell_surface_split(output->previous_active, NULL, reverse_orientation(orientation), - width_prev_app, false); + width_prev_app, false, false); if (orientation == AGL_SHELL_TILE_ORIENTATION_NONE && output->active == surf) { @@ -1977,7 +2061,10 @@ void shell_set_app_split(struct wl_client *client, struct wl_resource *res, } } - _ivi_set_shell_surface_split(surf, NULL, orientation, width, false); + weston_log("Setting application '%s' to orientation '%s' width %d, %s\n", + app_id, split_orientation_to_string(orientation), + width, sticky == 1 ? "sticky" : "not sticky"); + _ivi_set_shell_surface_split(surf, NULL, orientation, width, sticky, false); } static void