aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-12-19 22:53:08 +0100
committerGitHub <noreply@github.com>2017-12-19 22:53:08 +0100
commit1a96ce0c53c84295d33b143e1b6cf02cb7017d50 (patch)
treec19713e52bb8931c9a5116e745104458bf5e4f29 /backend
parent36d875136354b0f0438b1fe89d5ea897b113bd24 (diff)
parentfcd7062542bec6f9ab247dbc63c6eead457006bf (diff)
Merge pull request #505 from martinetd/io_is_foo
Add wlr_input_device_is_foo and wlr_output_is_bar functions
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c4
-rw-r--r--backend/headless/input_device.c4
-rw-r--r--backend/headless/output.c4
-rw-r--r--backend/libinput/events.c4
-rw-r--r--backend/wayland/output.c4
-rw-r--r--backend/wayland/wl_seat.c4
-rw-r--r--backend/x11/backend.c13
7 files changed, 35 insertions, 2 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 1fceff95..06f012a3 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -658,6 +658,10 @@ static struct wlr_output_impl output_impl = {
.get_gamma_size = wlr_drm_connector_get_gamma_size,
};
+bool wlr_output_is_drm(struct wlr_output *output) {
+ return output->impl == &output_impl;
+}
+
static int retry_pageflip(void *data) {
struct wlr_drm_connector *conn = data;
wlr_log(L_INFO, "%s: Retrying pageflip", conn->output.name);
diff --git a/backend/headless/input_device.c b/backend/headless/input_device.c
index 05def775..5c62e87f 100644
--- a/backend/headless/input_device.c
+++ b/backend/headless/input_device.c
@@ -19,6 +19,10 @@ static struct wlr_input_device_impl input_device_impl = {
.destroy = input_device_destroy,
};
+bool wlr_input_device_is_headless(struct wlr_input_device *wlr_dev) {
+ return wlr_dev->impl == &input_device_impl;
+}
+
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 9c4ba35e..511c2c53 100644
--- a/backend/headless/output.c
+++ b/backend/headless/output.c
@@ -82,6 +82,10 @@ static const struct wlr_output_impl output_impl = {
.swap_buffers = output_swap_buffers,
};
+bool wlr_output_is_headless(struct wlr_output *wlr_output) {
+ return wlr_output->impl == &output_impl;
+}
+
static int signal_frame(void *data) {
struct wlr_headless_output *output = data;
wl_signal_emit(&output->wlr_output.events.frame, &output->wlr_output);
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index c14aef01..758a9f25 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -53,6 +53,10 @@ static struct wlr_input_device *allocate_device(
return wlr_dev;
}
+bool wlr_input_device_is_libinput(struct wlr_input_device *wlr_dev) {
+ return wlr_dev->impl == &input_device_impl;
+}
+
static void handle_device_added(struct wlr_libinput_backend *backend,
struct libinput_device *libinput_dev) {
assert(backend && libinput_dev);
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index d841ec49..d76f6366 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -205,6 +205,10 @@ static struct wlr_output_impl output_impl = {
.move_cursor = wlr_wl_output_move_cursor,
};
+bool wlr_output_is_wl(struct wlr_output *wlr_output) {
+ return wlr_output->impl == &output_impl;
+}
+
static void xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *xdg_surface,
uint32_t serial) {
struct wlr_wl_backend_output *output = data;
diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c
index 0d4ebc8d..ddee268d 100644
--- a/backend/wayland/wl_seat.c
+++ b/backend/wayland/wl_seat.c
@@ -203,6 +203,10 @@ static struct wlr_input_device_impl input_device_impl = {
.destroy = input_device_destroy
};
+bool wlr_input_device_is_wl(struct wlr_input_device *dev) {
+ return dev->impl == &input_device_impl;
+}
+
static struct wlr_input_device *allocate_device(struct wlr_wl_backend *backend,
enum wlr_input_device_type type) {
struct wlr_wl_input_device *wlr_wl_dev;
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index f6f9cfa8..d2690342 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -25,6 +25,7 @@
static struct wlr_backend_impl backend_impl;
static struct wlr_output_impl output_impl;
+static struct wlr_input_device_impl input_device_impl = { 0 };
static uint32_t xcb_button_to_wl(uint32_t button) {
switch (button) {
@@ -328,12 +329,12 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
}
wlr_input_device_init(&x11->keyboard_dev, WLR_INPUT_DEVICE_KEYBOARD,
- NULL, "X11 keyboard", 0, 0);
+ &input_device_impl, "X11 keyboard", 0, 0);
wlr_keyboard_init(&x11->keyboard, NULL);
x11->keyboard_dev.keyboard = &x11->keyboard;
wlr_input_device_init(&x11->pointer_dev, WLR_INPUT_DEVICE_POINTER,
- NULL, "X11 pointer", 0, 0);
+ &input_device_impl, "X11 pointer", 0, 0);
wlr_pointer_init(&x11->pointer, NULL);
x11->pointer_dev.pointer = &x11->pointer;
@@ -401,3 +402,11 @@ static struct wlr_output_impl output_impl = {
.make_current = output_make_current,
.swap_buffers = output_swap_buffers,
};
+
+bool wlr_output_is_x11(struct wlr_output *wlr_output) {
+ return wlr_output->impl == &output_impl;
+}
+
+bool wlr_input_device_is_x11(struct wlr_input_device *wlr_dev) {
+ return wlr_dev->impl == &input_device_impl;
+}