Documentation for <wlr/backend/session.h>

Back to index

Table of contents

struct wlr_device

struct wlr_device {
	int fd;
	int device_id;
	dev_t dev;
	struct wl_list link;
	struct {
		struct wl_signal change;
		struct wl_signal remove;
	} events;
};

struct wlr_device_change_event

struct wlr_device_change_event {
	enum wlr_device_change_type type;
	union {
		struct wlr_device_hotplug_event hotplug;
	} ;
};

enum wlr_device_change_type

enum wlr_device_change_type {
	WLR_DEVICE_HOTPLUG,
	WLR_DEVICE_LEASE,
};

struct wlr_device_hotplug_event

struct wlr_device_hotplug_event {
	uint32_t connector_id;
	uint32_t prop_id;
};

struct wlr_session

struct wlr_session {
	bool active;
	unsigned vtnr;
	char seat[];
	struct udev *udev;
	struct udev_monitor *mon;
	struct wl_event_source *udev_event;
	struct libseat *seat_handle;
	struct wl_event_source *libseat_event;
	struct wl_list devices;
	struct wl_display *display;
	struct wl_listener display_destroy;
	struct {
		struct wl_signal active;
		struct wl_signal add_drm_card;
		struct wl_signal destroy;
	} events;
};

struct wlr_session_add_event

struct wlr_session_add_event {
	const char *path;
};

wlr_session_change_vt()

bool wlr_session_change_vt(​struct wlr_session *session, unsigned vt);

Changes the virtual terminal.

wlr_session_close_file()

void wlr_session_close_file(​struct wlr_session *session, struct wlr_device *device);

Closes a file previously opened with wlr_session_open_file().

wlr_session_create()

struct wlr_session *wlr_session_create(​struct wl_display *disp);

Opens a session, taking control of the current virtual terminal. This should not be called if another program is already in control of the terminal (Xorg, another Wayland compositor, etc.).

Returns NULL on error.

wlr_session_destroy()

void wlr_session_destroy(​struct wlr_session *session);

Closes a previously opened session and restores the virtual terminal. You should call wlr_session_close_file() on each files you opened with wlr_session_open_file() before you call this.

wlr_session_find_gpus()

ssize_t wlr_session_find_gpus(​struct wlr_session *session, size_t ret_len, struct wlr_device **ret);

wlr_session_open_file()

struct wlr_device *wlr_session_open_file(​struct wlr_session *session, const char *path);

Opens the file at path.

This can only be used to open DRM or evdev (input) devices. Files opened via this function must be closed by calling wlr_session_close_file().

When the session becomes inactive:

- DRM files lose their DRM master status - evdev files become invalid and should be closed