desktop: Rename layers to shell_layers

This code will be deleted later, but for the time being rename
it so it doesn't conflict with future properties.
This commit is contained in:
Alexander Orzechowski 2022-03-01 16:19:23 -05:00 committed by Kirill Primak
parent 2c69e19fd3
commit b4d7e84d38
6 changed files with 37 additions and 38 deletions

View file

@ -23,7 +23,7 @@ struct sway_output {
struct sway_server *server; struct sway_server *server;
struct wl_list link; struct wl_list link;
struct wl_list layers[4]; // sway_layer_surface::link struct wl_list shell_layers[4]; // sway_layer_surface::link
struct wlr_box usable_area; struct wlr_box usable_area;
struct timespec last_frame; struct timespec last_frame;

View file

@ -218,13 +218,13 @@ void arrange_layers(struct sway_output *output) {
&usable_area.width, &usable_area.height); &usable_area.width, &usable_area.height);
// Arrange exclusive surfaces from top->bottom // Arrange exclusive surfaces from top->bottom
arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
&usable_area, true); &usable_area, true);
arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
&usable_area, true); &usable_area, true);
arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
&usable_area, true); &usable_area, true);
arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
&usable_area, true); &usable_area, true);
if (memcmp(&usable_area, &output->usable_area, if (memcmp(&usable_area, &output->usable_area,
@ -235,13 +235,13 @@ void arrange_layers(struct sway_output *output) {
} }
// Arrange non-exclusive surfaces from top->bottom // Arrange non-exclusive surfaces from top->bottom
arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
&usable_area, false); &usable_area, false);
arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
&usable_area, false); &usable_area, false);
arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
&usable_area, false); &usable_area, false);
arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
&usable_area, false); &usable_area, false);
// Find topmost keyboard interactive layer, if such a layer exists // Find topmost keyboard interactive layer, if such a layer exists
@ -253,9 +253,8 @@ void arrange_layers(struct sway_output *output) {
struct sway_layer_surface *layer, *topmost = NULL; struct sway_layer_surface *layer, *topmost = NULL;
for (size_t i = 0; i < nlayers; ++i) { for (size_t i = 0; i < nlayers; ++i) {
wl_list_for_each_reverse(layer, wl_list_for_each_reverse(layer,
&output->layers[layers_above_shell[i]], link) { &output->shell_layers[layers_above_shell[i]], link) {
if (layer->layer_surface->current.keyboard_interactive if (layer->layer_surface->current.keyboard_interactive &&
== ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE &&
layer->layer_surface->surface->mapped) { layer->layer_surface->surface->mapped) {
topmost = layer; topmost = layer;
break; break;
@ -289,7 +288,7 @@ static struct sway_layer_surface *find_mapped_layer_by_client(
// For now we'll only check the overlay layer // For now we'll only check the overlay layer
struct sway_layer_surface *lsurface; struct sway_layer_surface *lsurface;
wl_list_for_each(lsurface, wl_list_for_each(lsurface,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) { &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) {
struct wl_resource *resource = lsurface->layer_surface->resource; struct wl_resource *resource = lsurface->layer_surface->resource;
if (wl_resource_get_client(resource) == client if (wl_resource_get_client(resource) == client
&& lsurface->layer_surface->surface->mapped) { && lsurface->layer_surface->surface->mapped) {
@ -343,7 +342,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
layer_changed = layer->layer != layer_surface->current.layer; layer_changed = layer->layer != layer_surface->current.layer;
if (layer_changed) { if (layer_changed) {
wl_list_remove(&layer->link); wl_list_remove(&layer->link);
wl_list_insert(&output->layers[layer_surface->current.layer], wl_list_insert(&output->shell_layers[layer_surface->current.layer],
&layer->link); &layer->link);
layer->layer = layer_surface->current.layer; layer->layer = layer_surface->current.layer;
} }
@ -716,6 +715,6 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
sway_layer->output_destroy.notify = handle_output_destroy; sway_layer->output_destroy.notify = handle_output_destroy;
wl_signal_add(&output->events.disable, &sway_layer->output_destroy); wl_signal_add(&output->events.disable, &sway_layer->output_destroy);
wl_list_insert(&output->layers[layer_surface->pending.layer], wl_list_insert(&output->shell_layers[layer_surface->pending.layer],
&sway_layer->link); &sway_layer->link);
} }

View file

@ -347,10 +347,10 @@ static void output_for_each_surface(struct sway_output *output,
#endif #endif
} else { } else {
output_layer_for_each_surface(output, output_layer_for_each_surface(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
iterator, user_data); iterator, user_data);
output_layer_for_each_surface(output, output_layer_for_each_surface(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
iterator, user_data); iterator, user_data);
workspace_for_each_container(workspace, workspace_for_each_container(workspace,
@ -361,13 +361,13 @@ static void output_for_each_surface(struct sway_output *output,
iterator, user_data); iterator, user_data);
#endif #endif
output_layer_for_each_surface(output, output_layer_for_each_surface(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
iterator, user_data); iterator, user_data);
} }
overlay: overlay:
output_layer_for_each_surface(output, output_layer_for_each_surface(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
iterator, user_data); iterator, user_data);
output_drag_icons_for_each_surface(output, &root->drag_icons, output_drag_icons_for_each_surface(output, &root->drag_icons,
iterator, user_data); iterator, user_data);
@ -399,7 +399,7 @@ struct sway_workspace *output_get_active_workspace(struct sway_output *output) {
bool output_has_opaque_overlay_layer_surface(struct sway_output *output) { bool output_has_opaque_overlay_layer_surface(struct sway_output *output) {
struct sway_layer_surface *sway_layer_surface; struct sway_layer_surface *sway_layer_surface;
wl_list_for_each(sway_layer_surface, wl_list_for_each(sway_layer_surface,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) { &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) {
struct wlr_surface *wlr_surface = sway_layer_surface->layer_surface->surface; struct wlr_surface *wlr_surface = sway_layer_surface->layer_surface->surface;
pixman_box32_t output_box = { pixman_box32_t output_box = {
.x2 = output->width, .x2 = output->width,
@ -488,7 +488,7 @@ static bool scan_out_fullscreen_view(struct sway_output *output,
} }
#endif #endif
if (!wl_list_empty(&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY])) { if (!wl_list_empty(&output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY])) {
return false; return false;
} }
if (!wl_list_empty(&root->drag_icons)) { if (!wl_list_empty(&root->drag_icons)) {

View file

@ -1098,9 +1098,9 @@ void output_render(struct render_context *ctx) {
}); });
render_layer_toplevel(ctx, render_layer_toplevel(ctx,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
render_layer_toplevel(ctx, render_layer_toplevel(ctx,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]);
render_workspace(ctx, workspace, workspace->current.focused); render_workspace(ctx, workspace, workspace->current.focused);
render_floating(ctx); render_floating(ctx);
@ -1108,14 +1108,14 @@ void output_render(struct render_context *ctx) {
render_unmanaged(ctx, &root->xwayland_unmanaged); render_unmanaged(ctx, &root->xwayland_unmanaged);
#endif #endif
render_layer_toplevel(ctx, render_layer_toplevel(ctx,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
render_layer_popups(ctx, render_layer_popups(ctx,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
render_layer_popups(ctx, render_layer_popups(ctx,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]);
render_layer_popups(ctx, render_layer_popups(ctx,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
} }
render_seatops(ctx); render_seatops(ctx);
@ -1128,9 +1128,9 @@ void output_render(struct render_context *ctx) {
render_overlay: render_overlay:
render_layer_toplevel(ctx, render_layer_toplevel(ctx,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
render_layer_popups(ctx, render_layer_popups(ctx,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
render_drag_icons(ctx, &root->drag_icons); render_drag_icons(ctx, &root->drag_icons);
renderer_end: renderer_end:

View file

@ -115,7 +115,7 @@ struct sway_node *node_at_coords(
// layer surfaces on the overlay layer are rendered on top // layer surfaces on the overlay layer are rendered on top
if ((*surface = layer_surface_at(output, if ((*surface = layer_surface_at(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
ox, oy, sx, sy))) { ox, oy, sx, sy))) {
return NULL; return NULL;
} }
@ -176,22 +176,22 @@ struct sway_node *node_at_coords(
return NULL; return NULL;
} }
if ((*surface = layer_surface_popup_at(output, if ((*surface = layer_surface_popup_at(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
ox, oy, sx, sy))) { ox, oy, sx, sy))) {
return NULL; return NULL;
} }
if ((*surface = layer_surface_popup_at(output, if ((*surface = layer_surface_popup_at(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
ox, oy, sx, sy))) { ox, oy, sx, sy))) {
return NULL; return NULL;
} }
if ((*surface = layer_surface_popup_at(output, if ((*surface = layer_surface_popup_at(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
ox, oy, sx, sy))) { ox, oy, sx, sy))) {
return NULL; return NULL;
} }
if ((*surface = layer_surface_at(output, if ((*surface = layer_surface_at(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
ox, oy, sx, sy))) { ox, oy, sx, sy))) {
return NULL; return NULL;
} }
@ -202,12 +202,12 @@ struct sway_node *node_at_coords(
} }
if ((*surface = layer_surface_at(output, if ((*surface = layer_surface_at(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
ox, oy, sx, sy))) { ox, oy, sx, sy))) {
return NULL; return NULL;
} }
if ((*surface = layer_surface_at(output, if ((*surface = layer_surface_at(output,
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
ox, oy, sx, sy))) { ox, oy, sx, sy))) {
return NULL; return NULL;
} }

View file

@ -102,9 +102,9 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
output->workspaces = create_list(); output->workspaces = create_list();
output->current.workspaces = create_list(); output->current.workspaces = create_list();
size_t len = sizeof(output->layers) / sizeof(output->layers[0]); size_t len = sizeof(output->shell_layers) / sizeof(output->shell_layers[0]);
for (size_t i = 0; i < len; ++i) { for (size_t i = 0; i < len; ++i) {
wl_list_init(&output->layers[i]); wl_list_init(&output->shell_layers[i]);
} }
return output; return output;