mirror of
https://github.com/swaywm/sway.git
synced 2024-11-16 05:03:17 +00:00
Add a secondary headless backend
This allows the create_output command to work on DRM too.
This commit is contained in:
parent
6021fc4a08
commit
5e5e5f2ee5
|
@ -29,6 +29,8 @@ struct sway_server {
|
||||||
|
|
||||||
struct wlr_backend *backend;
|
struct wlr_backend *backend;
|
||||||
struct wlr_backend *noop_backend;
|
struct wlr_backend *noop_backend;
|
||||||
|
// secondary headless backend used for creating virtual outputs on-the-fly
|
||||||
|
struct wlr_backend *headless_backend;
|
||||||
|
|
||||||
struct wlr_compositor *compositor;
|
struct wlr_compositor *compositor;
|
||||||
struct wl_listener compositor_new_surface;
|
struct wl_listener compositor_new_surface;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
|
#include <wlr/backend/headless.h>
|
||||||
|
#include <wlr/backend/multi.h>
|
||||||
#include <wlr/backend/noop.h>
|
#include <wlr/backend/noop.h>
|
||||||
#include <wlr/backend/session.h>
|
#include <wlr/backend/session.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
@ -41,7 +43,6 @@ bool server_privileged_prepare(struct sway_server *server) {
|
||||||
server->wl_display = wl_display_create();
|
server->wl_display = wl_display_create();
|
||||||
server->wl_event_loop = wl_display_get_event_loop(server->wl_display);
|
server->wl_event_loop = wl_display_get_event_loop(server->wl_display);
|
||||||
server->backend = wlr_backend_autocreate(server->wl_display, NULL);
|
server->backend = wlr_backend_autocreate(server->wl_display, NULL);
|
||||||
server->noop_backend = wlr_noop_backend_create(server->wl_display);
|
|
||||||
|
|
||||||
if (!server->backend) {
|
if (!server->backend) {
|
||||||
sway_log(SWAY_ERROR, "Unable to create backend");
|
sway_log(SWAY_ERROR, "Unable to create backend");
|
||||||
|
@ -153,9 +154,15 @@ 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);
|
struct wlr_output *wlr_output = wlr_noop_add_output(server->noop_backend);
|
||||||
root->noop_output = output_create(wlr_output);
|
root->noop_output = output_create(wlr_output);
|
||||||
|
|
||||||
|
server->headless_backend =
|
||||||
|
wlr_headless_backend_create_with_renderer(server->wl_display, renderer);
|
||||||
|
wlr_multi_backend_add(server->backend, server->headless_backend);
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
Loading…
Reference in a new issue