diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-06-22 12:31:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-22 12:31:35 -0400 |
commit | 5055d899550a92d72362efe6add44b2547147599 (patch) | |
tree | 6f003636aee79364ef15af1dd51f743a6ff78031 /example/shared.c | |
parent | bb16025318e1c3d3844e71e6e8f29b1e8634ec3e (diff) | |
parent | a9547af35833ba06b7446bcba800d7d6a764508c (diff) |
Merge pull request #19 from nyorain/wayland-input
Basic wayland backend input
Diffstat (limited to 'example/shared.c')
-rw-r--r-- | example/shared.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/example/shared.c b/example/shared.c index c4ec4ffe..fbb6c559 100644 --- a/example/shared.c +++ b/example/shared.c @@ -105,6 +105,15 @@ static void pointer_motion_notify(struct wl_listener *listener, void *data) { } } +static void pointer_motion_absolute_notify(struct wl_listener *listener, void *data) { + struct wlr_event_pointer_motion_absolute *event = data; + struct pointer_state *pstate = wl_container_of(listener, pstate, motion_absolute); + if (pstate->compositor->pointer_motion_absolute_cb) { + pstate->compositor->pointer_motion_absolute_cb(pstate, + event->x_mm, event->y_mm); + } +} + static void pointer_button_notify(struct wl_listener *listener, void *data) { struct wlr_event_pointer_button *event = data; struct pointer_state *pstate = wl_container_of(listener, pstate, button); @@ -132,9 +141,11 @@ static void pointer_add(struct wlr_input_device *device, struct compositor_state wl_list_init(&pstate->button.link); wl_list_init(&pstate->axis.link); pstate->motion.notify = pointer_motion_notify; + pstate->motion_absolute.notify = pointer_motion_absolute_notify; pstate->button.notify = pointer_button_notify; pstate->axis.notify = pointer_axis_notify; wl_signal_add(&device->pointer->events.motion, &pstate->motion); + wl_signal_add(&device->pointer->events.motion_absolute, &pstate->motion_absolute); wl_signal_add(&device->pointer->events.button, &pstate->button); wl_signal_add(&device->pointer->events.axis, &pstate->axis); wl_list_insert(&state->pointers, &pstate->link); @@ -308,7 +319,7 @@ static void pointer_remove(struct wlr_input_device *device, struct compositor_st } wl_list_remove(&pstate->link); wl_list_remove(&pstate->motion.link); - //wl_list_remove(&pstate->motion_absolute.link); + wl_list_remove(&pstate->motion_absolute.link); wl_list_remove(&pstate->button.link); wl_list_remove(&pstate->axis.link); } |