Add a noop output using the noop backend
This is intended for use when no real outputs are available.
This commit is contained in:
parent
93f4133812
commit
6e2ad0583c
@ -1,5 +1,6 @@
|
|||||||
#define WLR_USE_UNSTABLE
|
#define WLR_USE_UNSTABLE
|
||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
|
#include <wlr/backend/noop.h>
|
||||||
#include <wlr/backend/multi.h>
|
#include <wlr/backend/multi.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
|
||||||
@ -22,3 +23,11 @@ bool river_wlr_backend_is_multi(struct wlr_backend *backend) {
|
|||||||
struct wlr_session *river_wlr_backend_get_session(struct wlr_backend *backend) {
|
struct wlr_session *river_wlr_backend_get_session(struct wlr_backend *backend) {
|
||||||
return wlr_backend_get_session(backend);
|
return wlr_backend_get_session(backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_backend *river_wlr_noop_backend_create(struct wl_display *display) {
|
||||||
|
return wlr_noop_backend_create(display);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct wlr_output *river_wlr_noop_add_output(struct wlr_backend *backend) {
|
||||||
|
return wlr_noop_add_output(backend);
|
||||||
|
}
|
||||||
|
@ -27,5 +27,7 @@ struct wlr_renderer *river_wlr_backend_get_renderer(struct wlr_backend *backend)
|
|||||||
bool river_wlr_backend_start(struct wlr_backend *backend);
|
bool river_wlr_backend_start(struct wlr_backend *backend);
|
||||||
bool river_wlr_backend_is_multi(struct wlr_backend *backend);
|
bool river_wlr_backend_is_multi(struct wlr_backend *backend);
|
||||||
struct wlr_session *river_wlr_backend_get_session(struct wlr_backend *backend);
|
struct wlr_session *river_wlr_backend_get_session(struct wlr_backend *backend);
|
||||||
|
struct wlr_backend *river_wlr_noop_backend_create(struct wl_display *display);
|
||||||
|
struct wlr_output *river_wlr_noop_add_output(struct wlr_backend *backend);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,6 +19,9 @@ pub const Root = struct {
|
|||||||
wlr_output_layout: *c.wlr_output_layout,
|
wlr_output_layout: *c.wlr_output_layout,
|
||||||
outputs: std.TailQueue(Output),
|
outputs: std.TailQueue(Output),
|
||||||
|
|
||||||
|
/// This output is used when no real outputs are available.
|
||||||
|
noop_output: Output,
|
||||||
|
|
||||||
/// Number of pending configures sent in the current transaction.
|
/// Number of pending configures sent in the current transaction.
|
||||||
/// A value of 0 means there is no current transaction.
|
/// A value of 0 means there is no current transaction.
|
||||||
pending_configures: u32,
|
pending_configures: u32,
|
||||||
@ -37,6 +40,10 @@ pub const Root = struct {
|
|||||||
|
|
||||||
self.outputs = std.TailQueue(Output).init();
|
self.outputs = std.TailQueue(Output).init();
|
||||||
|
|
||||||
|
const noop_wlr_output = c.river_wlr_noop_add_output(server.noop_backend) orelse
|
||||||
|
return error.CantAddNoopOutput;
|
||||||
|
try self.noop_output.init(self, noop_wlr_output);
|
||||||
|
|
||||||
self.pending_configures = 0;
|
self.pending_configures = 0;
|
||||||
|
|
||||||
self.transaction_timer = null;
|
self.transaction_timer = null;
|
||||||
|
@ -18,6 +18,7 @@ pub const Server = struct {
|
|||||||
wl_display: *c.wl_display,
|
wl_display: *c.wl_display,
|
||||||
wl_event_loop: *c.wl_event_loop,
|
wl_event_loop: *c.wl_event_loop,
|
||||||
wlr_backend: *c.wlr_backend,
|
wlr_backend: *c.wlr_backend,
|
||||||
|
noop_backend: *c.wlr_backend,
|
||||||
wlr_renderer: *c.wlr_renderer,
|
wlr_renderer: *c.wlr_renderer,
|
||||||
|
|
||||||
wlr_xdg_shell: *c.wlr_xdg_shell,
|
wlr_xdg_shell: *c.wlr_xdg_shell,
|
||||||
@ -47,12 +48,16 @@ pub const Server = struct {
|
|||||||
|
|
||||||
// The wlr_backend abstracts the input/output hardware. Autocreate chooses
|
// The wlr_backend abstracts the input/output hardware. Autocreate chooses
|
||||||
// the best option based on the environment, for example DRM when run from
|
// the best option based on the environment, for example DRM when run from
|
||||||
// a tty or wayland if WAYLAND_DISPLAY is set.
|
// a tty or wayland if WAYLAND_DISPLAY is set. This frees itself when the
|
||||||
//
|
// wl_display is destroyed.
|
||||||
// This frees itself.when the wl_display is destroyed.
|
|
||||||
self.wlr_backend = c.river_wlr_backend_autocreate(self.wl_display) orelse
|
self.wlr_backend = c.river_wlr_backend_autocreate(self.wl_display) orelse
|
||||||
return error.CantCreateWlrBackend;
|
return error.CantCreateWlrBackend;
|
||||||
|
|
||||||
|
// This backend is used to create a noop output for use when no actual
|
||||||
|
// outputs are available. This frees itself when the wl_display is destroyed.
|
||||||
|
self.noop_backend = c.river_wlr_noop_backend_create(self.wl_display) orelse
|
||||||
|
return error.CantCreateNoopBackend;
|
||||||
|
|
||||||
// If we don't provide a renderer, autocreate makes a GLES2 renderer for us.
|
// If we don't provide a renderer, autocreate makes a GLES2 renderer for us.
|
||||||
// The renderer is responsible for defining the various pixel formats it
|
// The renderer is responsible for defining the various pixel formats it
|
||||||
// supports for shared memory, this configures that for clients.
|
// supports for shared memory, this configures that for clients.
|
||||||
|
Loading…
Reference in New Issue
Block a user