aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/events.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-08-14 10:33:46 -0400
committerGitHub <noreply@github.com>2017-08-14 10:33:46 -0400
commit53052b3f6e457f35d46fc3a71bd7eac96e55a484 (patch)
treec51bfcd472cf38df7528eab9330bb0e44981ffbb /backend/libinput/events.c
parent1e1e9887fba15291256a806aca6cc6f94a8f671e (diff)
parente922e62924314866620cce662756ff09c8092cc2 (diff)
Merge pull request #85 from martinetd/refactor_states
Refactor states
Diffstat (limited to 'backend/libinput/events.c')
-rw-r--r--backend/libinput/events.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/backend/libinput/events.c b/backend/libinput/events.c
index a7c781c2..0e434b7c 100644
--- a/backend/libinput/events.c
+++ b/backend/libinput/events.c
@@ -23,9 +23,10 @@ struct wlr_input_device *get_appropriate_device(
return NULL;
}
-static void wlr_libinput_device_destroy(struct wlr_input_device_state *state) {
- libinput_device_unref(state->handle);
- free(state);
+static void wlr_libinput_device_destroy(struct wlr_input_device *_dev) {
+ struct wlr_libinput_input_device *dev = (struct wlr_libinput_input_device *)_dev;
+ libinput_device_unref(dev->handle);
+ free(dev);
}
static struct wlr_input_device_impl input_device_impl = {
@@ -38,13 +39,13 @@ static struct wlr_input_device *allocate_device(
int vendor = libinput_device_get_id_vendor(libinput_dev);
int product = libinput_device_get_id_product(libinput_dev);
const char *name = libinput_device_get_name(libinput_dev);
- struct wlr_input_device_state *devstate =
- calloc(1, sizeof(struct wlr_input_device_state));
- devstate->handle = libinput_dev;
+ struct wlr_libinput_input_device *wlr_libinput_dev =
+ calloc(1, sizeof(struct wlr_libinput_input_device));
+ struct wlr_input_device *wlr_dev = &wlr_libinput_dev->wlr_input_device;
+ wlr_libinput_dev->handle = libinput_dev;
libinput_device_ref(libinput_dev);
- struct wlr_input_device *wlr_dev = wlr_input_device_create(
- type, &input_device_impl, devstate,
- name, vendor, product);
+ wlr_input_device_init(wlr_dev, type, &input_device_impl,
+ name, vendor, product);
list_add(wlr_devices, wlr_dev);
return wlr_dev;
}