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>
dev
Daniel Stone 2 years ago committed by Marius Vlad
parent 51fe874ad4
commit 0c69688aa2
  1. 2
      desktop-shell/input-panel.c
  2. 6
      desktop-shell/shell.c
  3. 2
      fullscreen-shell/fullscreen-shell.c
  4. 3
      include/libweston/libweston.h
  5. 2
      ivi-shell/ivi-layout.c
  6. 4
      kiosk-shell/kiosk-shell.c
  7. 2
      libweston-desktop/xwayland.c
  8. 31
      libweston/compositor.c
  9. 2
      libweston/data-device.c
  10. 2
      libweston/input.c
  11. 2
      libweston/touch-calibration.c
  12. 2
      tests/weston-test-desktop-shell.c
  13. 2
      tests/weston-test.c

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

@ -2501,7 +2501,7 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
if (!weston_surface_is_mapped(surface)) { if (!weston_surface_is_mapped(surface)) {
map(shell, shsurf, sx, sy); map(shell, shsurf, sx, sy);
surface->is_mapped = true; weston_surface_map(surface);
/* as we need to survive the weston_surface destruction we'll /* as we need to survive the weston_surface destruction we'll
* need to take another reference */ * need to take another reference */
if (shsurf->shell->win_close_animation_type == ANIMATION_FADE) { 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); 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; ev->is_mapped = true;
if (wl_list_empty(&ev->layer_link.link)) { 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, weston_layer_entry_insert(&shell->lock_layer.view_list,
&view->layer_link); &view->layer_link);
weston_view_update_transform(view); weston_view_update_transform(view);
surface->is_mapped = true; weston_surface_map(surface);
view->is_mapped = true; view->is_mapped = true;
shell_fade(shell, FADE_IN); shell_fade(shell, FADE_IN);
} }

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

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

@ -835,7 +835,7 @@ build_view_list(struct ivi_layout *layout)
weston_layer_entry_insert(&layout->layout_layer.view_list, weston_layer_entry_insert(&layout->layout_layer.view_list,
&ivi_view->view->layer_link); &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; ivi_view->view->is_mapped = true;
} }
} }

@ -523,7 +523,7 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput)
&shoutput->curtain->view->layer_link); &shoutput->curtain->view->layer_link);
shoutput->curtain->view->is_mapped = true; 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; shoutput->curtain->view->surface->output = output;
weston_view_set_output(shoutput->curtain->view, 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; struct kiosk_shell_seat *kiosk_seat;
shsurf->view->is_mapped = true; shsurf->view->is_mapped = true;
surface->is_mapped = true; weston_surface_map(surface);
kiosk_seat = get_kiosk_shell_seat(seat); kiosk_seat = get_kiosk_shell_seat(seat);
if (seat && kiosk_seat) if (seat && kiosk_seat)

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

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

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

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

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

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

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

Loading…
Cancel
Save