|
|
|
@ -1,22 +1,24 @@
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
|
|
#include <wlr/session.h>
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <wlr/session.h>
|
|
|
|
|
#include <wlr/session/interface.h>
|
|
|
|
|
#include "common/log.h"
|
|
|
|
|
#include "session/interface.h"
|
|
|
|
|
|
|
|
|
|
static const struct session_interface *ifaces[] = {
|
|
|
|
|
extern const struct session_impl session_logind;
|
|
|
|
|
extern const struct session_impl session_direct;
|
|
|
|
|
|
|
|
|
|
static const struct session_impl *impls[] = {
|
|
|
|
|
#ifdef HAS_SYSTEMD
|
|
|
|
|
&session_logind_iface,
|
|
|
|
|
&session_logind,
|
|
|
|
|
#endif
|
|
|
|
|
&session_direct_iface,
|
|
|
|
|
&session_direct,
|
|
|
|
|
NULL,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct wlr_session *wlr_session_start(struct wl_display *disp) {
|
|
|
|
|
const struct session_interface **iter;
|
|
|
|
|
const struct session_impl **iter;
|
|
|
|
|
|
|
|
|
|
for (iter = ifaces; *iter; ++iter) {
|
|
|
|
|
for (iter = impls; *iter; ++iter) {
|
|
|
|
|
struct wlr_session *session = (*iter)->start(disp);
|
|
|
|
|
if (session) {
|
|
|
|
|
return session;
|
|
|
|
@ -28,19 +30,19 @@ struct wlr_session *wlr_session_start(struct wl_display *disp) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wlr_session_finish(struct wlr_session *session) {
|
|
|
|
|
session->iface->finish(session);
|
|
|
|
|
session->impl->finish(session);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int wlr_session_open_file(struct wlr_session *restrict session,
|
|
|
|
|
const char *restrict path) {
|
|
|
|
|
|
|
|
|
|
return session->iface->open(session, path);
|
|
|
|
|
return session->impl->open(session, path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void wlr_session_close_file(struct wlr_session *session, int fd) {
|
|
|
|
|
session->iface->close(session, fd);
|
|
|
|
|
session->impl->close(session, fd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool wlr_session_change_vt(struct wlr_session *session, int vt) {
|
|
|
|
|
return session->iface->change_vt(session, vt);
|
|
|
|
|
return session->impl->change_vt(session, vt);
|
|
|
|
|
}
|
|
|
|
|