backend/wayland: take existing wl_display in wlr_wl_backend_create()

This allows compositors to use an existing wl_display, to integrate
wlroots with an existing toolkit.
This commit is contained in:
Simon Ser 2023-06-07 14:15:44 +02:00
parent 664ec59095
commit dd24991c9e
3 changed files with 20 additions and 11 deletions

View file

@ -30,6 +30,7 @@ struct wlr_wl_backend {
/* remote state */
struct wl_display *remote_display;
bool own_remote_display;
struct wl_event_source *remote_display_src;
struct wl_registry *registry;
struct wl_compositor *compositor;

View file

@ -12,12 +12,11 @@ struct wlr_input_device;
* Creates a new Wayland backend. This backend will be created with no outputs;
* you must use wlr_wl_output_create() to add them.
*
* The `remote` argument is the name of the host compositor wayland socket. Set
* to NULL for the default behaviour (WAYLAND_DISPLAY env variable or wayland-0
* default).
* The remote_display argument is an existing libwayland-client struct wl_display
* to use. Leave it NULL to create a new connection to the compositor.
*/
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
const char *remote);
struct wl_display *remote_display);
/**
* Returns the remote struct wl_display used by the Wayland backend.