aboutsummaryrefslogtreecommitdiff
path: root/include/wlr/session.h
diff options
context:
space:
mode:
authorScott Anderson <ascent12@hotmail.com>2017-07-09 23:02:41 +1200
committerScott Anderson <ascent12@hotmail.com>2017-07-09 23:02:41 +1200
commit5b8ec107b9ca91ef8d81ce4e561605b808b6a03e (patch)
tree6f4d070e0bada658a2e16c1dee488bc8963db6d5 /include/wlr/session.h
parent3779ef802ddf89067e1588077ed8c72b4674565a (diff)
Session documentation.
Diffstat (limited to 'include/wlr/session.h')
-rw-r--r--include/wlr/session.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/wlr/session.h b/include/wlr/session.h
index 52dbf8ca..7961e620 100644
--- a/include/wlr/session.h
+++ b/include/wlr/session.h
@@ -9,6 +9,10 @@ struct session_impl;
struct wlr_session {
const struct session_impl *impl;
+ /*
+ * Signal for when the session becomes active/inactive.
+ * It's called when we swap virtual terminal.
+ */
struct wl_signal session_signal;
bool active;
@@ -17,10 +21,45 @@ struct wlr_session {
char seat[8];
};
+/*
+ * 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.).
+ *
+ * If logind support is not enabled, you must have CAP_SYS_ADMIN or be root.
+ * It is safe to drop priviledges after this is called.
+ *
+ * Returns NULL on error.
+ */
struct wlr_session *wlr_session_start(struct wl_display *disp);
+
+/*
+ * 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.
+ */
void wlr_session_finish(struct wlr_session *session);
+
+/*
+ * Opens the file at path.
+ * This can only be used to open DRM or evdev (input) devices.
+ *
+ * When the session becomes inactive:
+ * - DRM files lose their DRM master status
+ * - evdev files become invalid and should be closed
+ *
+ * Returns -errno on error.
+ */
int wlr_session_open_file(struct wlr_session *session, const char *path);
+
+/*
+ * Closes a file previously opened with wlr_session_open_file.
+ */
void wlr_session_close_file(struct wlr_session *session, int fd);
+
+/*
+ * Changes the virtual terminal.
+ */
bool wlr_session_change_vt(struct wlr_session *session, unsigned vt);
#endif