diff options
author | 2021-10-04 10:04:46 -0400 | |
---|---|---|
committer | 2021-11-25 17:48:34 +0100 | |
commit | 0cd8efe0bb669e71e9cdc30d96ae466cb583e605 (patch) | |
tree | 0cc1cdf1d76347b92376fcf9087792e1b2f69a49 | |
parent | Replace wlr_headless_backend_create_with_renderer call (diff) | |
download | sway-0cd8efe0bb669e71e9cdc30d96ae466cb583e605.tar.gz sway-0cd8efe0bb669e71e9cdc30d96ae466cb583e605.tar.zst sway-0cd8efe0bb669e71e9cdc30d96ae466cb583e605.zip |
sway: replace noop_output by fallback_output
wlroots removed the support for the noop backend. Instead we rely on the
headless backend to provide the fallback output.
-rw-r--r-- | include/sway/server.h | 1 | ||||
-rw-r--r-- | include/sway/tree/root.h | 2 | ||||
-rw-r--r-- | sway/commands/output.c | 6 | ||||
-rw-r--r-- | sway/config/output.c | 6 | ||||
-rw-r--r-- | sway/desktop/layer_shell.c | 2 | ||||
-rw-r--r-- | sway/desktop/output.c | 6 | ||||
-rw-r--r-- | sway/ipc-server.c | 2 | ||||
-rw-r--r-- | sway/server.c | 11 | ||||
-rw-r--r-- | sway/tree/output.c | 6 | ||||
-rw-r--r-- | sway/tree/root.c | 8 | ||||
-rw-r--r-- | sway/tree/workspace.c | 4 |
11 files changed, 28 insertions, 26 deletions
diff --git a/include/sway/server.h b/include/sway/server.h index 109097d7..7ac2af26 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -33,7 +33,6 @@ struct sway_server { | |||
33 | const char *socket; | 33 | const char *socket; |
34 | 34 | ||
35 | struct wlr_backend *backend; | 35 | struct wlr_backend *backend; |
36 | struct wlr_backend *noop_backend; | ||
37 | // secondary headless backend used for creating virtual outputs on-the-fly | 36 | // secondary headless backend used for creating virtual outputs on-the-fly |
38 | struct wlr_backend *headless_backend; | 37 | struct wlr_backend *headless_backend; |
39 | struct wlr_renderer *renderer; | 38 | struct wlr_renderer *renderer; |
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index e8f4d573..5d4a2f2d 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h | |||
@@ -31,7 +31,7 @@ struct sway_root { | |||
31 | list_t *scratchpad; // struct sway_container | 31 | list_t *scratchpad; // struct sway_container |
32 | 32 | ||
33 | // For when there's no connected outputs | 33 | // For when there's no connected outputs |
34 | struct sway_output *noop_output; | 34 | struct sway_output *fallback_output; |
35 | 35 | ||
36 | struct sway_container *fullscreen_global; | 36 | struct sway_container *fullscreen_global; |
37 | 37 | ||
diff --git a/sway/commands/output.c b/sway/commands/output.c index 42230bd7..125df5a7 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c | |||
@@ -34,9 +34,9 @@ struct cmd_results *cmd_output(int argc, char **argv) { | |||
34 | return error; | 34 | return error; |
35 | } | 35 | } |
36 | 36 | ||
37 | // The NOOP-1 output is a dummy output used when there's no outputs | 37 | // The HEADLESS-1 output is a dummy output used when there's no outputs |
38 | // connected. It should never be configured. | 38 | // connected. It should never be configured. |
39 | if (strcasecmp(argv[0], root->noop_output->wlr_output->name) == 0) { | 39 | if (strcasecmp(argv[0], root->fallback_output->wlr_output->name) == 0) { |
40 | return cmd_results_new(CMD_FAILURE, | 40 | return cmd_results_new(CMD_FAILURE, |
41 | "Refusing to configure the no op output"); | 41 | "Refusing to configure the no op output"); |
42 | } | 42 | } |
@@ -53,7 +53,7 @@ struct cmd_results *cmd_output(int argc, char **argv) { | |||
53 | if (!sway_output) { | 53 | if (!sway_output) { |
54 | return cmd_results_new(CMD_FAILURE, "Unknown output"); | 54 | return cmd_results_new(CMD_FAILURE, "Unknown output"); |
55 | } | 55 | } |
56 | if (sway_output == root->noop_output) { | 56 | if (sway_output == root->fallback_output) { |
57 | return cmd_results_new(CMD_FAILURE, | 57 | return cmd_results_new(CMD_FAILURE, |
58 | "Refusing to configure the no op output"); | 58 | "Refusing to configure the no op output"); |
59 | } | 59 | } |
diff --git a/sway/config/output.c b/sway/config/output.c index 63c81382..fa509252 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -375,7 +375,7 @@ static const uint32_t *bit_depth_preferences[] = { | |||
375 | 375 | ||
376 | static void queue_output_config(struct output_config *oc, | 376 | static void queue_output_config(struct output_config *oc, |
377 | struct sway_output *output) { | 377 | struct sway_output *output) { |
378 | if (output == root->noop_output) { | 378 | if (output == root->fallback_output) { |
379 | return; | 379 | return; |
380 | } | 380 | } |
381 | 381 | ||
@@ -478,7 +478,7 @@ static void queue_output_config(struct output_config *oc, | |||
478 | } | 478 | } |
479 | 479 | ||
480 | bool apply_output_config(struct output_config *oc, struct sway_output *output) { | 480 | bool apply_output_config(struct output_config *oc, struct sway_output *output) { |
481 | if (output == root->noop_output) { | 481 | if (output == root->fallback_output) { |
482 | return false; | 482 | return false; |
483 | } | 483 | } |
484 | 484 | ||
@@ -573,7 +573,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { | |||
573 | } | 573 | } |
574 | 574 | ||
575 | bool test_output_config(struct output_config *oc, struct sway_output *output) { | 575 | bool test_output_config(struct output_config *oc, struct sway_output *output) { |
576 | if (output == root->noop_output) { | 576 | if (output == root->fallback_output) { |
577 | return false; | 577 | return false; |
578 | } | 578 | } |
579 | 579 | ||
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 7f5a337b..db78b59f 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -624,7 +624,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { | |||
624 | output = ws->output; | 624 | output = ws->output; |
625 | } | 625 | } |
626 | } | 626 | } |
627 | if (!output || output == root->noop_output) { | 627 | if (!output || output == root->fallback_output) { |
628 | if (!root->outputs->length) { | 628 | if (!root->outputs->length) { |
629 | sway_log(SWAY_ERROR, | 629 | sway_log(SWAY_ERROR, |
630 | "no output to auto-assign layer surface '%s' to", | 630 | "no output to auto-assign layer surface '%s' to", |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index cd9fd3a6..ed6bc064 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -733,7 +733,7 @@ static void update_output_manager_config(struct sway_server *server) { | |||
733 | 733 | ||
734 | struct sway_output *output; | 734 | struct sway_output *output; |
735 | wl_list_for_each(output, &root->all_outputs, link) { | 735 | wl_list_for_each(output, &root->all_outputs, link) { |
736 | if (output == root->noop_output) { | 736 | if (output == root->fallback_output) { |
737 | continue; | 737 | continue; |
738 | } | 738 | } |
739 | struct wlr_output_configuration_head_v1 *config_head = | 739 | struct wlr_output_configuration_head_v1 *config_head = |
@@ -838,6 +838,10 @@ static void handle_present(struct wl_listener *listener, void *data) { | |||
838 | void handle_new_output(struct wl_listener *listener, void *data) { | 838 | void handle_new_output(struct wl_listener *listener, void *data) { |
839 | struct sway_server *server = wl_container_of(listener, server, new_output); | 839 | struct sway_server *server = wl_container_of(listener, server, new_output); |
840 | struct wlr_output *wlr_output = data; | 840 | struct wlr_output *wlr_output = data; |
841 | if (wlr_output == root->fallback_output->wlr_output) { | ||
842 | return; | ||
843 | } | ||
844 | |||
841 | sway_log(SWAY_DEBUG, "New output %p: %s (non-desktop: %d)", | 845 | sway_log(SWAY_DEBUG, "New output %p: %s (non-desktop: %d)", |
842 | wlr_output, wlr_output->name, wlr_output->non_desktop); | 846 | wlr_output, wlr_output->name, wlr_output->non_desktop); |
843 | 847 | ||
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index aad9a7b5..1bf5a05f 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -687,7 +687,7 @@ void ipc_client_handle_command(struct ipc_client *client, uint32_t payload_lengt | |||
687 | } | 687 | } |
688 | struct sway_output *output; | 688 | struct sway_output *output; |
689 | wl_list_for_each(output, &root->all_outputs, link) { | 689 | wl_list_for_each(output, &root->all_outputs, link) { |
690 | if (!output->enabled && output != root->noop_output) { | 690 | if (!output->enabled && output != root->fallback_output) { |
691 | json_object_array_add(outputs, | 691 | json_object_array_add(outputs, |
692 | ipc_json_describe_disabled_output(output)); | 692 | ipc_json_describe_disabled_output(output)); |
693 | } | 693 | } |
diff --git a/sway/server.c b/sway/server.c index 246f9c4f..ff269c79 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <wlr/backend.h> | 7 | #include <wlr/backend.h> |
8 | #include <wlr/backend/headless.h> | 8 | #include <wlr/backend/headless.h> |
9 | #include <wlr/backend/multi.h> | 9 | #include <wlr/backend/multi.h> |
10 | #include <wlr/backend/noop.h> | ||
11 | #include <wlr/backend/session.h> | 10 | #include <wlr/backend/session.h> |
12 | #include <wlr/config.h> | 11 | #include <wlr/config.h> |
13 | #include <wlr/render/wlr_renderer.h> | 12 | #include <wlr/render/wlr_renderer.h> |
@@ -217,11 +216,6 @@ bool server_init(struct sway_server *server) { | |||
217 | return false; | 216 | return false; |
218 | } | 217 | } |
219 | 218 | ||
220 | server->noop_backend = wlr_noop_backend_create(server->wl_display); | ||
221 | |||
222 | struct wlr_output *wlr_output = wlr_noop_add_output(server->noop_backend); | ||
223 | root->noop_output = output_create(wlr_output); | ||
224 | |||
225 | server->headless_backend = wlr_headless_backend_create(server->wl_display); | 219 | server->headless_backend = wlr_headless_backend_create(server->wl_display); |
226 | if (!server->headless_backend) { | 220 | if (!server->headless_backend) { |
227 | sway_log(SWAY_ERROR, "Failed to create secondary headless backend"); | 221 | sway_log(SWAY_ERROR, "Failed to create secondary headless backend"); |
@@ -231,6 +225,10 @@ bool server_init(struct sway_server *server) { | |||
231 | wlr_multi_backend_add(server->backend, server->headless_backend); | 225 | wlr_multi_backend_add(server->backend, server->headless_backend); |
232 | } | 226 | } |
233 | 227 | ||
228 | struct wlr_output *wlr_output = | ||
229 | wlr_headless_add_output(server->headless_backend, 800, 600); | ||
230 | root->fallback_output = output_create(wlr_output); | ||
231 | |||
234 | // This may have been set already via -Dtxn-timeout | 232 | // This may have been set already via -Dtxn-timeout |
235 | if (!server->txn_timeout_ms) { | 233 | if (!server->txn_timeout_ms) { |
236 | server->txn_timeout_ms = 200; | 234 | server->txn_timeout_ms = 200; |
@@ -287,6 +285,7 @@ bool server_start(struct sway_server *server) { | |||
287 | wlr_backend_destroy(server->backend); | 285 | wlr_backend_destroy(server->backend); |
288 | return false; | 286 | return false; |
289 | } | 287 | } |
288 | |||
290 | return true; | 289 | return true; |
291 | } | 290 | } |
292 | 291 | ||
diff --git a/sway/tree/output.c b/sway/tree/output.c index c095dce0..242e6fac 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c | |||
@@ -56,8 +56,8 @@ static void restore_workspaces(struct sway_output *output) { | |||
56 | } | 56 | } |
57 | 57 | ||
58 | // Saved workspaces | 58 | // Saved workspaces |
59 | while (root->noop_output->workspaces->length) { | 59 | while (root->fallback_output->workspaces->length) { |
60 | struct sway_workspace *ws = root->noop_output->workspaces->items[0]; | 60 | struct sway_workspace *ws = root->fallback_output->workspaces->items[0]; |
61 | workspace_detach(ws); | 61 | workspace_detach(ws); |
62 | output_add_workspace(output, ws); | 62 | output_add_workspace(output, ws); |
63 | 63 | ||
@@ -192,7 +192,7 @@ static void output_evacuate(struct sway_output *output) { | |||
192 | new_output = fallback_output; | 192 | new_output = fallback_output; |
193 | } | 193 | } |
194 | if (!new_output) { | 194 | if (!new_output) { |
195 | new_output = root->noop_output; | 195 | new_output = root->fallback_output; |
196 | } | 196 | } |
197 | 197 | ||
198 | struct sway_workspace *new_output_ws = | 198 | struct sway_workspace *new_output_ws = |
diff --git a/sway/tree/root.c b/sway/tree/root.c index dd4d8e33..73f3993c 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c | |||
@@ -374,8 +374,8 @@ void root_for_each_container(void (*f)(struct sway_container *con, void *data), | |||
374 | } | 374 | } |
375 | 375 | ||
376 | // Saved workspaces | 376 | // Saved workspaces |
377 | for (int i = 0; i < root->noop_output->workspaces->length; ++i) { | 377 | for (int i = 0; i < root->fallback_output->workspaces->length; ++i) { |
378 | struct sway_workspace *ws = root->noop_output->workspaces->items[i]; | 378 | struct sway_workspace *ws = root->fallback_output->workspaces->items[i]; |
379 | workspace_for_each_container(ws, f, data); | 379 | workspace_for_each_container(ws, f, data); |
380 | } | 380 | } |
381 | } | 381 | } |
@@ -427,8 +427,8 @@ struct sway_container *root_find_container( | |||
427 | } | 427 | } |
428 | 428 | ||
429 | // Saved workspaces | 429 | // Saved workspaces |
430 | for (int i = 0; i < root->noop_output->workspaces->length; ++i) { | 430 | for (int i = 0; i < root->fallback_output->workspaces->length; ++i) { |
431 | struct sway_workspace *ws = root->noop_output->workspaces->items[i]; | 431 | struct sway_workspace *ws = root->fallback_output->workspaces->items[i]; |
432 | if ((result = workspace_find_container(ws, test, data))) { | 432 | if ((result = workspace_find_container(ws, test, data))) { |
433 | return result; | 433 | return result; |
434 | } | 434 | } |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index e3ff1513..c84320bd 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -50,8 +50,8 @@ struct sway_output *workspace_get_initial_output(const char *name) { | |||
50 | } else if (focus && focus->type == N_CONTAINER) { | 50 | } else if (focus && focus->type == N_CONTAINER) { |
51 | return focus->sway_container->pending.workspace->output; | 51 | return focus->sway_container->pending.workspace->output; |
52 | } | 52 | } |
53 | // Fallback to the first output or noop output for headless | 53 | // Fallback to the first output or the headless output |
54 | return root->outputs->length ? root->outputs->items[0] : root->noop_output; | 54 | return root->outputs->length ? root->outputs->items[0] : root->fallback_output; |
55 | } | 55 | } |
56 | 56 | ||
57 | struct sway_workspace *workspace_create(struct sway_output *output, | 57 | struct sway_workspace *workspace_create(struct sway_output *output, |