x11 backend: add wlr_input_device_is_x11

master
Dominique Martinet 7 years ago
parent 169bc9fa10
commit fcd7062542

@ -25,6 +25,7 @@
static struct wlr_backend_impl backend_impl; static struct wlr_backend_impl backend_impl;
static struct wlr_output_impl output_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) { static uint32_t xcb_button_to_wl(uint32_t button) {
switch (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, 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); wlr_keyboard_init(&x11->keyboard, NULL);
x11->keyboard_dev.keyboard = &x11->keyboard; x11->keyboard_dev.keyboard = &x11->keyboard;
wlr_input_device_init(&x11->pointer_dev, WLR_INPUT_DEVICE_POINTER, 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); wlr_pointer_init(&x11->pointer, NULL);
x11->pointer_dev.pointer = &x11->pointer; x11->pointer_dev.pointer = &x11->pointer;
@ -405,3 +406,7 @@ static struct wlr_output_impl output_impl = {
bool wlr_output_is_x11(struct wlr_output *wlr_output) { bool wlr_output_is_x11(struct wlr_output *wlr_output) {
return wlr_output->impl == &output_impl; 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;
}

@ -6,7 +6,6 @@
#include <X11/Xlib-xcb.h> #include <X11/Xlib-xcb.h>
#include <wayland-server.h> #include <wayland-server.h>
#include <wlr/render/egl.h> #include <wlr/render/egl.h>
#include <wlr/types/wlr_input_device.h>
struct wlr_x11_backend; struct wlr_x11_backend;

@ -4,12 +4,14 @@
#include <stdbool.h> #include <stdbool.h>
#include <wayland-server.h> #include <wayland-server.h>
#include <wlr/backend.h> #include <wlr/backend.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display, struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
const char *x11_display); const char *x11_display);
bool wlr_backend_is_x11(struct wlr_backend *backend); bool wlr_backend_is_x11(struct wlr_backend *backend);
bool wlr_input_device_is_x11(struct wlr_input_device *device);
bool wlr_output_is_x11(struct wlr_output *output); bool wlr_output_is_x11(struct wlr_output *output);
#endif #endif

Loading…
Cancel
Save