From d6905f86cb9d430e0ba05c6a066ed350761116d1 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 14 Jun 2017 11:40:03 -0400 Subject: Allocate wlr_touch devices --- include/backend/libinput.h | 15 ++++++++++++++- include/types.h | 8 ++++++++ include/wlr/types.h | 18 +++++++++++++++++- 3 files changed, 39 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/backend/libinput.h b/include/backend/libinput.h index 7c318746..dd24fbb0 100644 --- a/include/backend/libinput.h +++ b/include/backend/libinput.h @@ -16,7 +16,7 @@ struct wlr_backend_state { struct libinput *libinput; struct wl_event_source *input_event; - list_t *keyboards; + list_t *devices; }; struct wlr_input_device_state { @@ -46,4 +46,17 @@ void handle_pointer_button(struct libinput_event *event, void handle_pointer_axis(struct libinput_event *event, struct libinput_device *device); +struct wlr_touch *wlr_libinput_touch_create( + struct libinput_device *device); +void handle_touch_down(struct libinput_event *event, + struct libinput_device *device); +void handle_touch_up(struct libinput_event *event, + struct libinput_device *device); +void handle_touch_motion(struct libinput_event *event, + struct libinput_device *device); +void handle_touch_cancel(struct libinput_event *event, + struct libinput_device *device); +void handle_touch_frame(struct libinput_event *event, + struct libinput_device *device); + #endif diff --git a/include/types.h b/include/types.h index 20f5ed13..5b20e2ed 100644 --- a/include/types.h +++ b/include/types.h @@ -34,6 +34,14 @@ 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_touch_impl { + void (*destroy)(struct wlr_touch_state *state); +}; + +struct wlr_touch *wlr_touch_create(struct wlr_touch_impl *impl, + struct wlr_touch_state *state); +void wlr_touch_destroy(struct wlr_touch *touch); + struct wlr_input_device_impl { void (*destroy)(struct wlr_input_device_state *state); }; diff --git a/include/wlr/types.h b/include/wlr/types.h index af23152c..b4d69ccb 100644 --- a/include/wlr/types.h +++ b/include/wlr/types.h @@ -134,7 +134,22 @@ struct wlr_pointer_axis { double delta; }; -// TODO: touch +struct wlr_touch_state; +struct wlr_touch_impl; + +struct wlr_touch { + struct wlr_touch_state *state; + struct wlr_touch_impl *impl; + + struct { + struct wl_signal down; + struct wl_signal up; + struct wl_signal motion; + struct wl_signal cancel; + struct wl_signal frame; + } events; +}; + // TODO: tablet & tablet tool // TODO: gestures // TODO: switch @@ -164,6 +179,7 @@ struct wlr_input_device { void *_device; struct wlr_keyboard *keyboard; struct wlr_pointer *pointer; + struct wlr_touch *touch; }; }; -- cgit v1.2.3