aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/backend.c7
-rw-r--r--backend/drm/backend.c3
-rw-r--r--backend/drm/drm.c2
-rw-r--r--backend/headless/backend.c3
-rw-r--r--backend/headless/input_device.c3
-rw-r--r--backend/headless/output.c3
-rw-r--r--backend/libinput/backend.c4
-rw-r--r--backend/libinput/events.c2
-rw-r--r--backend/multi/backend.c7
-rw-r--r--backend/session/session.c8
-rw-r--r--backend/wayland/backend.c3
-rw-r--r--backend/wayland/output.c3
-rw-r--r--backend/wayland/wl_seat.c2
-rw-r--r--backend/x11/backend.c5
14 files changed, 55 insertions, 0 deletions
diff --git a/backend/backend.c b/backend/backend.c
index bd8d04d1..c2a487e7 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -13,7 +13,9 @@
#include <wlr/backend/wayland.h>
#include <wlr/backend/x11.h>
#include <wlr/util/log.h>
+#include "util/defs.h"
+WLR_API
void wlr_backend_init(struct wlr_backend *backend,
const struct wlr_backend_impl *impl) {
assert(backend);
@@ -23,6 +25,7 @@ void wlr_backend_init(struct wlr_backend *backend,
wl_signal_init(&backend->events.new_output);
}
+WLR_API
bool wlr_backend_start(struct wlr_backend *backend) {
if (backend->impl->start) {
return backend->impl->start(backend);
@@ -30,6 +33,7 @@ bool wlr_backend_start(struct wlr_backend *backend) {
return true;
}
+WLR_API
void wlr_backend_destroy(struct wlr_backend *backend) {
if (!backend) {
return;
@@ -42,6 +46,7 @@ void wlr_backend_destroy(struct wlr_backend *backend) {
}
}
+WLR_API
struct wlr_egl *wlr_backend_get_egl(struct wlr_backend *backend) {
if (backend->impl->get_egl) {
return backend->impl->get_egl(backend);
@@ -49,6 +54,7 @@ struct wlr_egl *wlr_backend_get_egl(struct wlr_backend *backend) {
return NULL;
}
+WLR_API
struct wlr_renderer *wlr_backend_get_renderer(struct wlr_backend *backend) {
if (backend->impl->get_renderer) {
return backend->impl->get_renderer(backend);
@@ -79,6 +85,7 @@ static struct wlr_backend *attempt_wl_backend(struct wl_display *display) {
return backend;
}
+WLR_API
struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
struct wlr_backend *backend = wlr_multi_backend_create(display);
if (!backend) {
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index 47dff227..571c5c9d 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -13,6 +13,7 @@
#include <wlr/util/log.h>
#include <xf86drm.h>
#include "backend/drm/drm.h"
+#include "util/defs.h"
#include "util/signal.h"
static bool wlr_drm_backend_start(struct wlr_backend *backend) {
@@ -66,6 +67,7 @@ static struct wlr_backend_impl backend_impl = {
.get_renderer = wlr_drm_backend_get_renderer,
};
+WLR_API
bool wlr_backend_is_drm(struct wlr_backend *b) {
return b->impl == &backend_impl;
}
@@ -117,6 +119,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
wlr_drm_backend_destroy(&drm->backend);
}
+WLR_API
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
struct wlr_session *session, int gpu_fd, struct wlr_backend *parent) {
assert(display && session && gpu_fd >= 0);
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index e60b7e1c..493ef1f5 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -24,6 +24,7 @@
#include "backend/drm/drm.h"
#include "backend/drm/iface.h"
#include "backend/drm/util.h"
+#include "util/defs.h"
#include "util/signal.h"
bool wlr_drm_check_features(struct wlr_drm_backend *drm) {
@@ -728,6 +729,7 @@ static struct wlr_output_impl output_impl = {
.get_gamma_size = wlr_drm_connector_get_gamma_size,
};
+WLR_API
bool wlr_output_is_drm(struct wlr_output *output) {
return output->impl == &output_impl;
}
diff --git a/backend/headless/backend.c b/backend/headless/backend.c
index 663bc13b..49201192 100644
--- a/backend/headless/backend.c
+++ b/backend/headless/backend.c
@@ -7,6 +7,7 @@
#include <wlr/util/log.h>
#include "backend/headless.h"
#include "glapi.h"
+#include "util/defs.h"
static bool backend_start(struct wlr_backend *wlr_backend) {
struct wlr_headless_backend *backend =
@@ -84,6 +85,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
backend_destroy(&backend->backend);
}
+WLR_API
struct wlr_backend *wlr_headless_backend_create(struct wl_display *display) {
wlr_log(L_INFO, "Creating headless backend");
@@ -125,6 +127,7 @@ struct wlr_backend *wlr_headless_backend_create(struct wl_display *display) {
return &backend->backend;
}
+WLR_API
bool wlr_backend_is_headless(struct wlr_backend *backend) {
return backend->impl == &backend_impl;
}
diff --git a/backend/headless/input_device.c b/backend/headless/input_device.c
index ea335aff..66946f77 100644
--- a/backend/headless/input_device.c
+++ b/backend/headless/input_device.c
@@ -7,6 +7,7 @@
#include <wlr/interfaces/wlr_touch.h>
#include <wlr/util/log.h>
#include "backend/headless.h"
+#include "util/defs.h"
#include "util/signal.h"
static void input_device_destroy(struct wlr_input_device *wlr_dev) {
@@ -19,10 +20,12 @@ static struct wlr_input_device_impl input_device_impl = {
.destroy = input_device_destroy,
};
+WLR_API
bool wlr_input_device_is_headless(struct wlr_input_device *wlr_dev) {
return wlr_dev->impl == &input_device_impl;
}
+WLR_API
struct wlr_input_device *wlr_headless_add_input_device(
struct wlr_backend *wlr_backend, enum wlr_input_device_type type) {
struct wlr_headless_backend *backend =
diff --git a/backend/headless/output.c b/backend/headless/output.c
index ba4a094e..70182ea0 100644
--- a/backend/headless/output.c
+++ b/backend/headless/output.c
@@ -5,6 +5,7 @@
#include <wlr/interfaces/wlr_output.h>
#include <wlr/util/log.h>
#include "backend/headless.h"
+#include "util/defs.h"
#include "util/signal.h"
static EGLSurface egl_create_surface(struct wlr_egl *egl, unsigned int width,
@@ -79,6 +80,7 @@ static const struct wlr_output_impl output_impl = {
.swap_buffers = output_swap_buffers,
};
+WLR_API
bool wlr_output_is_headless(struct wlr_output *wlr_output) {
return wlr_output->impl == &output_impl;
}
@@ -90,6 +92,7 @@ static int signal_frame(void *data) {
return 0;
}
+WLR_API
struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend,
unsigned int width, unsigned int height) {
struct wlr_headless_backend *backend =
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c
index e2a1165f..41a04a27 100644
--- a/backend/libinput/backend.c
+++ b/backend/libinput/backend.c
@@ -5,6 +5,7 @@
#include <wlr/backend/session.h>
#include <wlr/util/log.h>
#include "backend/libinput.h"
+#include "util/defs.h"
#include "util/signal.h"
static int wlr_libinput_open_restricted(const char *path,
@@ -128,6 +129,7 @@ static struct wlr_backend_impl backend_impl = {
.destroy = wlr_libinput_backend_destroy
};
+WLR_API
bool wlr_backend_is_libinput(struct wlr_backend *b) {
return b->impl == &backend_impl;
}
@@ -154,6 +156,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
wlr_libinput_backend_destroy(&backend->backend);
}
+WLR_API
struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
struct wlr_session *session) {
assert(display && session);
@@ -185,6 +188,7 @@ error_backend:
return NULL;
}
+WLR_API
struct libinput_device *wlr_libinput_get_device_handle(struct wlr_input_device *_dev) {
struct wlr_libinput_input_device *dev = (struct wlr_libinput_input_device *)_dev;
return dev->handle;
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index 603eed07..7faff92f 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -6,6 +6,7 @@
#include <wlr/interfaces/wlr_input_device.h>
#include <wlr/util/log.h>
#include "backend/libinput.h"
+#include "util/defs.h"
#include "util/signal.h"
struct wlr_input_device *get_appropriate_device(
@@ -54,6 +55,7 @@ static struct wlr_input_device *allocate_device(
return wlr_dev;
}
+WLR_API
bool wlr_input_device_is_libinput(struct wlr_input_device *wlr_dev) {
return wlr_dev->impl == &input_device_impl;
}
diff --git a/backend/multi/backend.c b/backend/multi/backend.c
index 5cb3fbc5..a1ff288b 100644
--- a/backend/multi/backend.c
+++ b/backend/multi/backend.c
@@ -6,6 +6,7 @@
#include <wlr/util/log.h>
#include "backend/drm/drm.h"
#include "backend/multi.h"
+#include "util/defs.h"
#include "util/signal.h"
struct subbackend_state {
@@ -90,6 +91,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
multi_backend_destroy((struct wlr_backend*)backend);
}
+WLR_API
struct wlr_backend *wlr_multi_backend_create(struct wl_display *display) {
struct wlr_multi_backend *backend =
calloc(1, sizeof(struct wlr_multi_backend));
@@ -110,6 +112,7 @@ struct wlr_backend *wlr_multi_backend_create(struct wl_display *display) {
return &backend->backend;
}
+WLR_API
bool wlr_backend_is_multi(struct wlr_backend *b) {
return b->impl == &backend_impl;
}
@@ -143,6 +146,7 @@ static struct subbackend_state *multi_backend_get_subbackend(struct wlr_multi_ba
return NULL;
}
+WLR_API
void wlr_multi_backend_add(struct wlr_backend *_multi,
struct wlr_backend *backend) {
assert(wlr_backend_is_multi(_multi));
@@ -175,6 +179,7 @@ void wlr_multi_backend_add(struct wlr_backend *_multi,
wlr_signal_emit_safe(&multi->events.backend_add, backend);
}
+WLR_API
void wlr_multi_backend_remove(struct wlr_backend *_multi,
struct wlr_backend *backend) {
assert(wlr_backend_is_multi(_multi));
@@ -189,6 +194,7 @@ void wlr_multi_backend_remove(struct wlr_backend *_multi,
}
}
+WLR_API
struct wlr_session *wlr_multi_get_session(struct wlr_backend *_backend) {
assert(wlr_backend_is_multi(_backend));
@@ -202,6 +208,7 @@ struct wlr_session *wlr_multi_get_session(struct wlr_backend *_backend) {
return NULL;
}
+WLR_API
bool wlr_multi_is_empty(struct wlr_backend *_backend) {
assert(wlr_backend_is_multi(_backend));
struct wlr_multi_backend *backend = (struct wlr_multi_backend *)_backend;
diff --git a/backend/session/session.c b/backend/session/session.c
index 2d5d9776..5e6fd4ea 100644
--- a/backend/session/session.c
+++ b/backend/session/session.c
@@ -13,6 +13,7 @@
#include <wlr/util/log.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
+#include "util/defs.h"
#include "util/signal.h"
extern const struct session_impl session_logind;
@@ -66,6 +67,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
wlr_session_destroy(session);
}
+WLR_API
struct wlr_session *wlr_session_create(struct wl_display *disp) {
struct wlr_session *session = NULL;
const struct session_impl **iter;
@@ -122,6 +124,7 @@ error_session:
return NULL;
}
+WLR_API
void wlr_session_destroy(struct wlr_session *session) {
if (!session) {
return;
@@ -136,6 +139,7 @@ void wlr_session_destroy(struct wlr_session *session) {
session->impl->destroy(session);
}
+WLR_API
int wlr_session_open_file(struct wlr_session *session, const char *path) {
int fd = session->impl->open(session, path);
if (fd < 0) {
@@ -179,6 +183,7 @@ static struct wlr_device *find_device(struct wlr_session *session, int fd) {
assert(0);
}
+WLR_API
void wlr_session_close_file(struct wlr_session *session, int fd) {
struct wlr_device *dev = find_device(session, fd);
@@ -187,6 +192,7 @@ void wlr_session_close_file(struct wlr_session *session, int fd) {
free(dev);
}
+WLR_API
void wlr_session_signal_add(struct wlr_session *session, int fd,
struct wl_listener *listener) {
struct wlr_device *dev = find_device(session, fd);
@@ -194,6 +200,7 @@ void wlr_session_signal_add(struct wlr_session *session, int fd,
wl_signal_add(&dev->signal, listener);
}
+WLR_API
bool wlr_session_change_vt(struct wlr_session *session, unsigned vt) {
if (!session) {
return false;
@@ -269,6 +276,7 @@ static size_t explicit_find_gpus(struct wlr_session *session,
/* Tries to find the primary GPU by checking for the "boot_vga" attribute.
* If it's not found, it returns the first valid GPU it finds.
*/
+WLR_API
size_t wlr_session_find_gpus(struct wlr_session *session,
size_t ret_len, int *ret) {
const char *explicit = getenv("WLR_DRM_DEVICES");
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
index abb25df5..2289d013 100644
--- a/backend/wayland/backend.c
+++ b/backend/wayland/backend.c
@@ -12,6 +12,7 @@
#include <wlr/render/gles2.h>
#include <wlr/util/log.h>
#include "backend/wayland.h"
+#include "util/defs.h"
#include "util/signal.h"
#include "xdg-shell-unstable-v6-client-protocol.h"
@@ -128,6 +129,7 @@ static struct wlr_backend_impl backend_impl = {
.get_renderer = wlr_wl_backend_get_renderer,
};
+WLR_API
bool wlr_backend_is_wl(struct wlr_backend *b) {
return b->impl == &backend_impl;
}
@@ -181,6 +183,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
wlr_wl_backend_destroy(&backend->backend);
}
+WLR_API
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, const char *remote) {
wlr_log(L_INFO, "Creating wayland backend");
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index fc40dea0..5d0aaece 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -11,6 +11,7 @@
#include <wlr/interfaces/wlr_output.h>
#include <wlr/util/log.h>
#include "backend/wayland.h"
+#include "util/defs.h"
#include "util/signal.h"
#include "xdg-shell-unstable-v6-client-protocol.h"
@@ -217,6 +218,7 @@ static struct wlr_output_impl output_impl = {
.move_cursor = wlr_wl_output_move_cursor,
};
+WLR_API
bool wlr_output_is_wl(struct wlr_output *wlr_output) {
return wlr_output->impl == &output_impl;
}
@@ -260,6 +262,7 @@ static struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
.close = xdg_toplevel_handle_close,
};
+WLR_API
struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) {
assert(wlr_backend_is_wl(_backend));
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c
index b1f7cff6..d6c9926b 100644
--- a/backend/wayland/wl_seat.c
+++ b/backend/wayland/wl_seat.c
@@ -11,6 +11,7 @@
#include <wlr/interfaces/wlr_touch.h>
#include <wlr/util/log.h>
#include "backend/wayland.h"
+#include "util/defs.h"
#include "util/signal.h"
static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
@@ -205,6 +206,7 @@ static struct wlr_input_device_impl input_device_impl = {
.destroy = input_device_destroy
};
+WLR_API
bool wlr_input_device_is_wl(struct wlr_input_device *dev) {
return dev->impl == &input_device_impl;
}
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 28a4fcac..72b4b69d 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -23,6 +23,7 @@
#include <dev/evdev/input-event-codes.h>
#endif
#include "backend/x11.h"
+#include "util/defs.h"
#include "util/signal.h"
static struct wlr_backend_impl backend_impl;
@@ -289,6 +290,7 @@ static struct wlr_backend_impl backend_impl = {
.get_renderer = wlr_x11_backend_get_renderer,
};
+WLR_API
bool wlr_backend_is_x11(struct wlr_backend *backend) {
return backend->impl == &backend_impl;
}
@@ -299,6 +301,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
wlr_x11_backend_destroy(&x11->backend);
}
+WLR_API
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
const char *x11_display) {
struct wlr_x11_backend *x11 = calloc(1, sizeof(*x11));
@@ -418,10 +421,12 @@ static struct wlr_output_impl output_impl = {
.swap_buffers = output_swap_buffers,
};
+WLR_API
bool wlr_output_is_x11(struct wlr_output *wlr_output) {
return wlr_output->impl == &output_impl;
}
+WLR_API
bool wlr_input_device_is_x11(struct wlr_input_device *wlr_dev) {
return wlr_dev->impl == &input_device_impl;
}