Skip to content

Commit c3415ae

Browse files
committed
fullscreen-shell: Use weston_curtain for black view
Use the common helper provided by the shell-utils helper dependency, rather than rolling our own. This commit currently introduces no functional change to fullscreen-shell, as the 'curtain' provided by shell-utils behaves identically to the previous solid-color surface created by fullscreen-shell, given the parameters provided to weston_curtain_create(). However, now that a common weston_curtain implementation is being used rather than an open-coded variant, future changes to the implementation of weston_curtain will result in changes to this code called by fullscreen-shell, although it is intended that these will not result in any user-visible behavioural changes. Signed-off-by: Daniel Stone <[email protected]>
1 parent b94d69b commit c3415ae

File tree

1 file changed

+24
-34
lines changed

1 file changed

+24
-34
lines changed

fullscreen-shell/fullscreen-shell.c

+24-34
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct fs_output {
8181
struct weston_surface *surface;
8282
struct wl_listener surface_destroyed;
8383
struct weston_view *view;
84-
struct weston_view *black_view;
84+
struct weston_curtain *curtain;
8585
struct weston_transform transform; /* matrix from x, y */
8686

8787
int presented_for_mode;
@@ -227,37 +227,27 @@ black_surface_committed(struct weston_surface *es, int32_t sx, int32_t sy)
227227
{
228228
}
229229

230-
static struct weston_view *
231-
create_black_surface(struct weston_compositor *ec, struct fs_output *fsout,
232-
float x, float y, int w, int h)
230+
static struct weston_curtain *
231+
create_curtain(struct weston_compositor *ec, struct fs_output *fsout,
232+
float x, float y, int w, int h)
233233
{
234-
struct weston_surface *surface = NULL;
235-
struct weston_view *view;
234+
struct weston_curtain_params curtain_params = {
235+
.r = 0.0, .g = 0.0, .b = 0.0, .a = 1.0,
236+
.x = x, .y = y, .width = w, .height = h,
237+
.surface_committed = black_surface_committed,
238+
.get_label = NULL,
239+
.surface_private = fsout,
240+
.capture_input = true,
241+
};
242+
struct weston_curtain *curtain;
236243

237-
surface = weston_surface_create(ec);
238-
if (surface == NULL) {
239-
weston_log("no memory\n");
240-
return NULL;
241-
}
242-
view = weston_view_create(surface);
243-
if (!view) {
244-
weston_surface_destroy(surface);
244+
curtain = weston_curtain_create(ec, &curtain_params);
245+
if (!curtain) {
245246
weston_log("no memory\n");
246247
return NULL;
247248
}
248249

249-
surface->committed = black_surface_committed;
250-
surface->committed_private = fsout;
251-
weston_surface_set_color(surface, 0.0f, 0.0f, 0.0f, 1.0f);
252-
pixman_region32_fini(&surface->opaque);
253-
pixman_region32_init_rect(&surface->opaque, 0, 0, w, h);
254-
pixman_region32_fini(&surface->input);
255-
pixman_region32_init_rect(&surface->input, 0, 0, w, h);
256-
257-
weston_surface_set_size(surface, w, h);
258-
weston_view_set_position(view, x, y);
259-
260-
return view;
250+
return curtain;
261251
}
262252

263253
static void
@@ -334,13 +324,13 @@ fs_output_create(struct fullscreen_shell *shell, struct weston_output *output)
334324

335325
fsout->surface_destroyed.notify = surface_destroyed;
336326
fsout->pending.surface_destroyed.notify = pending_surface_destroyed;
337-
fsout->black_view = create_black_surface(shell->compositor, fsout,
338-
output->x, output->y,
339-
output->width, output->height);
340-
fsout->black_view->surface->is_mapped = true;
341-
fsout->black_view->is_mapped = true;
327+
fsout->curtain = create_curtain(shell->compositor, fsout,
328+
output->x, output->y,
329+
output->width, output->height);
330+
fsout->curtain->view->surface->is_mapped = true;
331+
fsout->curtain->view->is_mapped = true;
342332
weston_layer_entry_insert(&shell->layer.view_list,
343-
&fsout->black_view->layer_link);
333+
&fsout->curtain->view->layer_link);
344334
wl_list_init(&fsout->transform.link);
345335

346336
if (!wl_list_empty(&shell->default_surface_list)) {
@@ -486,10 +476,10 @@ fs_output_configure_simple(struct fs_output *fsout,
486476
break;
487477
}
488478

489-
weston_view_set_position(fsout->black_view,
479+
weston_view_set_position(fsout->curtain->view,
490480
fsout->output->x - surf_x,
491481
fsout->output->y - surf_y);
492-
weston_surface_set_size(fsout->black_view->surface,
482+
weston_surface_set_size(fsout->curtain->view->surface,
493483
fsout->output->width,
494484
fsout->output->height);
495485
}

0 commit comments

Comments
 (0)