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.
This commit is contained in:
parent
729e18bff5
commit
0cd8efe0bb
|
@ -33,7 +33,6 @@ struct sway_server {
|
||||||
const char *socket;
|
const char *socket;
|
||||||
|
|
||||||
struct wlr_backend *backend;
|
struct wlr_backend *backend;
|
||||||
struct wlr_backend *noop_backend;
|
|
||||||
// secondary headless backend used for creating virtual outputs on-the-fly
|
// secondary headless backend used for creating virtual outputs on-the-fly
|
||||||
struct wlr_backend *headless_backend;
|
struct wlr_backend *headless_backend;
|
||||||
struct wlr_renderer *renderer;
|
struct wlr_renderer *renderer;
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct sway_root {
|
||||||
list_t *scratchpad; // struct sway_container
|
list_t *scratchpad; // struct sway_container
|
||||||
|
|
||||||
// For when there's no connected outputs
|
// For when there's no connected outputs
|
||||||
struct sway_output *noop_output;
|
struct sway_output *fallback_output;
|
||||||
|
|
||||||
struct sway_container *fullscreen_global;
|
struct sway_container *fullscreen_global;
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ struct cmd_results *cmd_output(int argc, char **argv) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The NOOP-1 output is a dummy output used when there's no outputs
|
// The HEADLESS-1 output is a dummy output used when there's no outputs
|
||||||
// connected. It should never be configured.
|
// connected. It should never be configured.
|
||||||
if (strcasecmp(argv[0], root->noop_output->wlr_output->name) == 0) {
|
if (strcasecmp(argv[0], root->fallback_output->wlr_output->name) == 0) {
|
||||||
return cmd_results_new(CMD_FAILURE,
|
return cmd_results_new(CMD_FAILURE,
|
||||||
"Refusing to configure the no op output");
|
"Refusing to configure the no op output");
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
|
||||||
if (!sway_output) {
|
if (!sway_output) {
|
||||||
return cmd_results_new(CMD_FAILURE, "Unknown output");
|
return cmd_results_new(CMD_FAILURE, "Unknown output");
|
||||||
}
|
}
|
||||||
if (sway_output == root->noop_output) {
|
if (sway_output == root->fallback_output) {
|
||||||
return cmd_results_new(CMD_FAILURE,
|
return cmd_results_new(CMD_FAILURE,
|
||||||
"Refusing to configure the no op output");
|
"Refusing to configure the no op output");
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,7 +375,7 @@ static const uint32_t *bit_depth_preferences[] = {
|
||||||
|
|
||||||
static void queue_output_config(struct output_config *oc,
|
static void queue_output_config(struct output_config *oc,
|
||||||
struct sway_output *output) {
|
struct sway_output *output) {
|
||||||
if (output == root->noop_output) {
|
if (output == root->fallback_output) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ static void queue_output_config(struct output_config *oc,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool apply_output_config(struct output_config *oc, struct sway_output *output) {
|
bool apply_output_config(struct output_config *oc, struct sway_output *output) {
|
||||||
if (output == root->noop_output) {
|
if (output == root->fallback_output) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool test_output_config(struct output_config *oc, struct sway_output *output) {
|
bool test_output_config(struct output_config *oc, struct sway_output *output) {
|
||||||
if (output == root->noop_output) {
|
if (output == root->fallback_output) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -624,7 +624,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
output = ws->output;
|
output = ws->output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!output || output == root->noop_output) {
|
if (!output || output == root->fallback_output) {
|
||||||
if (!root->outputs->length) {
|
if (!root->outputs->length) {
|
||||||
sway_log(SWAY_ERROR,
|
sway_log(SWAY_ERROR,
|
||||||
"no output to auto-assign layer surface '%s' to",
|
"no output to auto-assign layer surface '%s' to",
|
||||||
|
|
|
@ -733,7 +733,7 @@ static void update_output_manager_config(struct sway_server *server) {
|
||||||
|
|
||||||
struct sway_output *output;
|
struct sway_output *output;
|
||||||
wl_list_for_each(output, &root->all_outputs, link) {
|
wl_list_for_each(output, &root->all_outputs, link) {
|
||||||
if (output == root->noop_output) {
|
if (output == root->fallback_output) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
struct wlr_output_configuration_head_v1 *config_head =
|
struct wlr_output_configuration_head_v1 *config_head =
|
||||||
|
@ -838,6 +838,10 @@ static void handle_present(struct wl_listener *listener, void *data) {
|
||||||
void handle_new_output(struct wl_listener *listener, void *data) {
|
void handle_new_output(struct wl_listener *listener, void *data) {
|
||||||
struct sway_server *server = wl_container_of(listener, server, new_output);
|
struct sway_server *server = wl_container_of(listener, server, new_output);
|
||||||
struct wlr_output *wlr_output = data;
|
struct wlr_output *wlr_output = data;
|
||||||
|
if (wlr_output == root->fallback_output->wlr_output) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sway_log(SWAY_DEBUG, "New output %p: %s (non-desktop: %d)",
|
sway_log(SWAY_DEBUG, "New output %p: %s (non-desktop: %d)",
|
||||||
wlr_output, wlr_output->name, wlr_output->non_desktop);
|
wlr_output, wlr_output->name, wlr_output->non_desktop);
|
||||||
|
|
||||||
|
|
|
@ -687,7 +687,7 @@ void ipc_client_handle_command(struct ipc_client *client, uint32_t payload_lengt
|
||||||
}
|
}
|
||||||
struct sway_output *output;
|
struct sway_output *output;
|
||||||
wl_list_for_each(output, &root->all_outputs, link) {
|
wl_list_for_each(output, &root->all_outputs, link) {
|
||||||
if (!output->enabled && output != root->noop_output) {
|
if (!output->enabled && output != root->fallback_output) {
|
||||||
json_object_array_add(outputs,
|
json_object_array_add(outputs,
|
||||||
ipc_json_describe_disabled_output(output));
|
ipc_json_describe_disabled_output(output));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
#include <wlr/backend/headless.h>
|
#include <wlr/backend/headless.h>
|
||||||
#include <wlr/backend/multi.h>
|
#include <wlr/backend/multi.h>
|
||||||
#include <wlr/backend/noop.h>
|
|
||||||
#include <wlr/backend/session.h>
|
#include <wlr/backend/session.h>
|
||||||
#include <wlr/config.h>
|
#include <wlr/config.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
@ -217,11 +216,6 @@ bool server_init(struct sway_server *server) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
server->noop_backend = wlr_noop_backend_create(server->wl_display);
|
|
||||||
|
|
||||||
struct wlr_output *wlr_output = wlr_noop_add_output(server->noop_backend);
|
|
||||||
root->noop_output = output_create(wlr_output);
|
|
||||||
|
|
||||||
server->headless_backend = wlr_headless_backend_create(server->wl_display);
|
server->headless_backend = wlr_headless_backend_create(server->wl_display);
|
||||||
if (!server->headless_backend) {
|
if (!server->headless_backend) {
|
||||||
sway_log(SWAY_ERROR, "Failed to create secondary headless backend");
|
sway_log(SWAY_ERROR, "Failed to create secondary headless backend");
|
||||||
|
@ -231,6 +225,10 @@ bool server_init(struct sway_server *server) {
|
||||||
wlr_multi_backend_add(server->backend, server->headless_backend);
|
wlr_multi_backend_add(server->backend, server->headless_backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_output *wlr_output =
|
||||||
|
wlr_headless_add_output(server->headless_backend, 800, 600);
|
||||||
|
root->fallback_output = output_create(wlr_output);
|
||||||
|
|
||||||
// This may have been set already via -Dtxn-timeout
|
// This may have been set already via -Dtxn-timeout
|
||||||
if (!server->txn_timeout_ms) {
|
if (!server->txn_timeout_ms) {
|
||||||
server->txn_timeout_ms = 200;
|
server->txn_timeout_ms = 200;
|
||||||
|
@ -287,6 +285,7 @@ bool server_start(struct sway_server *server) {
|
||||||
wlr_backend_destroy(server->backend);
|
wlr_backend_destroy(server->backend);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,8 @@ static void restore_workspaces(struct sway_output *output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saved workspaces
|
// Saved workspaces
|
||||||
while (root->noop_output->workspaces->length) {
|
while (root->fallback_output->workspaces->length) {
|
||||||
struct sway_workspace *ws = root->noop_output->workspaces->items[0];
|
struct sway_workspace *ws = root->fallback_output->workspaces->items[0];
|
||||||
workspace_detach(ws);
|
workspace_detach(ws);
|
||||||
output_add_workspace(output, ws);
|
output_add_workspace(output, ws);
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ static void output_evacuate(struct sway_output *output) {
|
||||||
new_output = fallback_output;
|
new_output = fallback_output;
|
||||||
}
|
}
|
||||||
if (!new_output) {
|
if (!new_output) {
|
||||||
new_output = root->noop_output;
|
new_output = root->fallback_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sway_workspace *new_output_ws =
|
struct sway_workspace *new_output_ws =
|
||||||
|
|
|
@ -374,8 +374,8 @@ void root_for_each_container(void (*f)(struct sway_container *con, void *data),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saved workspaces
|
// Saved workspaces
|
||||||
for (int i = 0; i < root->noop_output->workspaces->length; ++i) {
|
for (int i = 0; i < root->fallback_output->workspaces->length; ++i) {
|
||||||
struct sway_workspace *ws = root->noop_output->workspaces->items[i];
|
struct sway_workspace *ws = root->fallback_output->workspaces->items[i];
|
||||||
workspace_for_each_container(ws, f, data);
|
workspace_for_each_container(ws, f, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,8 +427,8 @@ struct sway_container *root_find_container(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saved workspaces
|
// Saved workspaces
|
||||||
for (int i = 0; i < root->noop_output->workspaces->length; ++i) {
|
for (int i = 0; i < root->fallback_output->workspaces->length; ++i) {
|
||||||
struct sway_workspace *ws = root->noop_output->workspaces->items[i];
|
struct sway_workspace *ws = root->fallback_output->workspaces->items[i];
|
||||||
if ((result = workspace_find_container(ws, test, data))) {
|
if ((result = workspace_find_container(ws, test, data))) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,8 @@ struct sway_output *workspace_get_initial_output(const char *name) {
|
||||||
} else if (focus && focus->type == N_CONTAINER) {
|
} else if (focus && focus->type == N_CONTAINER) {
|
||||||
return focus->sway_container->pending.workspace->output;
|
return focus->sway_container->pending.workspace->output;
|
||||||
}
|
}
|
||||||
// Fallback to the first output or noop output for headless
|
// Fallback to the first output or the headless output
|
||||||
return root->outputs->length ? root->outputs->items[0] : root->noop_output;
|
return root->outputs->length ? root->outputs->items[0] : root->fallback_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sway_workspace *workspace_create(struct sway_output *output,
|
struct sway_workspace *workspace_create(struct sway_output *output,
|
||||||
|
|
Loading…
Reference in a new issue