wlr_backend_init -> wlr_backend_start

Also renames create to init. We'll use create for anything that
allocates and init for anything that takes a pointer and initializes it.
This commit is contained in:
Drew DeVault 2017-08-13 09:59:14 -04:00
parent 43fb40e949
commit 4386816889
8 changed files with 22 additions and 22 deletions

View File

@ -14,7 +14,7 @@
#include <wlr/util/log.h>
#include "backend/udev.h"
void wlr_backend_create(struct wlr_backend *backend,
void wlr_backend_init(struct wlr_backend *backend,
const struct wlr_backend_impl *impl) {
assert(backend);
backend->impl = impl;
@ -24,9 +24,9 @@ void wlr_backend_create(struct wlr_backend *backend,
wl_signal_init(&backend->events.output_remove);
}
bool wlr_backend_init(struct wlr_backend *backend) {
if (backend->impl->init) {
return backend->impl->init(backend);
bool wlr_backend_start(struct wlr_backend *backend) {
if (backend->impl->start) {
return backend->impl->start(backend);
}
return true;
}

View File

@ -16,7 +16,7 @@
#include "backend/udev.h"
#include "backend/drm.h"
static bool wlr_drm_backend_init(struct wlr_backend *_backend) {
static bool wlr_drm_backend_start(struct wlr_backend *_backend) {
struct wlr_drm_backend *backend = (struct wlr_drm_backend *)_backend;
wlr_drm_scan_connectors(backend);
return true;
@ -47,7 +47,7 @@ static struct wlr_egl *wlr_drm_backend_get_egl(struct wlr_backend *_backend) {
}
static struct wlr_backend_impl backend_impl = {
.init = wlr_drm_backend_init,
.start = wlr_drm_backend_start,
.destroy = wlr_drm_backend_destroy,
.get_egl = wlr_drm_backend_get_egl
};
@ -106,7 +106,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
wlr_log_errno(L_ERROR, "Allocation failed");
return NULL;
}
wlr_backend_create(&backend->backend, &backend_impl);
wlr_backend_init(&backend->backend, &backend_impl);
backend->session = session;
backend->udev = udev;

View File

@ -43,7 +43,7 @@ static void wlr_libinput_log(struct libinput *libinput_context,
_wlr_vlog(L_ERROR, fmt, args);
}
static bool wlr_libinput_backend_init(struct wlr_backend *_backend) {
static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
struct wlr_libinput_backend *backend = (struct wlr_libinput_backend *)_backend;
wlr_log(L_DEBUG, "Initializing libinput");
backend->libinput_context = libinput_udev_create_context(&libinput_impl, backend,
@ -99,7 +99,7 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *_backend) {
}
static struct wlr_backend_impl backend_impl = {
.init = wlr_libinput_backend_init,
.start = wlr_libinput_backend_start,
.destroy = wlr_libinput_backend_destroy
};
@ -127,7 +127,7 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
return NULL;
}
wlr_backend_create(&backend->backend, &backend_impl);
wlr_backend_init(&backend->backend, &backend_impl);
if (!(backend->wlr_device_lists = list_create())) {
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));

View File

@ -15,11 +15,11 @@ struct subbackend_state {
struct wl_listener output_remove;
};
static bool multi_backend_init(struct wlr_backend *_backend) {
static bool multi_backend_start(struct wlr_backend *_backend) {
struct wlr_multi_backend *backend = (struct wlr_multi_backend *)_backend;
for (size_t i = 0; i < backend->backends->length; ++i) {
struct subbackend_state *sub = backend->backends->items[i];
if (!wlr_backend_init(sub->backend)) {
if (!wlr_backend_start(sub->backend)) {
wlr_log(L_ERROR, "Failed to initialize backend %zd", i);
return false;
}
@ -53,7 +53,7 @@ static struct wlr_egl *multi_backend_get_egl(struct wlr_backend *_backend) {
}
struct wlr_backend_impl backend_impl = {
.init = multi_backend_init,
.start = multi_backend_start,
.destroy = multi_backend_destroy,
.get_egl = multi_backend_get_egl
};
@ -74,7 +74,7 @@ struct wlr_backend *wlr_multi_backend_create(struct wlr_session *session,
return NULL;
}
wlr_backend_create(&backend->backend, &backend_impl);
wlr_backend_init(&backend->backend, &backend_impl);
backend->session = session;
backend->udev = udev;

View File

@ -29,7 +29,7 @@ static int dispatch_events(int fd, uint32_t mask, void *data) {
* compositor and creates surfaces for each output, then registers globals on
* the specified display.
*/
static bool wlr_wl_backend_init(struct wlr_backend *_backend) {
static bool wlr_wl_backend_start(struct wlr_backend *_backend) {
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
wlr_log(L_INFO, "Initializating wayland backend");
@ -102,7 +102,7 @@ static struct wlr_egl *wlr_wl_backend_get_egl(struct wlr_backend *_backend) {
}
static struct wlr_backend_impl backend_impl = {
.init = wlr_wl_backend_init,
.start = wlr_wl_backend_start,
.destroy = wlr_wl_backend_destroy,
.get_egl = wlr_wl_backend_get_egl
};
@ -130,7 +130,7 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display) {
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
return NULL;
}
wlr_backend_create(&backend->backend, &backend_impl);
wlr_backend_init(&backend->backend, &backend_impl);
if (!(backend->devices = list_create())) {
wlr_log(L_ERROR, "Could not allocate devices list");

View File

@ -512,8 +512,8 @@ void compositor_init(struct compositor_state *state) {
wlr_log(L_INFO, "Running compositor on wayland display '%s'", socket);
setenv("_WAYLAND_DISPLAY", socket, true);
if (!wlr_backend_init(state->backend)) {
wlr_log(L_ERROR, "Failed to initialize backend");
if (!wlr_backend_start(state->backend)) {
wlr_log(L_ERROR, "Failed to start backend");
wlr_backend_destroy(wlr);
exit(1);
}

View File

@ -19,7 +19,7 @@ struct wlr_backend {
};
struct wlr_backend *wlr_backend_autocreate(struct wl_display *display);
bool wlr_backend_init(struct wlr_backend *backend);
bool wlr_backend_start(struct wlr_backend *backend);
void wlr_backend_destroy(struct wlr_backend *backend);
struct wlr_egl *wlr_backend_get_egl(struct wlr_backend *backend);

View File

@ -6,12 +6,12 @@
#include <wlr/egl.h>
struct wlr_backend_impl {
bool (*init)(struct wlr_backend *backend);
bool (*start)(struct wlr_backend *backend);
void (*destroy)(struct wlr_backend *backend);
struct wlr_egl *(*get_egl)(struct wlr_backend *backend);
};
void wlr_backend_create(struct wlr_backend *backend,
void wlr_backend_init(struct wlr_backend *backend,
const struct wlr_backend_impl *impl);
#endif