aboutsummaryrefslogtreecommitdiff
path: root/examples/support
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-03-07 20:57:55 -0500
committerDrew DeVault <sir@cmpwn.com>2018-03-07 20:57:55 -0500
commitbfc0e95d2cfeab96d771cb34e78ca92afee4464c (patch)
treea5f5d132cba797f8f169781a482e9e995df14332 /examples/support
parent36dcad13d09d63bd321958ed79d479687479f852 (diff)
Add mode support to libinput backend
And extend tablet example with tilt and ring support
Diffstat (limited to 'examples/support')
-rw-r--r--examples/support/shared.c10
-rw-r--r--examples/support/shared.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/examples/support/shared.c b/examples/support/shared.c
index c4f9288d..e6233206 100644
--- a/examples/support/shared.c
+++ b/examples/support/shared.c
@@ -294,6 +294,14 @@ static void tablet_pad_button_notify(struct wl_listener *listener, void *data) {
}
}
+static void tablet_pad_ring_notify(struct wl_listener *listener, void *data) {
+ struct wlr_event_tablet_pad_ring *event = data;
+ struct tablet_pad_state *pstate = wl_container_of(listener, pstate, ring);
+ if (pstate->compositor->pad_ring_cb) {
+ pstate->compositor->pad_ring_cb(pstate, event->ring, event->position);
+ }
+}
+
static void tablet_pad_destroy_notify(struct wl_listener *listener, void *data) {
struct tablet_pad_state *pstate = wl_container_of(listener, pstate, destroy);
struct compositor_state *state = pstate->compositor;
@@ -315,6 +323,8 @@ static void tablet_pad_add(struct wlr_input_device *device,
wl_signal_add(&device->events.destroy, &pstate->destroy);
pstate->button.notify = tablet_pad_button_notify;
wl_signal_add(&device->tablet_pad->events.button, &pstate->button);
+ pstate->ring.notify = tablet_pad_ring_notify;
+ wl_signal_add(&device->tablet_pad->events.ring, &pstate->ring);
wl_list_insert(&state->tablet_pads, &pstate->link);
}
diff --git a/examples/support/shared.h b/examples/support/shared.h
index 8cdea301..d00e75b3 100644
--- a/examples/support/shared.h
+++ b/examples/support/shared.h
@@ -73,6 +73,7 @@ struct tablet_pad_state {
struct wlr_input_device *device;
struct wl_listener destroy;
struct wl_listener button;
+ struct wl_listener ring;
struct wl_list link;
void *data;
};
@@ -117,6 +118,8 @@ struct compositor_state {
uint32_t button, enum wlr_button_state state);
void (*pad_button_cb)(struct tablet_pad_state *s,
uint32_t button, enum wlr_button_state state);
+ void (*pad_ring_cb)(struct tablet_pad_state *s,
+ uint32_t ring, double position);
struct wl_display *display;
struct wl_event_loop *event_loop;