libweston: Add weston_surface_map() wrapper

Change all instances of surface->is_mapped = true, to a specialised
function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2022-06-12 20:51:45 +01:00 committed by Marius Vlad
parent 51fe874ad4
commit 0c69688aa2
13 changed files with 37 additions and 29 deletions

View File

@ -103,8 +103,8 @@ show_input_panel_surface(struct input_panel_surface *ipsurf)
&ipsurf->view->layer_link);
weston_view_geometry_dirty(ipsurf->view);
weston_view_update_transform(ipsurf->view);
ipsurf->surface->is_mapped = true;
ipsurf->view->is_mapped = true;
weston_surface_map(ipsurf->surface);
weston_surface_damage(ipsurf->surface);
if (ipsurf->anim)

View File

@ -2501,7 +2501,7 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
if (!weston_surface_is_mapped(surface)) {
map(shell, shsurf, sx, sy);
surface->is_mapped = true;
weston_surface_map(surface);
/* as we need to survive the weston_surface destruction we'll
* need to take another reference */
if (shsurf->shell->win_close_animation_type == ANIMATION_FADE) {
@ -2914,7 +2914,7 @@ configure_static_view(struct weston_view *ev, struct weston_layer *layer, int x,
}
weston_view_set_position(ev, ev->output->x + x, ev->output->y + y);
ev->surface->is_mapped = true;
weston_surface_map(ev->surface);
ev->is_mapped = true;
if (wl_list_empty(&ev->layer_link.link)) {
@ -3136,7 +3136,7 @@ lock_surface_committed(struct weston_surface *surface, int32_t sx, int32_t sy)
weston_layer_entry_insert(&shell->lock_layer.view_list,
&view->layer_link);
weston_view_update_transform(view);
surface->is_mapped = true;
weston_surface_map(surface);
view->is_mapped = true;
shell_fade(shell, FADE_IN);
}

View File

@ -327,7 +327,7 @@ fs_output_create(struct fullscreen_shell *shell, struct weston_output *output)
fsout->curtain = create_curtain(shell->compositor, fsout,
output->x, output->y,
output->width, output->height);
fsout->curtain->view->surface->is_mapped = true;
weston_surface_map(fsout->curtain->view->surface);
fsout->curtain->view->is_mapped = true;
weston_layer_entry_insert(&shell->layer.view_list,
&fsout->curtain->view->layer_link);

View File

@ -1971,6 +1971,9 @@ weston_view_damage_below(struct weston_view *view);
void
weston_view_unmap(struct weston_view *view);
void
weston_surface_map(struct weston_surface *surface);
void
weston_surface_unmap(struct weston_surface *surface);

View File

@ -835,7 +835,7 @@ build_view_list(struct ivi_layout *layout)
weston_layer_entry_insert(&layout->layout_layer.view_list,
&ivi_view->view->layer_link);
ivi_view->ivisurf->surface->is_mapped = true;
weston_surface_map(ivi_view->ivisurf->surface);
ivi_view->view->is_mapped = true;
}
}

View File

@ -523,7 +523,7 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput)
&shoutput->curtain->view->layer_link);
shoutput->curtain->view->is_mapped = true;
shoutput->curtain->view->surface->is_mapped = true;
weston_surface_map(shoutput->curtain->view->surface);
shoutput->curtain->view->surface->output = output;
weston_view_set_output(shoutput->curtain->view, output);
}
@ -799,7 +799,7 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
struct kiosk_shell_seat *kiosk_seat;
shsurf->view->is_mapped = true;
surface->is_mapped = true;
weston_surface_map(surface);
kiosk_seat = get_kiosk_shell_seat(seat);
if (seat && kiosk_seat)

View File

@ -122,7 +122,7 @@ weston_desktop_xwayland_surface_change_state(struct weston_desktop_xwayland_surf
weston_layer_entry_insert(&surface->xwayland->layer.view_list,
&surface->view->layer_link);
surface->view->is_mapped = true;
wsurface->is_mapped = true;
weston_surface_map(wsurface);
}
surface->state = state;

View File

@ -2261,6 +2261,12 @@ weston_view_unmap(struct weston_view *view)
}
}
WL_EXPORT void
weston_surface_map(struct weston_surface *surface)
{
surface->is_mapped = true;
}
WL_EXPORT void
weston_surface_unmap(struct weston_surface *surface)
{
@ -4529,22 +4535,21 @@ subsurface_committed(struct weston_surface *surface, int32_t dx, int32_t dy)
* mapped, parent is not in a visible layer, so this sub-surface
* will not be drawn either.
*/
if (!weston_surface_is_mapped(surface)) {
surface->is_mapped = weston_surface_has_content(surface);
/* Cannot call weston_view_update_transform(),
* because that would call it also for the parent surface,
* which might not be mapped yet. That would lead to
* inconsistent state, where the window could never be
* mapped.
*
* Instead just force the is_mapped flag on, to make
* weston_surface_is_mapped() return true, so that when the
* parent surface does get mapped, this one will get
* included, too. See view_list_add().
*/
if (!weston_surface_is_mapped(surface) &&
weston_surface_has_content(surface)) {
weston_surface_map(surface);
}
/* Cannot call weston_view_update_transform() here, because that would
* call it also for the parent surface, which might not be mapped yet.
* That would lead to inconsistent state, where the window could never
* be mapped.
*
* Instead just force the child surface to appear mapped, to make
* weston_surface_is_mapped() return true, so that when the parent
* surface does get mapped, this one will get included, too. See
* view_list_add().
*/
}
static struct weston_subsurface *

View File

@ -431,7 +431,7 @@ drag_surface_configure(struct weston_drag *drag,
weston_layer_entry_insert(list, &drag->icon->layer_link);
weston_view_update_transform(drag->icon);
pixman_region32_clear(&es->pending.input);
es->is_mapped = true;
weston_surface_map(es);
drag->icon->is_mapped = true;
}

View File

@ -2697,7 +2697,7 @@ pointer_cursor_surface_committed(struct weston_surface *es,
weston_layer_entry_insert(&es->compositor->cursor_layer.view_list,
&pointer->sprite->layer_link);
weston_view_update_transform(pointer->sprite);
es->is_mapped = true;
weston_surface_map(es);
pointer->sprite->is_mapped = true;
}
}

View File

@ -206,7 +206,7 @@ map_calibrator(struct weston_touch_calibrator *calibrator)
calibrator->view->is_mapped = true;
calibrator->surface->output = calibrator->output;
calibrator->surface->is_mapped = true;
weston_surface_map(calibrator->surface);
weston_output_schedule_repaint(calibrator->output);

View File

@ -92,7 +92,7 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
if (weston_surface_is_mapped(surface))
return;
surface->is_mapped = true;
weston_surface_map(surface);
weston_layer_entry_insert(&dts->layer.view_list, &dts->view->layer_link);
weston_view_set_position(dts->view, 0 - geometry.x, 0 - geometry.y);
weston_view_update_transform(dts->view);

View File

@ -164,7 +164,7 @@ test_surface_committed(struct weston_surface *surface, int32_t sx, int32_t sy)
weston_view_update_transform(test_surface->view);
test_surface->surface->is_mapped = true;
weston_surface_map(test_surface->surface);
test_surface->view->is_mapped = true;
}