mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
Introduce noop backend
The noop backend is similar to headless, but it doesn't contain a renderer. It can be used as a place to stash views for when there's no physical outputs connected.
This commit is contained in:
parent
10b1de6e71
commit
9b4be5a595
7 changed files with 218 additions and 1 deletions
|
|
@ -11,6 +11,7 @@
|
|||
#include <wlr/backend/interface.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
#include <wlr/backend/noop.h>
|
||||
#include <wlr/backend/session.h>
|
||||
#include <wlr/backend/wayland.h>
|
||||
#include <wlr/config.h>
|
||||
|
|
@ -133,6 +134,20 @@ static struct wlr_backend *attempt_headless_backend(
|
|||
return backend;
|
||||
}
|
||||
|
||||
static struct wlr_backend *attempt_noop_backend(struct wl_display *display) {
|
||||
struct wlr_backend *backend = wlr_noop_backend_create(display);
|
||||
if (backend == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t outputs = parse_outputs_env("WLR_NOOP_OUTPUTS");
|
||||
for (size_t i = 0; i < outputs; ++i) {
|
||||
wlr_noop_add_output(backend);
|
||||
}
|
||||
|
||||
return backend;
|
||||
}
|
||||
|
||||
static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
|
||||
struct wlr_backend *backend, struct wlr_session *session,
|
||||
wlr_renderer_create_func_t create_renderer_func) {
|
||||
|
|
@ -170,6 +185,8 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
|
|||
#endif
|
||||
} else if (strcmp(name, "headless") == 0) {
|
||||
return attempt_headless_backend(display, create_renderer_func);
|
||||
} else if (strcmp(name, "noop") == 0) {
|
||||
return attempt_noop_backend(display);
|
||||
} else if (strcmp(name, "drm") == 0 || strcmp(name, "libinput") == 0) {
|
||||
// DRM and libinput need a session
|
||||
if (!*session) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue