From 762ac7f4c0168bf2ce536d94b3b44cb95939d769 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 3 May 2017 14:11:22 +1200 Subject: New session interface. --- session/session.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 session/session.c (limited to 'session/session.c') diff --git a/session/session.c b/session/session.c new file mode 100644 index 00000000..88391e6e --- /dev/null +++ b/session/session.c @@ -0,0 +1,38 @@ +#include + +#include +#include "session/interface.h" + +static const struct session_interface *ifaces[] = { +#ifdef HAS_SYSTEMD + &session_logind_iface, +#endif + NULL, +}; + +struct wlr_session *wlr_session_start(void) { + const struct session_interface **iter; + + for (iter = ifaces; *iter; ++iter) { + struct wlr_session *session = (*iter)->start(); + if (session) { + return session; + } + } + + return NULL; +} + +void wlr_session_finish(struct wlr_session *session) { + session->iface.finish(session); +}; + +int wlr_session_open_file(struct wlr_session *restrict session, + const char *restrict path) { + + return session->iface.open(session, path); +} + +void wlr_session_close_file(struct wlr_session *session, int fd) { + session->iface.close(session, fd); +} -- cgit v1.2.3