aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-06-10 12:21:54 -0400
committerDrew DeVault <sir@cmpwn.com>2017-06-13 08:10:36 -0400
commit7a5f35b5bb2a30e46defe9ea1bd610cb06df95e8 (patch)
tree5d3f0990f8ce6c14f1421e2a292a47ee98e730a5 /include
parentf479b7c8c7aa93229c46287f774a30ac8324da1e (diff)
Reassign ownership of libinput handle
Diffstat (limited to 'include')
-rw-r--r--include/backend/libinput.h8
-rw-r--r--include/types.h10
-rw-r--r--include/wlr/backend/libinput.h3
-rw-r--r--include/wlr/types.h7
4 files changed, 22 insertions, 6 deletions
diff --git a/include/backend/libinput.h b/include/backend/libinput.h
index a59ab401..f6622695 100644
--- a/include/backend/libinput.h
+++ b/include/backend/libinput.h
@@ -19,6 +19,10 @@ struct wlr_backend_state {
list_t *keyboards;
};
+struct wlr_input_device_state {
+ struct libinput_device *handle;
+};
+
void wlr_libinput_event(struct wlr_backend_state *state,
struct libinput_event *event);
@@ -26,10 +30,6 @@ struct wlr_input_device *get_appropriate_device(
enum wlr_input_device_type desired_type,
struct libinput_device *device);
-struct wlr_keyboard_state {
- struct libinput_device *handle;
-};
-
void handle_keyboard_key(struct libinput_event *event,
struct libinput_device *device);
struct wlr_keyboard *wlr_libinput_keyboard_create(
diff --git a/include/types.h b/include/types.h
index 564b24ec..20f5ed13 100644
--- a/include/types.h
+++ b/include/types.h
@@ -34,9 +34,15 @@ struct wlr_pointer *wlr_pointer_create(struct wlr_pointer_impl *impl,
struct wlr_pointer_state *state);
void wlr_pointer_destroy(struct wlr_pointer *pointer);
+struct wlr_input_device_impl {
+ void (*destroy)(struct wlr_input_device_state *state);
+};
+
struct wlr_input_device *wlr_input_device_create(
- enum wlr_input_device_type type, const char *name,
- int vendor, int product);
+ enum wlr_input_device_type type,
+ struct wlr_input_device_impl *impl,
+ struct wlr_input_device_state *state,
+ const char *name, int vendor, int product);
void wlr_input_device_destroy(struct wlr_input_device *dev);
#endif
diff --git a/include/wlr/backend/libinput.h b/include/wlr/backend/libinput.h
index 1e8c3555..7108f42c 100644
--- a/include/wlr/backend/libinput.h
+++ b/include/wlr/backend/libinput.h
@@ -1,12 +1,15 @@
#ifndef WLR_BACKEND_LIBINPUT_H
#define WLR_BACKEND_LIBINPUT_H
+#include <libinput.h>
#include <wayland-server.h>
#include <wlr/session.h>
#include <wlr/backend.h>
#include <wlr/backend/udev.h>
+#include <wlr/types.h>
struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
struct wlr_session *session, struct wlr_udev *udev);
+struct libinput_device *wlr_libinput_get_device_handle(struct wlr_input_device *dev);
#endif
diff --git a/include/wlr/types.h b/include/wlr/types.h
index e2f3075f..389989e8 100644
--- a/include/wlr/types.h
+++ b/include/wlr/types.h
@@ -152,10 +152,17 @@ enum wlr_input_device_type {
WLR_INPUT_DEVICE_SWITCH,
};
+struct wlr_input_device_state;
+struct wlr_input_device_impl;
+
struct wlr_input_device {
+ struct wlr_input_device_state *state;
+ struct wlr_input_device_impl *impl;
+
enum wlr_input_device_type type;
int vendor, product;
char *name;
+
union {
void *_device;
struct wlr_keyboard *keyboard;