2 * Copyright © 2019 Collabora, Ltd.
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial
14 * portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 #include "ivi-compositor.h"
28 #include "shared/helpers.h"
33 #include <libweston/libweston.h>
34 #include <libweston-desktop/libweston-desktop.h>
36 #include "agl-shell-desktop-server-protocol.h"
38 #define AGL_COMP_DEBUG
40 static const char *ivi_roles_as_string[] = {
41 [IVI_SURFACE_ROLE_NONE] = "NONE",
42 [IVI_SURFACE_ROLE_BACKGROUND] = "BACKGROUND",
43 [IVI_SURFACE_ROLE_PANEL] = "PANEL",
44 [IVI_SURFACE_ROLE_DESKTOP] = "DESKTOP",
45 [IVI_SURFACE_ROLE_POPUP] = "POPUP",
46 [IVI_SURFACE_ROLE_SPLIT_H] = "SPLIT_H",
47 [IVI_SURFACE_ROLE_SPLIT_V] = "SPLIT_V",
48 [IVI_SURFACE_ROLE_FULLSCREEN] = "FULLSCREEN",
49 [IVI_SURFACE_ROLE_REMOTE] = "REMOTE",
53 ivi_layout_get_surface_role_name(struct ivi_surface *surf)
55 if (surf->role < 0 || surf->role >= ARRAY_LENGTH(ivi_roles_as_string))
56 return " unknown surface role";
58 return ivi_roles_as_string[surf->role];
62 ivi_background_init(struct ivi_compositor *ivi, struct ivi_output *output)
64 struct weston_output *woutput = output->output;
65 struct ivi_surface *bg = output->background;
66 struct weston_view *view;
69 weston_log("WARNING: Output does not have a background\n");
73 assert(bg->role == IVI_SURFACE_ROLE_BACKGROUND);
77 weston_view_set_output(view, woutput);
78 weston_view_set_position(view, woutput->x, woutput->y);
80 weston_log("(background) position view %p, x %d, y %d, on output %s\n", view,
81 woutput->x, woutput->y, output->name);
83 view->is_mapped = true;
84 view->surface->is_mapped = true;
86 weston_layer_entry_insert(&ivi->background.view_list, &view->layer_link);
90 ivi_panel_init(struct ivi_compositor *ivi, struct ivi_output *output,
91 struct ivi_surface *panel)
93 struct weston_output *woutput = output->output;
94 struct weston_desktop_surface *dsurface;
95 struct weston_view *view;
96 struct weston_geometry geom;
103 assert(panel->role == IVI_SURFACE_ROLE_PANEL);
104 dsurface = panel->dsurface;
106 geom = weston_desktop_surface_get_geometry(dsurface);
108 weston_log("(panel) geom.width %d, geom.height %d, geom.x %d, geom.y %d\n",
109 geom.width, geom.height, geom.x, geom.y);
111 switch (panel->panel.edge) {
112 case AGL_SHELL_EDGE_TOP:
113 output->area.y += geom.height;
114 output->area.height -= geom.height;
116 case AGL_SHELL_EDGE_BOTTOM:
117 y += woutput->height - geom.height;
118 output->area.height -= geom.height;
120 case AGL_SHELL_EDGE_LEFT:
121 output->area.x += geom.width;
122 output->area.width -= geom.width;
124 case AGL_SHELL_EDGE_RIGHT:
125 x += woutput->width - geom.width;
126 output->area.width -= geom.width;
133 weston_view_set_output(view, woutput);
134 weston_view_set_position(view, x, y);
136 weston_log("(panel) edge %d position view %p, x %d, y %d\n",
137 panel->panel.edge, view, x, y);
139 view->is_mapped = true;
140 view->surface->is_mapped = true;
142 weston_log("panel type %d inited on output %s\n", panel->panel.edge,
145 weston_layer_entry_insert(&ivi->panel.view_list, &view->layer_link);
149 * Initializes all static parts of the layout, i.e. the background and panels.
152 ivi_layout_init(struct ivi_compositor *ivi, struct ivi_output *output)
154 ivi_background_init(ivi, output);
158 output->area.width = output->output->width;
159 output->area.height = output->output->height;
161 ivi_panel_init(ivi, output, output->top);
162 ivi_panel_init(ivi, output, output->bottom);
163 ivi_panel_init(ivi, output, output->left);
164 ivi_panel_init(ivi, output, output->right);
166 weston_compositor_schedule_repaint(ivi->compositor);
168 weston_log("Usable area: %dx%d+%d,%d\n",
169 output->area.width, output->area.height,
170 output->area.x, output->area.y);
174 ivi_find_app(struct ivi_compositor *ivi, const char *app_id)
176 struct ivi_surface *surf;
179 wl_list_for_each(surf, &ivi->surfaces, link) {
180 id = weston_desktop_surface_get_app_id(surf->dsurface);
181 if (id && strcmp(app_id, id) == 0)
189 ivi_layout_activate_complete(struct ivi_output *output,
190 struct ivi_surface *surf)
192 struct ivi_compositor *ivi = output->ivi;
193 struct weston_output *woutput = output->output;
194 struct weston_view *view = surf->view;
196 if (weston_view_is_mapped(view)) {
197 weston_layer_entry_remove(&view->layer_link);
200 weston_view_set_output(view, woutput);
201 weston_view_set_position(view,
202 woutput->x + output->area.x,
203 woutput->y + output->area.y);
205 view->is_mapped = true;
206 view->surface->is_mapped = true;
208 if (output->active) {
209 output->active->view->is_mapped = false;
210 output->active->view->surface->is_mapped = false;
212 weston_layer_entry_remove(&output->active->view->layer_link);
214 output->previous_active = output->active;
215 output->active = surf;
217 weston_layer_entry_insert(&ivi->normal.view_list, &view->layer_link);
218 weston_view_update_transform(view);
220 /* force repaint of the entire output */
221 weston_output_damage(output->output);
224 * the 'remote' role now makes use of this part so make sure we don't
225 * trip the enum such that we might end up with a modified output for
228 if (surf->role == IVI_SURFACE_ROLE_DESKTOP) {
229 if (surf->desktop.pending_output)
230 surf->desktop.last_output = surf->desktop.pending_output;
231 surf->desktop.pending_output = NULL;
234 weston_log("Activation completed for app_id %s, role %s, output %s\n",
235 weston_desktop_surface_get_app_id(surf->dsurface),
236 ivi_layout_get_surface_role_name(surf), output->name);
240 ivi_layout_find_with_app_id(const char *app_id, struct ivi_compositor *ivi)
242 struct ivi_output *out;
247 wl_list_for_each(out, &ivi->outputs, link) {
251 if (!strcmp(app_id, out->app_id))
259 static struct ivi_output *
260 ivi_layout_find_bg_output(struct ivi_compositor *ivi)
262 struct ivi_output *out;
264 wl_list_for_each(out, &ivi->outputs, link) {
265 if (out->background &&
266 out->background->role == IVI_SURFACE_ROLE_BACKGROUND)
274 ivi_layout_desktop_committed(struct ivi_surface *surf)
276 struct weston_desktop_surface *dsurf = surf->dsurface;
277 struct weston_geometry geom = weston_desktop_surface_get_geometry(dsurf);
278 struct ivi_policy *policy = surf->ivi->policy;
279 struct ivi_output *output;
280 const char *app_id = weston_desktop_surface_get_app_id(dsurf);
282 assert(surf->role == IVI_SURFACE_ROLE_DESKTOP ||
283 surf->role == IVI_SURFACE_ROLE_REMOTE);
286 * we can't make use here of the ivi_layout_get_output_from_surface()
287 * due to the fact that we'll always land here when a surface performs
288 * a commit and pending_output will not bet set. This works in tandem
289 * with 'activated_by_default' at this point to avoid tripping over
290 * to a surface that continuously updates its content
292 if (surf->role == IVI_SURFACE_ROLE_DESKTOP)
293 output = surf->desktop.pending_output;
295 output = surf->remote.output;
297 if (surf->role == IVI_SURFACE_ROLE_DESKTOP && !output) {
298 struct ivi_output *r_output;
300 if (policy && policy->api.surface_activate_by_default &&
301 !policy->api.surface_activate_by_default(surf, surf->ivi))
304 /* we can only activate it again by using the protocol */
305 if (surf->activated_by_default)
308 /* check first if there aren't any outputs being set */
309 r_output = ivi_layout_find_with_app_id(app_id, surf->ivi);
312 struct weston_view *view = r_output->fullscreen_view.fs->view;
313 if (view->is_mapped || view->surface->is_mapped)
314 remove_black_surface(r_output);
318 /* try finding an output with a background and use that */
320 r_output = ivi_layout_find_bg_output(surf->ivi);
322 /* if we couldn't still find an output by this point, there's
323 * something wrong so we abort with a protocol error */
325 wl_resource_post_error(surf->ivi->shell_client.resource,
326 AGL_SHELL_ERROR_INVALID_ARGUMENT,
327 "No valid output found to activate surface by default");
331 if (!surf->ivi->activate_by_default) {
332 weston_log("Refusing to activate surface role %d, app_id %s\n",
337 /* use the output of the bg to activate the app on start-up by
339 if (surf->view && r_output) {
340 if (app_id && r_output) {
341 weston_log("Surface with app_id %s, role %s activating by default\n",
342 weston_desktop_surface_get_app_id(surf->dsurface),
343 ivi_layout_get_surface_role_name(surf));
344 ivi_layout_activate(r_output, app_id);
345 surf->activated_by_default = true;
346 } else if (!app_id) {
348 * applications not setting an app_id, or
349 * setting an app_id but at a later point in
350 * time, might fall-back here so give them a
351 * chance to receive the configure event and
354 weston_log("Surface no app_id, role %s activating by default\n",
355 ivi_layout_get_surface_role_name(surf));
356 ivi_layout_activate_by_surf(r_output, surf);
357 surf->activated_by_default = true;
364 if (surf->role == IVI_SURFACE_ROLE_REMOTE && output) {
365 if (policy && policy->api.surface_activate_by_default &&
366 !policy->api.surface_activate_by_default(surf, surf->ivi))
369 /* we can only activate it again by using the protocol, but
370 * additionally the output is not reset when
371 * ivi_layout_activate_complete() terminates so we use the
372 * current active surface to avoid hitting this again and again
374 if (surf->activated_by_default && output->active == surf)
378 weston_log("Surface with app_id %s, role %s activating by default\n",
379 weston_desktop_surface_get_app_id(surf->dsurface),
380 ivi_layout_get_surface_role_name(surf));
381 ivi_layout_activate(output, app_id);
382 surf->activated_by_default = true;
387 if (!weston_desktop_surface_get_maximized(dsurf) ||
388 geom.width != output->area.width ||
389 geom.height != output->area.height)
392 ivi_layout_activate_complete(output, surf);
396 ivi_layout_fullscreen_committed(struct ivi_surface *surface)
398 struct ivi_compositor *ivi = surface->ivi;
399 struct ivi_policy *policy = ivi->policy;
401 struct weston_desktop_surface *dsurface = surface->dsurface;
402 struct weston_surface *wsurface =
403 weston_desktop_surface_get_surface(dsurface);
404 const char *app_id = weston_desktop_surface_get_app_id(dsurface);
406 struct ivi_output *output = surface->split.output;
407 struct weston_output *woutput = output->output;
409 struct weston_view *view = surface->view;
410 struct weston_geometry geom;
412 if (policy && policy->api.surface_activate_by_default &&
413 !policy->api.surface_activate_by_default(surface, surface->ivi) &&
414 !surface->activated_by_default)
417 if (surface->view->is_mapped)
420 geom = weston_desktop_surface_get_geometry(dsurface);
421 weston_log("(fs) geom x %d, y %d, width %d, height %d\n", geom.x, geom.y,
422 geom.width, geom.height);
424 assert(surface->role == IVI_SURFACE_ROLE_FULLSCREEN);
426 weston_desktop_surface_set_fullscreen(dsurface, true);
428 weston_view_set_output(view, woutput);
429 weston_view_set_position(view, woutput->x, woutput->y);
430 weston_layer_entry_insert(&ivi->fullscreen.view_list, &view->layer_link);
432 weston_view_update_transform(view);
433 weston_view_damage_below(view);
435 wsurface->is_mapped = true;
436 surface->view->is_mapped = true;
438 shell_advertise_app_state(ivi, app_id,
439 NULL, AGL_SHELL_DESKTOP_APP_STATE_ACTIVATED);
441 weston_log("Activation completed for app_id %s, role %s, output %s\n",
442 app_id, ivi_layout_get_surface_role_name(surface), output->name);
446 ivi_layout_desktop_resize(struct ivi_surface *surface,
447 struct weston_geometry area)
449 struct weston_desktop_surface *dsurf = surface->dsurface;
450 struct weston_view *view = surface->view;
454 int width = area.width;
455 int height = area.height;
457 weston_desktop_surface_set_size(dsurf,
460 weston_view_set_position(view, x, y);
461 weston_view_update_transform(view);
462 weston_view_damage_below(view);
466 ivi_layout_split_committed(struct ivi_surface *surface)
468 struct ivi_compositor *ivi = surface->ivi;
469 struct ivi_policy *policy = ivi->policy;
471 struct weston_desktop_surface *dsurface = surface->dsurface;
472 struct weston_surface *wsurface =
473 weston_desktop_surface_get_surface(dsurface);
474 const char *app_id = weston_desktop_surface_get_app_id(dsurface);
476 struct ivi_output *output = surface->split.output;
477 struct weston_output *woutput = output->output;
479 struct weston_view *view = surface->view;
480 struct weston_geometry geom;
488 if (policy && policy->api.surface_activate_by_default &&
489 !policy->api.surface_activate_by_default(surface, surface->ivi) &&
490 !surface->activated_by_default)
493 if (surface->view->is_mapped)
496 geom = weston_desktop_surface_get_geometry(dsurface);
498 assert(surface->role == IVI_SURFACE_ROLE_SPLIT_H ||
499 surface->role == IVI_SURFACE_ROLE_SPLIT_V);
501 /* save the previous area in order to recover it back when if this kind
502 * of surface is being destroyed/removed */
503 output->area_saved = output->area;
505 switch (surface->role) {
506 case IVI_SURFACE_ROLE_SPLIT_V:
507 geom.width = (output->area.width / 2);
509 x += woutput->width - geom.width;
510 output->area.width -= geom.width;
512 width = woutput->width - x;
513 height = output->area.height;
517 case IVI_SURFACE_ROLE_SPLIT_H:
518 geom.height = (output->area.height / 2);
521 output->area.y += geom.height;
522 output->area.height -= geom.height;
524 width = output->area.width;
525 height = output->area.height;
531 assert(!"Invalid split orientation\n");
534 weston_desktop_surface_set_size(dsurface,
537 /* resize the active surface first, output->area already contains
538 * correct area to resize to */
540 ivi_layout_desktop_resize(output->active, output->area);
542 weston_view_set_output(view, woutput);
543 weston_view_set_position(view, x, y);
544 weston_layer_entry_insert(&ivi->normal.view_list, &view->layer_link);
546 weston_view_update_transform(view);
547 weston_view_damage_below(view);
549 wsurface->is_mapped = true;
550 surface->view->is_mapped = true;
552 shell_advertise_app_state(ivi, app_id,
553 NULL, AGL_SHELL_DESKTOP_APP_STATE_ACTIVATED);
555 weston_log("Activation completed for app_id %s, role %s, output %s\n",
556 app_id, ivi_layout_get_surface_role_name(surface), output->name);
560 ivi_layout_popup_committed(struct ivi_surface *surface)
562 struct ivi_compositor *ivi = surface->ivi;
563 struct ivi_policy *policy = ivi->policy;
565 struct weston_desktop_surface *dsurface = surface->dsurface;
566 struct weston_surface *wsurface =
567 weston_desktop_surface_get_surface(dsurface);
568 const char *app_id = weston_desktop_surface_get_app_id(dsurface);
570 struct ivi_output *output = surface->popup.output;
571 struct weston_output *woutput = output->output;
573 struct weston_view *view = surface->view;
575 if (policy && policy->api.surface_activate_by_default &&
576 !policy->api.surface_activate_by_default(surface, surface->ivi) &&
577 !surface->activated_by_default)
580 if (surface->view->is_mapped)
583 assert(surface->role == IVI_SURFACE_ROLE_POPUP);
585 weston_view_set_output(view, woutput);
586 weston_view_set_position(view, surface->popup.x, surface->popup.y);
588 /* only clip the pop-up dialog window if we have a valid
589 * width and height being passed on. Users might not want to have one
590 * set-up so only enfore it is really passed on. */
591 if (surface->popup.bb.width > 0 && surface->popup.bb.height > 0)
592 weston_view_set_mask(view, surface->popup.bb.x, surface->popup.bb.y,
593 surface->popup.bb.width, surface->popup.bb.height);
595 weston_layer_entry_insert(&ivi->popup.view_list, &view->layer_link);
597 weston_view_update_transform(view);
598 weston_view_damage_below(view);
600 wsurface->is_mapped = true;
601 surface->view->is_mapped = true;
603 shell_advertise_app_state(ivi, app_id,
604 NULL, AGL_SHELL_DESKTOP_APP_STATE_ACTIVATED);
606 weston_log("Activation completed for app_id %s, role %s, output %s\n",
607 app_id, ivi_layout_get_surface_role_name(surface), output->name);
611 ivi_layout_popup_re_add(struct ivi_surface *surface)
613 assert(surface->role == IVI_SURFACE_ROLE_POPUP);
614 struct weston_view *view = surface->view;
616 if (weston_view_is_mapped(view)) {
617 struct weston_desktop_surface *dsurface = surface->dsurface;
618 struct weston_surface *wsurface =
619 weston_desktop_surface_get_surface(dsurface);
621 weston_layer_entry_remove(&view->layer_link);
623 wsurface->is_mapped = false;
624 view->is_mapped = false;
627 /* reset the activate by default in order to (still) allow the surface
628 * to be activaved using the request */
629 if (!surface->activated_by_default)
630 surface->activated_by_default = true;
632 ivi_layout_popup_committed(surface);
636 ivi_layout_surface_is_split_or_fullscreen(struct ivi_surface *surf)
638 struct ivi_compositor *ivi = surf->ivi;
639 struct ivi_surface *is;
641 if (surf->role != IVI_SURFACE_ROLE_SPLIT_H &&
642 surf->role != IVI_SURFACE_ROLE_SPLIT_V &&
643 surf->role != IVI_SURFACE_ROLE_FULLSCREEN)
646 /* reset the activate by default in order to (still) allow the surface
647 * to be activaved using the request */
648 if (!surf->activated_by_default)
649 surf->activated_by_default = true;
651 wl_list_for_each(is, &ivi->surfaces, link)
659 ivi_layout_activate_by_surf(struct ivi_output *output, struct ivi_surface *surf)
661 struct ivi_compositor *ivi = output->ivi;
662 struct weston_desktop_surface *dsurf;
663 struct weston_view *view;
664 struct weston_geometry geom;
665 struct ivi_policy *policy = output->ivi->policy;
667 dsurf = surf->dsurface;
670 const char *app_id = weston_desktop_surface_get_app_id(dsurf);
675 if (policy && policy->api.surface_activate &&
676 !policy->api.surface_activate(surf, surf->ivi)) {
680 #ifdef AGL_COMP_DEBUG
681 weston_log("Activating app_id %s, type %s\n", app_id,
682 ivi_layout_get_surface_role_name(surf));
685 if (surf->role == IVI_SURFACE_ROLE_POPUP) {
686 ivi_layout_popup_re_add(surf);
690 /* do not 're'-activate surfaces that are split or active */
691 if (surf == output->active ||
692 ivi_layout_surface_is_split_or_fullscreen(surf))
695 if (surf->role == IVI_SURFACE_ROLE_REMOTE) {
696 struct ivi_output *remote_output =
697 ivi_layout_find_with_app_id(app_id, ivi);
699 /* if already active on a remote output do not
700 * attempt to activate it again */
701 if (remote_output && remote_output->active == surf)
706 geom = weston_desktop_surface_get_geometry(dsurf);
708 if (surf->role == IVI_SURFACE_ROLE_DESKTOP)
709 surf->desktop.pending_output = output;
710 if (weston_desktop_surface_get_maximized(dsurf) &&
711 geom.width == output->area.width &&
712 geom.height == output->area.height) {
713 ivi_layout_activate_complete(output, surf);
717 weston_desktop_surface_set_maximized(dsurf, true);
718 weston_desktop_surface_set_size(dsurf,
720 output->area.height);
722 weston_log("Setting app_id %s, role %s, set to maximized (%dx%d)\n",
723 app_id, ivi_layout_get_surface_role_name(surf),
724 output->area.width, output->area.height);
726 * If the view isn't mapped, we put it onto the hidden layer so it will
727 * start receiving frame events, and will be able to act on our
730 if (!weston_view_is_mapped(view)) {
731 view->is_mapped = true;
732 view->surface->is_mapped = true;
734 weston_view_set_output(view, output->output);
735 weston_layer_entry_insert(&ivi->hidden.view_list, &view->layer_link);
736 /* force repaint of the entire output */
738 weston_log("Placed app_id %s, type %s in hidden layer\n",
739 app_id, ivi_layout_get_surface_role_name(surf));
740 weston_output_damage(output->output);
745 ivi_layout_activate(struct ivi_output *output, const char *app_id)
747 struct ivi_surface *surf;
748 struct ivi_compositor *ivi = output->ivi;
753 surf = ivi_find_app(ivi, app_id);
757 ivi_layout_activate_by_surf(output, surf);
761 ivi_layout_get_output_from_surface(struct ivi_surface *surf)
763 struct ivi_output *ivi_output = NULL;
765 switch (surf->role) {
766 case IVI_SURFACE_ROLE_DESKTOP:
767 if (surf->desktop.pending_output)
768 ivi_output = surf->desktop.pending_output;
770 ivi_output = surf->desktop.last_output;
772 case IVI_SURFACE_ROLE_POPUP:
773 ivi_output = surf->popup.output;
775 case IVI_SURFACE_ROLE_BACKGROUND:
776 ivi_output = surf->bg.output;
778 case IVI_SURFACE_ROLE_PANEL:
779 ivi_output = surf->panel.output;
781 case IVI_SURFACE_ROLE_FULLSCREEN:
782 ivi_output = surf->fullscreen.output;
784 case IVI_SURFACE_ROLE_SPLIT_H:
785 case IVI_SURFACE_ROLE_SPLIT_V:
786 ivi_output = surf->split.output;
788 case IVI_SURFACE_ROLE_REMOTE:
789 ivi_output = surf->remote.output;
791 case IVI_SURFACE_ROLE_NONE:
800 ivi_layout_deactivate(struct ivi_compositor *ivi, const char *app_id)
802 struct ivi_surface *surf;
803 struct ivi_output *ivi_output;
804 struct ivi_policy *policy = ivi->policy;
809 surf = ivi_find_app(ivi, app_id);
813 if (policy && policy->api.surface_deactivate &&
814 !policy->api.surface_deactivate(surf, surf->ivi)) {
818 ivi_output = ivi_layout_get_output_from_surface(surf);
819 weston_log("Deactiving %s, role %s\n", app_id,
820 ivi_layout_get_surface_role_name(surf));
822 if (surf->role == IVI_SURFACE_ROLE_DESKTOP) {
823 struct ivi_surface *previous_active;
825 previous_active = ivi_output->previous_active;
826 if (!previous_active) {
827 /* we don't have a previous active it means we should
829 if (ivi_output->active) {
830 struct weston_view *view;
832 view = ivi_output->active->view;
833 view->is_mapped = false;
834 view->surface->is_mapped = false;
836 weston_layer_entry_remove(&view->layer_link);
837 weston_output_damage(ivi_output->output);
838 ivi_output->active = NULL;
841 struct weston_desktop_surface *dsurface;
842 const char *previous_active_app_id;
844 dsurface = previous_active->dsurface;
845 previous_active_app_id =
846 weston_desktop_surface_get_app_id(dsurface);
847 ivi_layout_activate(ivi_output, previous_active_app_id);
849 } else if (surf->role == IVI_SURFACE_ROLE_POPUP) {
850 struct weston_view *view = surf->view;
852 weston_layer_entry_remove(&view->layer_link);
853 weston_view_damage_below(view);