aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Alexander Orzechowski <orzechowski.alexander@gmail.com>2022-03-01 16:19:23 -0500
committerLibravatar Kirill Primak <vyivel@eclair.cafe>2024-01-18 18:36:54 +0300
commitb4d7e84d3852ea93d2aab22f5993f84a7060b950 (patch)
treeb3b3e32af7044e3af6679482a861e650e20eed62
parentlayer-shell: don't configure uninitialized surfaces (diff)
downloadsway-b4d7e84d3852ea93d2aab22f5993f84a7060b950.tar.gz
sway-b4d7e84d3852ea93d2aab22f5993f84a7060b950.tar.zst
sway-b4d7e84d3852ea93d2aab22f5993f84a7060b950.zip
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.
-rw-r--r--include/sway/output.h2
-rw-r--r--sway/desktop/layer_shell.c27
-rw-r--r--sway/desktop/output.c12
-rw-r--r--sway/desktop/render.c16
-rw-r--r--sway/input/cursor.c14
-rw-r--r--sway/tree/output.c4
6 files changed, 37 insertions, 38 deletions
diff --git a/include/sway/output.h b/include/sway/output.h
index 43cbccd2..96bd10db 100644
--- a/include/sway/output.h
+++ b/include/sway/output.h
@@ -23,7 +23,7 @@ struct sway_output {
23 struct sway_server *server; 23 struct sway_server *server;
24 struct wl_list link; 24 struct wl_list link;
25 25
26 struct wl_list layers[4]; // sway_layer_surface::link 26 struct wl_list shell_layers[4]; // sway_layer_surface::link
27 struct wlr_box usable_area; 27 struct wlr_box usable_area;
28 28
29 struct timespec last_frame; 29 struct timespec last_frame;
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index e5e7046a..6480d7ce 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -218,13 +218,13 @@ void arrange_layers(struct sway_output *output) {
218 &usable_area.width, &usable_area.height); 218 &usable_area.width, &usable_area.height);
219 219
220 // Arrange exclusive surfaces from top->bottom 220 // Arrange exclusive surfaces from top->bottom
221 arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], 221 arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
222 &usable_area, true); 222 &usable_area, true);
223 arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], 223 arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
224 &usable_area, true); 224 &usable_area, true);
225 arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], 225 arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
226 &usable_area, true); 226 &usable_area, true);
227 arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], 227 arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
228 &usable_area, true); 228 &usable_area, true);
229 229
230 if (memcmp(&usable_area, &output->usable_area, 230 if (memcmp(&usable_area, &output->usable_area,
@@ -235,13 +235,13 @@ void arrange_layers(struct sway_output *output) {
235 } 235 }
236 236
237 // Arrange non-exclusive surfaces from top->bottom 237 // Arrange non-exclusive surfaces from top->bottom
238 arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], 238 arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
239 &usable_area, false); 239 &usable_area, false);
240 arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], 240 arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
241 &usable_area, false); 241 &usable_area, false);
242 arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], 242 arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
243 &usable_area, false); 243 &usable_area, false);
244 arrange_layer(output, &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], 244 arrange_layer(output, &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
245 &usable_area, false); 245 &usable_area, false);
246 246
247 // Find topmost keyboard interactive layer, if such a layer exists 247 // Find topmost keyboard interactive layer, if such a layer exists
@@ -253,9 +253,8 @@ void arrange_layers(struct sway_output *output) {
253 struct sway_layer_surface *layer, *topmost = NULL; 253 struct sway_layer_surface *layer, *topmost = NULL;
254 for (size_t i = 0; i < nlayers; ++i) { 254 for (size_t i = 0; i < nlayers; ++i) {
255 wl_list_for_each_reverse(layer, 255 wl_list_for_each_reverse(layer,
256 &output->layers[layers_above_shell[i]], link) { 256 &output->shell_layers[layers_above_shell[i]], link) {
257 if (layer->layer_surface->current.keyboard_interactive 257 if (layer->layer_surface->current.keyboard_interactive &&
258 == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE &&
259 layer->layer_surface->surface->mapped) { 258 layer->layer_surface->surface->mapped) {
260 topmost = layer; 259 topmost = layer;
261 break; 260 break;
@@ -289,7 +288,7 @@ static struct sway_layer_surface *find_mapped_layer_by_client(
289 // For now we'll only check the overlay layer 288 // For now we'll only check the overlay layer
290 struct sway_layer_surface *lsurface; 289 struct sway_layer_surface *lsurface;
291 wl_list_for_each(lsurface, 290 wl_list_for_each(lsurface,
292 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) { 291 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) {
293 struct wl_resource *resource = lsurface->layer_surface->resource; 292 struct wl_resource *resource = lsurface->layer_surface->resource;
294 if (wl_resource_get_client(resource) == client 293 if (wl_resource_get_client(resource) == client
295 && lsurface->layer_surface->surface->mapped) { 294 && lsurface->layer_surface->surface->mapped) {
@@ -343,7 +342,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
343 layer_changed = layer->layer != layer_surface->current.layer; 342 layer_changed = layer->layer != layer_surface->current.layer;
344 if (layer_changed) { 343 if (layer_changed) {
345 wl_list_remove(&layer->link); 344 wl_list_remove(&layer->link);
346 wl_list_insert(&output->layers[layer_surface->current.layer], 345 wl_list_insert(&output->shell_layers[layer_surface->current.layer],
347 &layer->link); 346 &layer->link);
348 layer->layer = layer_surface->current.layer; 347 layer->layer = layer_surface->current.layer;
349 } 348 }
@@ -716,6 +715,6 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
716 sway_layer->output_destroy.notify = handle_output_destroy; 715 sway_layer->output_destroy.notify = handle_output_destroy;
717 wl_signal_add(&output->events.disable, &sway_layer->output_destroy); 716 wl_signal_add(&output->events.disable, &sway_layer->output_destroy);
718 717
719 wl_list_insert(&output->layers[layer_surface->pending.layer], 718 wl_list_insert(&output->shell_layers[layer_surface->pending.layer],
720 &sway_layer->link); 719 &sway_layer->link);
721} 720}
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 8b84da86..928c77d6 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -347,10 +347,10 @@ static void output_for_each_surface(struct sway_output *output,
347#endif 347#endif
348 } else { 348 } else {
349 output_layer_for_each_surface(output, 349 output_layer_for_each_surface(output,
350 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], 350 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
351 iterator, user_data); 351 iterator, user_data);
352 output_layer_for_each_surface(output, 352 output_layer_for_each_surface(output,
353 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], 353 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
354 iterator, user_data); 354 iterator, user_data);
355 355
356 workspace_for_each_container(workspace, 356 workspace_for_each_container(workspace,
@@ -361,13 +361,13 @@ static void output_for_each_surface(struct sway_output *output,
361 iterator, user_data); 361 iterator, user_data);
362#endif 362#endif
363 output_layer_for_each_surface(output, 363 output_layer_for_each_surface(output,
364 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], 364 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
365 iterator, user_data); 365 iterator, user_data);
366 } 366 }
367 367
368overlay: 368overlay:
369 output_layer_for_each_surface(output, 369 output_layer_for_each_surface(output,
370 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], 370 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
371 iterator, user_data); 371 iterator, user_data);
372 output_drag_icons_for_each_surface(output, &root->drag_icons, 372 output_drag_icons_for_each_surface(output, &root->drag_icons,
373 iterator, user_data); 373 iterator, user_data);
@@ -399,7 +399,7 @@ struct sway_workspace *output_get_active_workspace(struct sway_output *output) {
399bool output_has_opaque_overlay_layer_surface(struct sway_output *output) { 399bool output_has_opaque_overlay_layer_surface(struct sway_output *output) {
400 struct sway_layer_surface *sway_layer_surface; 400 struct sway_layer_surface *sway_layer_surface;
401 wl_list_for_each(sway_layer_surface, 401 wl_list_for_each(sway_layer_surface,
402 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) { 402 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) {
403 struct wlr_surface *wlr_surface = sway_layer_surface->layer_surface->surface; 403 struct wlr_surface *wlr_surface = sway_layer_surface->layer_surface->surface;
404 pixman_box32_t output_box = { 404 pixman_box32_t output_box = {
405 .x2 = output->width, 405 .x2 = output->width,
@@ -488,7 +488,7 @@ static bool scan_out_fullscreen_view(struct sway_output *output,
488 } 488 }
489#endif 489#endif
490 490
491 if (!wl_list_empty(&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY])) { 491 if (!wl_list_empty(&output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY])) {
492 return false; 492 return false;
493 } 493 }
494 if (!wl_list_empty(&root->drag_icons)) { 494 if (!wl_list_empty(&root->drag_icons)) {
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index c9a306cf..168c941b 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -1098,9 +1098,9 @@ void output_render(struct render_context *ctx) {
1098 }); 1098 });
1099 1099
1100 render_layer_toplevel(ctx, 1100 render_layer_toplevel(ctx,
1101 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); 1101 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
1102 render_layer_toplevel(ctx, 1102 render_layer_toplevel(ctx,
1103 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); 1103 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]);
1104 1104
1105 render_workspace(ctx, workspace, workspace->current.focused); 1105 render_workspace(ctx, workspace, workspace->current.focused);
1106 render_floating(ctx); 1106 render_floating(ctx);
@@ -1108,14 +1108,14 @@ void output_render(struct render_context *ctx) {
1108 render_unmanaged(ctx, &root->xwayland_unmanaged); 1108 render_unmanaged(ctx, &root->xwayland_unmanaged);
1109#endif 1109#endif
1110 render_layer_toplevel(ctx, 1110 render_layer_toplevel(ctx,
1111 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); 1111 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
1112 1112
1113 render_layer_popups(ctx, 1113 render_layer_popups(ctx,
1114 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]); 1114 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
1115 render_layer_popups(ctx, 1115 render_layer_popups(ctx,
1116 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); 1116 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]);
1117 render_layer_popups(ctx, 1117 render_layer_popups(ctx,
1118 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); 1118 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
1119 } 1119 }
1120 1120
1121 render_seatops(ctx); 1121 render_seatops(ctx);
@@ -1128,9 +1128,9 @@ void output_render(struct render_context *ctx) {
1128 1128
1129render_overlay: 1129render_overlay:
1130 render_layer_toplevel(ctx, 1130 render_layer_toplevel(ctx,
1131 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); 1131 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
1132 render_layer_popups(ctx, 1132 render_layer_popups(ctx,
1133 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); 1133 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
1134 render_drag_icons(ctx, &root->drag_icons); 1134 render_drag_icons(ctx, &root->drag_icons);
1135 1135
1136renderer_end: 1136renderer_end:
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 6b6faf64..73aef4b0 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -115,7 +115,7 @@ struct sway_node *node_at_coords(
115 115
116 // layer surfaces on the overlay layer are rendered on top 116 // layer surfaces on the overlay layer are rendered on top
117 if ((*surface = layer_surface_at(output, 117 if ((*surface = layer_surface_at(output,
118 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], 118 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
119 ox, oy, sx, sy))) { 119 ox, oy, sx, sy))) {
120 return NULL; 120 return NULL;
121 } 121 }
@@ -176,22 +176,22 @@ struct sway_node *node_at_coords(
176 return NULL; 176 return NULL;
177 } 177 }
178 if ((*surface = layer_surface_popup_at(output, 178 if ((*surface = layer_surface_popup_at(output,
179 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], 179 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
180 ox, oy, sx, sy))) { 180 ox, oy, sx, sy))) {
181 return NULL; 181 return NULL;
182 } 182 }
183 if ((*surface = layer_surface_popup_at(output, 183 if ((*surface = layer_surface_popup_at(output,
184 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], 184 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
185 ox, oy, sx, sy))) { 185 ox, oy, sx, sy))) {
186 return NULL; 186 return NULL;
187 } 187 }
188 if ((*surface = layer_surface_popup_at(output, 188 if ((*surface = layer_surface_popup_at(output,
189 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], 189 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
190 ox, oy, sx, sy))) { 190 ox, oy, sx, sy))) {
191 return NULL; 191 return NULL;
192 } 192 }
193 if ((*surface = layer_surface_at(output, 193 if ((*surface = layer_surface_at(output,
194 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], 194 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
195 ox, oy, sx, sy))) { 195 ox, oy, sx, sy))) {
196 return NULL; 196 return NULL;
197 } 197 }
@@ -202,12 +202,12 @@ struct sway_node *node_at_coords(
202 } 202 }
203 203
204 if ((*surface = layer_surface_at(output, 204 if ((*surface = layer_surface_at(output,
205 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], 205 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
206 ox, oy, sx, sy))) { 206 ox, oy, sx, sy))) {
207 return NULL; 207 return NULL;
208 } 208 }
209 if ((*surface = layer_surface_at(output, 209 if ((*surface = layer_surface_at(output,
210 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], 210 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
211 ox, oy, sx, sy))) { 211 ox, oy, sx, sy))) {
212 return NULL; 212 return NULL;
213 } 213 }
diff --git a/sway/tree/output.c b/sway/tree/output.c
index 4aa3a7fe..2186ad0c 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -102,9 +102,9 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
102 output->workspaces = create_list(); 102 output->workspaces = create_list();
103 output->current.workspaces = create_list(); 103 output->current.workspaces = create_list();
104 104
105 size_t len = sizeof(output->layers) / sizeof(output->layers[0]); 105 size_t len = sizeof(output->shell_layers) / sizeof(output->shell_layers[0]);
106 for (size_t i = 0; i < len; ++i) { 106 for (size_t i = 0; i < len; ++i) {
107 wl_list_init(&output->layers[i]); 107 wl_list_init(&output->shell_layers[i]);
108 } 108 }
109 109
110 return output; 110 return output;