diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/session/direct-ipc.h | 12 | ||||
-rw-r--r-- | include/wlr/session.h | 51 | ||||
-rw-r--r-- | include/wlr/session/interface.h | 5 |
3 files changed, 60 insertions, 8 deletions
diff --git a/include/session/direct-ipc.h b/include/session/direct-ipc.h new file mode 100644 index 00000000..96504f04 --- /dev/null +++ b/include/session/direct-ipc.h @@ -0,0 +1,12 @@ +#ifndef SESSION_DIRECT_IPC +#define SESSION_DIRECT_IPC + +#include <sys/types.h> + +int direct_ipc_open(int sock, const char *path); +void direct_ipc_setmaster(int sock, int fd); +void direct_ipc_dropmaster(int sock, int fd); +void direct_ipc_finish(int sock, pid_t pid); +int direct_ipc_start(pid_t *pid_out); + +#endif diff --git a/include/wlr/session.h b/include/wlr/session.h index 4a5b2174..7961e620 100644 --- a/include/wlr/session.h +++ b/include/wlr/session.h @@ -9,16 +9,57 @@ struct session_impl; struct wlr_session { const struct session_impl *impl; - - bool active; + /* + * Signal for when the session becomes active/inactive. + * It's called when we swap virtual terminal. + */ struct wl_signal session_signal; + bool active; + + int drm_fd; + unsigned vtnr; + 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); -int wlr_session_open_file(struct wlr_session *restrict session, - const char *restrict path); + +/* + * 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); -bool wlr_session_change_vt(struct wlr_session *session, int vt); + +/* + * Changes the virtual terminal. + */ +bool wlr_session_change_vt(struct wlr_session *session, unsigned vt); #endif diff --git a/include/wlr/session/interface.h b/include/wlr/session/interface.h index f75acfa4..4938110d 100644 --- a/include/wlr/session/interface.h +++ b/include/wlr/session/interface.h @@ -6,10 +6,9 @@ struct session_impl { struct wlr_session *(*start)(struct wl_display *disp); void (*finish)(struct wlr_session *session); - int (*open)(struct wlr_session *restrict session, - const char *restrict path); + int (*open)(struct wlr_session *session, const char *path); void (*close)(struct wlr_session *session, int fd); - bool (*change_vt)(struct wlr_session *session, int vt); + bool (*change_vt)(struct wlr_session *session, unsigned vt); }; #endif |