X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Flayout.c;h=df632d818e902e9e09d469f3822e41b09710b22c;hb=0acbca5d1a9ca5aad361dfc2807f3822223c739d;hp=829e1d57fa3c4a92777a2908a80204cf27b41ca4;hpb=7a7b46bd7040b2814ad5f314818742bad990e93c;p=src%2Fagl-compositor.git diff --git a/src/layout.c b/src/layout.c index 829e1d5..df632d8 100644 --- a/src/layout.c +++ b/src/layout.c @@ -47,6 +47,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] = "TILE", }; const char * @@ -192,6 +193,8 @@ ivi_layout_activate_complete(struct ivi_output *output, struct ivi_compositor *ivi = output->ivi; struct weston_output *woutput = output->output; struct weston_view *view = surf->view; + struct weston_seat *wseat = get_ivi_shell_weston_first_seat(ivi); + struct ivi_shell_seat *ivi_seat = get_ivi_shell_seat(wseat); if (weston_view_is_mapped(view)) { weston_layer_entry_remove(&view->layer_link); @@ -204,6 +207,10 @@ ivi_layout_activate_complete(struct ivi_output *output, woutput->x + output->area.x, woutput->y + output->area.y); + 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; @@ -221,6 +228,9 @@ ivi_layout_activate_complete(struct ivi_output *output, weston_view_geometry_dirty(view); weston_surface_damage(view->surface); + if (ivi_seat) + ivi_shell_activate_surface(surf, ivi_seat, WESTON_ACTIVATE_FLAG_NONE); + /* * the 'remote' role now makes use of this part so make sure we don't * trip the enum such that we might end up with a modified output for @@ -270,6 +280,40 @@ ivi_layout_find_bg_output(struct ivi_compositor *ivi) return NULL; } + +static void +ivi_layout_add_to_hidden_layer(struct ivi_surface *surf, + struct ivi_output *ivi_output) +{ + struct weston_desktop_surface *dsurf = surf->dsurface; + struct weston_view *ev = surf->view; + struct ivi_compositor *ivi = surf->ivi; + const char *app_id = weston_desktop_surface_get_app_id(dsurf); + + weston_desktop_surface_set_maximized(dsurf, true); + weston_desktop_surface_set_size(dsurf, + ivi_output->area.width, + ivi_output->area.height); + + weston_log("Setting app_id %s, role %s, set to maximized (%dx%d)\n", + app_id, ivi_layout_get_surface_role_name(surf), + ivi_output->area.width, ivi_output->area.height); + /* + * If the view isn't mapped, we put it onto the hidden layer so it will + * start receiving frame events, and will be able to act on our + * configure event. + */ + if (!weston_view_is_mapped(ev)) { + ev->is_mapped = true; + ev->surface->is_mapped = true; + + weston_view_set_output(ev, ivi_output->output); + weston_layer_entry_insert(&ivi->hidden.view_list, &ev->layer_link); + weston_log("Placed app_id %s, type %s in hidden layer\n", + app_id, ivi_layout_get_surface_role_name(surf)); + } +} + void ivi_layout_desktop_committed(struct ivi_surface *surf) { @@ -331,6 +375,12 @@ ivi_layout_desktop_committed(struct ivi_surface *surf) if (!surf->ivi->activate_by_default) { weston_log("Refusing to activate surface role %d, app_id %s\n", surf->role, app_id); + + if (!weston_desktop_surface_get_maximized(dsurf) || + geom.width != r_output->area.width || + geom.height != r_output->area.height) + ivi_layout_add_to_hidden_layer(surf, r_output); + return; } @@ -408,6 +458,9 @@ ivi_layout_fullscreen_committed(struct ivi_surface *surface) struct weston_geometry geom = weston_desktop_surface_get_geometry(dsurface); + struct weston_seat *wseat = get_ivi_shell_weston_first_seat(ivi); + struct ivi_shell_seat *ivi_seat = get_ivi_shell_seat(wseat); + bool is_fullscreen = weston_desktop_surface_get_fullscreen(dsurface); bool is_dim_same = geom.width == bg_output->output->width && @@ -470,6 +523,9 @@ ivi_layout_fullscreen_committed(struct ivi_surface *surface) weston_view_geometry_dirty(view); weston_surface_damage(view->surface); + if (ivi_seat) + ivi_shell_activate_surface(surface, ivi_seat, WESTON_ACTIVATE_FLAG_NONE); + shell_advertise_app_state(ivi, app_id, NULL, AGL_SHELL_DESKTOP_APP_STATE_ACTIVATED); @@ -516,6 +572,9 @@ ivi_layout_split_committed(struct ivi_surface *surface) struct ivi_output *output = surface->split.output; struct weston_output *woutput = output->output; + struct weston_seat *wseat = get_ivi_shell_weston_first_seat(ivi); + struct ivi_shell_seat *ivi_seat = get_ivi_shell_seat(wseat); + struct weston_view *view = surface->view; struct weston_geometry geom; @@ -586,6 +645,9 @@ ivi_layout_split_committed(struct ivi_surface *surface) weston_view_geometry_dirty(view); weston_surface_damage(view->surface); + if (ivi_seat) + ivi_shell_activate_surface(surface, ivi_seat, WESTON_ACTIVATE_FLAG_NONE); + wsurface->is_mapped = true; surface->view->is_mapped = true; @@ -621,6 +683,9 @@ ivi_layout_popup_committed(struct ivi_surface *surface) struct ivi_output *output = surface->popup.output; struct weston_output *woutput = output->output; + struct weston_seat *wseat = get_ivi_shell_weston_first_seat(ivi); + struct ivi_shell_seat *ivi_seat = get_ivi_shell_seat(wseat); + struct weston_view *view = surface->view; if (policy && policy->api.surface_activate_by_default && @@ -628,7 +693,7 @@ ivi_layout_popup_committed(struct ivi_surface *surface) !surface->mapped) return; - if (surface->view->is_mapped) + if (surface->view->is_mapped || surface->state == HIDDEN) return; assert(surface->role == IVI_SURFACE_ROLE_POPUP); @@ -638,6 +703,7 @@ ivi_layout_popup_committed(struct ivi_surface *surface) ivi_compute_popup_position(woutput, view, surface->popup.x, surface->popup.y, &new_x, &new_y); weston_view_set_position(view, new_x, new_y); + weston_view_update_transform(view); /* only clip the pop-up dialog window if we have a valid * width and height being passed on. Users might not want to have one @@ -651,6 +717,9 @@ ivi_layout_popup_committed(struct ivi_surface *surface) weston_view_geometry_dirty(view); weston_surface_damage(view->surface); + if (ivi_seat) + ivi_shell_activate_surface(surface, ivi_seat, WESTON_ACTIVATE_FLAG_NONE); + wsurface->is_mapped = true; surface->view->is_mapped = true; @@ -683,6 +752,7 @@ ivi_layout_popup_re_add(struct ivi_surface *surface) if (!surface->mapped) surface->mapped = true; + surface->state = NORMAL; ivi_layout_popup_committed(surface); } @@ -714,12 +784,10 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) { struct ivi_compositor *ivi = output->ivi; struct weston_desktop_surface *dsurf; - struct weston_view *view; struct weston_geometry geom; struct ivi_policy *policy = output->ivi->policy; dsurf = surf->dsurface; - view = surf->view; const char *app_id = weston_desktop_surface_get_app_id(dsurf); @@ -741,10 +809,16 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) return; } + /* reset tile to desktop to allow to resize correctly */ + if (surf->role == IVI_SURFACE_ROLE_TILE && output->active == surf) + surf->role = IVI_SURFACE_ROLE_DESKTOP; + /* do not 're'-activate surfaces that are split or active */ - if (surf == output->active || - ivi_layout_surface_is_split_or_fullscreen(surf)) + if ((surf == output->active && surf->role != IVI_SURFACE_ROLE_DESKTOP) || + ivi_layout_surface_is_split_or_fullscreen(surf)) { + weston_log("Found split || fullscreen surface. Refusing to activate!\n"); return; + } if (surf->role == IVI_SURFACE_ROLE_REMOTE) { struct ivi_output *remote_output = @@ -768,28 +842,7 @@ ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf) return; } - weston_desktop_surface_set_maximized(dsurf, true); - weston_desktop_surface_set_size(dsurf, - output->area.width, - output->area.height); - - weston_log("Setting app_id %s, role %s, set to maximized (%dx%d)\n", - app_id, ivi_layout_get_surface_role_name(surf), - output->area.width, output->area.height); - /* - * If the view isn't mapped, we put it onto the hidden layer so it will - * start receiving frame events, and will be able to act on our - * configure event. - */ - if (!weston_view_is_mapped(view)) { - view->is_mapped = true; - view->surface->is_mapped = true; - - weston_view_set_output(view, output->output); - weston_layer_entry_insert(&ivi->hidden.view_list, &view->layer_link); - weston_log("Placed app_id %s, type %s in hidden layer\n", - app_id, ivi_layout_get_surface_role_name(surf)); - } + ivi_layout_add_to_hidden_layer(surf, output); } void @@ -841,6 +894,8 @@ ivi_layout_get_output_from_surface(struct ivi_surface *surf) break; case IVI_SURFACE_ROLE_NONE: default: + if (surf->view->output) + return to_ivi_output(surf->view->output); break; } @@ -901,6 +956,9 @@ ivi_layout_deactivate(struct ivi_compositor *ivi, const char *app_id) } else if (surf->role == IVI_SURFACE_ROLE_POPUP) { struct weston_view *view = surf->view; + weston_view_unmap(view); + surf->state = HIDDEN; + weston_layer_entry_remove(&view->layer_link); weston_view_geometry_dirty(view); weston_surface_damage(view->surface);