desktop-shell: Reuse curtains for focus animations

Just as we do for fullscreen backgrounds, reuse the curtain infrastructure
for focus animations.

This introduces a small functional change, in that the surface's output
is no longer directly assigned. Instead, we call
weston_view_set_output() ourselves. As setting the weston_view's
position (done from the common helper function of weston_curtain_create
which has been introduced in previous commits) will call
weston_view_set_position(), the view's geometry will be dirtied as a
result.

When the geometry of a weston_view is dirty, it is marked to be updated,
which will occur whilst traversing the view list during output repaint.
This occurs for every view which is currently assigned to a layer; when
building the view list, any view reachable through the view list whose
geometry is dirty will have its position recalculated and an output
assigned. Doing so results in the surface's current output being
updated.

It is believed that there is no functional impact from the
weston_surface not having a primary output assigned between creation and
output repaint being called.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago
parent bd9b0676dd
commit e031397e09
  1. 47
      desktop-shell/shell.c

@ -537,16 +537,10 @@ get_focus_surface(struct weston_surface *surface)
return NULL;
}
static bool
is_focus_surface (struct weston_surface *es)
{
return (es->committed == focus_surface_committed);
}
static bool
is_focus_view (struct weston_view *view)
{
return is_focus_surface (view->surface);
return (view->surface->committed == focus_surface_committed);
}
static struct focus_surface *
@ -554,43 +548,26 @@ create_focus_surface(struct weston_compositor *ec,
struct weston_output *output)
{
struct focus_surface *fsurf = NULL;
struct weston_surface *surface = NULL;
struct weston_curtain_params curtain_params = {
.r = 0.0, .g = 0.0, .b = 0.0, .a = 1.0,
.x = output->x, .y = output->y,
.width = output->width, .height = output->height,
.surface_committed = focus_surface_committed,
.get_label = focus_surface_get_label,
.surface_private = NULL,
.capture_input = false,
};
fsurf = malloc(sizeof *fsurf);
if (!fsurf)
return NULL;
fsurf->surface = weston_surface_create(ec);
surface = fsurf->surface;
if (surface == NULL) {
free(fsurf);
return NULL;
}
surface->committed = focus_surface_committed;
surface->output = output;
surface->is_mapped = true;
surface->committed_private = fsurf;
weston_surface_set_label_func(surface, focus_surface_get_label);
curtain_params.surface_private = fsurf;
fsurf->view = weston_view_create(surface);
if (fsurf->view == NULL) {
weston_surface_destroy(surface);
free(fsurf);
return NULL;
}
fsurf->view = weston_curtain_create(ec, &curtain_params);
weston_view_set_output(fsurf->view, output);
fsurf->view->is_mapped = true;
weston_surface_set_size(surface, output->width, output->height);
weston_view_set_position(fsurf->view, output->x, output->y);
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
pixman_region32_fini(&surface->opaque);
pixman_region32_init_rect(&surface->opaque, 0, 0,
output->width, output->height);
pixman_region32_fini(&surface->input);
pixman_region32_init(&surface->input);
wl_list_init(&fsurf->workspace_transform.link);
return fsurf;

Loading…
Cancel
Save