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
+20 -15
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 *
+1 -1
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;
}
+1 -1
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;
}
}
+1 -1
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);