mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-16 08:56:26 -05:00
New session interface.
This commit is contained in:
parent
e446a5300b
commit
762ac7f4c0
6 changed files with 316 additions and 2 deletions
38
session/session.c
Normal file
38
session/session.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include <stddef.h>
|
||||
|
||||
#include <wlr/session.h>
|
||||
#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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue