Rename functions to be consistent with #93
This commit is contained in:
parent
f10da8291b
commit
46823152ea
|
@ -85,7 +85,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
|
||||||
|
|
||||||
// Attempt DRM+libinput
|
// Attempt DRM+libinput
|
||||||
|
|
||||||
struct wlr_session *session = wlr_session_start(display);
|
struct wlr_session *session = wlr_session_create(display);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
wlr_log(L_ERROR, "Failed to start a DRM session");
|
wlr_log(L_ERROR, "Failed to start a DRM session");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -131,6 +131,6 @@ error_gpu:
|
||||||
error_udev:
|
error_udev:
|
||||||
wlr_udev_destroy(udev);
|
wlr_udev_destroy(udev);
|
||||||
error_session:
|
error_session:
|
||||||
wlr_session_finish(session);
|
wlr_session_destroy(session);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ static void multi_backend_destroy(struct wlr_backend *_backend) {
|
||||||
free(sub);
|
free(sub);
|
||||||
}
|
}
|
||||||
list_free(backend->backends);
|
list_free(backend->backends);
|
||||||
wlr_session_finish(backend->session);
|
wlr_session_destroy(backend->session);
|
||||||
wlr_udev_destroy(backend->udev);
|
wlr_udev_destroy(backend->udev);
|
||||||
free(backend);
|
free(backend);
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ void direct_ipc_finish(int sock, pid_t pid) {
|
||||||
waitpid(pid, NULL, 0);
|
waitpid(pid, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int direct_ipc_start(pid_t *pid_out) {
|
int direct_ipc_init(pid_t *pid_out) {
|
||||||
if (!have_permissions()) {
|
if (!have_permissions()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ static bool direct_change_vt(struct wlr_session *base, unsigned vt) {
|
||||||
return ioctl(session->tty_fd, VT_ACTIVATE, (int)vt) == 0;
|
return ioctl(session->tty_fd, VT_ACTIVATE, (int)vt) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void direct_session_finish(struct wlr_session *base) {
|
static void direct_session_destroy(struct wlr_session *base) {
|
||||||
struct direct_session *session = wl_container_of(base, session, base);
|
struct direct_session *session = wl_container_of(base, session, base);
|
||||||
struct vt_mode mode = {
|
struct vt_mode mode = {
|
||||||
.mode = VT_AUTO,
|
.mode = VT_AUTO,
|
||||||
|
@ -196,14 +196,14 @@ error:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_session *direct_session_start(struct wl_display *disp) {
|
static struct wlr_session *direct_session_create(struct wl_display *disp) {
|
||||||
struct direct_session *session = calloc(1, sizeof(*session));
|
struct direct_session *session = calloc(1, sizeof(*session));
|
||||||
if (!session) {
|
if (!session) {
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
wlr_log_errno(L_ERROR, "Allocation failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
session->sock = direct_ipc_start(&session->child);
|
session->sock = direct_ipc_init(&session->child);
|
||||||
if (session->sock == -1) {
|
if (session->sock == -1) {
|
||||||
goto error_session;
|
goto error_session;
|
||||||
}
|
}
|
||||||
|
@ -236,8 +236,8 @@ error_session:
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct session_impl session_direct = {
|
const struct session_impl session_direct = {
|
||||||
.start = direct_session_start,
|
.create = direct_session_create,
|
||||||
.finish = direct_session_finish,
|
.destroy = direct_session_destroy,
|
||||||
.open = direct_session_open,
|
.open = direct_session_open,
|
||||||
.close = direct_session_close,
|
.close = direct_session_close,
|
||||||
.change_vt = direct_change_vt,
|
.change_vt = direct_change_vt,
|
||||||
|
|
|
@ -204,7 +204,7 @@ static void release_control(struct logind_session *session) {
|
||||||
sd_bus_message_unref(msg);
|
sd_bus_message_unref(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void logind_session_finish(struct wlr_session *base) {
|
static void logind_session_destroy(struct wlr_session *base) {
|
||||||
struct logind_session *session = wl_container_of(base, session, base);
|
struct logind_session *session = wl_container_of(base, session, base);
|
||||||
|
|
||||||
release_control(session);
|
release_control(session);
|
||||||
|
@ -316,7 +316,7 @@ static int dbus_event(int fd, uint32_t mask, void *data) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_session *logind_session_start(struct wl_display *disp) {
|
static struct wlr_session *logind_session_create(struct wl_display *disp) {
|
||||||
int ret;
|
int ret;
|
||||||
struct logind_session *session = calloc(1, sizeof(*session));
|
struct logind_session *session = calloc(1, sizeof(*session));
|
||||||
if (!session) {
|
if (!session) {
|
||||||
|
@ -390,8 +390,8 @@ error:
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct session_impl session_logind = {
|
const struct session_impl session_logind = {
|
||||||
.start = logind_session_start,
|
.create = logind_session_create,
|
||||||
.finish = logind_session_finish,
|
.destroy = logind_session_destroy,
|
||||||
.open = logind_take_device,
|
.open = logind_take_device,
|
||||||
.close = logind_release_device,
|
.close = logind_release_device,
|
||||||
.change_vt = logind_change_vt,
|
.change_vt = logind_change_vt,
|
||||||
|
|
|
@ -15,11 +15,11 @@ static const struct session_impl *impls[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_session *wlr_session_start(struct wl_display *disp) {
|
struct wlr_session *wlr_session_create(struct wl_display *disp) {
|
||||||
const struct session_impl **iter;
|
const struct session_impl **iter;
|
||||||
|
|
||||||
for (iter = impls; *iter; ++iter) {
|
for (iter = impls; *iter; ++iter) {
|
||||||
struct wlr_session *session = (*iter)->start(disp);
|
struct wlr_session *session = (*iter)->create(disp);
|
||||||
if (session) {
|
if (session) {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,12 @@ struct wlr_session *wlr_session_start(struct wl_display *disp) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_session_finish(struct wlr_session *session) {
|
void wlr_session_destroy(struct wlr_session *session) {
|
||||||
if (!session) {
|
if (!session) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
session->impl->finish(session);
|
session->impl->destroy(session);
|
||||||
};
|
};
|
||||||
|
|
||||||
int wlr_session_open_file(struct wlr_session *session, const char *path) {
|
int wlr_session_open_file(struct wlr_session *session, const char *path) {
|
||||||
|
|
|
@ -7,6 +7,6 @@ int direct_ipc_open(int sock, const char *path);
|
||||||
void direct_ipc_setmaster(int sock, int fd);
|
void direct_ipc_setmaster(int sock, int fd);
|
||||||
void direct_ipc_dropmaster(int sock, int fd);
|
void direct_ipc_dropmaster(int sock, int fd);
|
||||||
void direct_ipc_finish(int sock, pid_t pid);
|
void direct_ipc_finish(int sock, pid_t pid);
|
||||||
int direct_ipc_start(pid_t *pid_out);
|
int direct_ipc_init(pid_t *pid_out);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,14 +31,14 @@ struct wlr_session {
|
||||||
*
|
*
|
||||||
* Returns NULL on error.
|
* Returns NULL on error.
|
||||||
*/
|
*/
|
||||||
struct wlr_session *wlr_session_start(struct wl_display *disp);
|
struct wlr_session *wlr_session_create(struct wl_display *disp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Closes a previously opened session and restores the virtual terminal.
|
* Closes a previously opened session and restores the virtual terminal.
|
||||||
* You should call wlr_session_close_file on each files you opened
|
* You should call wlr_session_close_file on each files you opened
|
||||||
* with wlr_session_open_file before you call this.
|
* with wlr_session_open_file before you call this.
|
||||||
*/
|
*/
|
||||||
void wlr_session_finish(struct wlr_session *session);
|
void wlr_session_destroy(struct wlr_session *session);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Opens the file at path.
|
* Opens the file at path.
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <wlr/backend/session.h>
|
#include <wlr/backend/session.h>
|
||||||
|
|
||||||
struct session_impl {
|
struct session_impl {
|
||||||
struct wlr_session *(*start)(struct wl_display *disp);
|
struct wlr_session *(*create)(struct wl_display *disp);
|
||||||
void (*finish)(struct wlr_session *session);
|
void (*destroy)(struct wlr_session *session);
|
||||||
int (*open)(struct wlr_session *session, const char *path);
|
int (*open)(struct wlr_session *session, const char *path);
|
||||||
void (*close)(struct wlr_session *session, int fd);
|
void (*close)(struct wlr_session *session, int fd);
|
||||||
bool (*change_vt)(struct wlr_session *session, unsigned vt);
|
bool (*change_vt)(struct wlr_session *session, unsigned vt);
|
||||||
|
|
Loading…
Reference in New Issue