wlroots-hyprland/session/session.c

47 lines
1 KiB
C
Raw Normal View History

2017-05-03 04:11:22 +02:00
#include <stddef.h>
#include <wlr/session.h>
#include <stdarg.h>
#include "common/log.h"
2017-05-03 04:11:22 +02:00
#include "session/interface.h"
static const struct session_interface *ifaces[] = {
#ifdef HAS_SYSTEMD
&session_logind_iface,
#endif
2017-05-03 09:26:43 +02:00
&session_direct_iface,
2017-05-03 04:11:22 +02:00
NULL,
};
2017-05-13 13:56:40 +02:00
struct wlr_session *wlr_session_start(struct wl_display *disp) {
2017-05-03 04:11:22 +02:00
const struct session_interface **iter;
for (iter = ifaces; *iter; ++iter) {
2017-05-13 13:56:40 +02:00
struct wlr_session *session = (*iter)->start(disp);
2017-05-03 04:11:22 +02:00
if (session) {
return session;
}
}
wlr_log(L_ERROR, "Failed to load session backend");
2017-05-03 04:11:22 +02:00
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);
}
2017-05-13 13:56:40 +02:00
bool wlr_session_change_vt(struct wlr_session *session, int vt) {
return session->iface.change_vt(session, vt);
}