Add multi-pointer example

This commit is contained in:
emersion 2017-10-29 20:03:56 +01:00
parent c3b09f73da
commit 044173d1df
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
5 changed files with 250 additions and 23 deletions

View file

@ -60,7 +60,7 @@ struct touch_point {
};
static void warp_to_touch(struct sample_state *sample,
struct wlr_input_device *dev) {
struct wlr_input_device *dev) {
if (sample->touch_points->length == 0) {
return;
}
@ -77,7 +77,7 @@ static void warp_to_touch(struct sample_state *sample,
}
static void handle_output_frame(struct output_state *output,
struct timespec *ts) {
struct timespec *ts) {
struct compositor_state *state = output->compositor;
struct sample_state *sample = state->data;
struct wlr_output *wlr_output = output->output;
@ -127,7 +127,7 @@ static void handle_output_remove(struct output_state *ostate) {
}
static void handle_input_add(struct compositor_state *state,
struct wlr_input_device *device) {
struct wlr_input_device *device) {
struct sample_state *sample = state->data;
if (device->type == WLR_INPUT_DEVICE_POINTER ||
@ -141,16 +141,16 @@ static void handle_input_add(struct compositor_state *state,
static void handle_cursor_motion(struct wl_listener *listener, void *data) {
struct sample_state *sample =
wl_container_of(listener, sample, cursor_motion);
wl_container_of(listener, sample, cursor_motion);
struct wlr_event_pointer_motion *event = data;
wlr_cursor_move(sample->cursor, event->device, event->delta_x,
event->delta_y);
event->delta_y);
}
static void handle_cursor_motion_absolute(struct wl_listener *listener,
void *data) {
void *data) {
struct sample_state *sample =
wl_container_of(listener, sample, cursor_motion_absolute);
wl_container_of(listener, sample, cursor_motion_absolute);
struct wlr_event_pointer_motion_absolute *event = data;
sample->cur_x = event->x_mm;
@ -162,7 +162,7 @@ static void handle_cursor_motion_absolute(struct wl_listener *listener,
static void handle_cursor_button(struct wl_listener *listener, void *data) {
struct sample_state *sample =
wl_container_of(listener, sample, cursor_button);
wl_container_of(listener, sample, cursor_button);
struct wlr_event_pointer_button *event = data;
float (*color)[4];
@ -179,7 +179,7 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) {
static void handle_cursor_axis(struct wl_listener *listener, void *data) {
struct sample_state *sample =
wl_container_of(listener, sample, cursor_axis);
wl_container_of(listener, sample, cursor_axis);
struct wlr_event_pointer_axis *event = data;
for (size_t i = 0; i < 3; ++i) {
@ -226,7 +226,7 @@ static void handle_touch_down(struct wl_listener *listener, void *data) {
static void handle_touch_motion(struct wl_listener *listener, void *data) {
struct sample_state *sample =
wl_container_of(listener, sample, touch_motion);
wl_container_of(listener, sample, touch_motion);
struct wlr_event_touch_motion *event = data;
for (size_t i = 0; i < sample->touch_points->length; ++i) {
struct touch_point *point = sample->touch_points->items[i];
@ -246,7 +246,7 @@ static void handle_touch_cancel(struct wl_listener *listener, void *data) {
static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
struct sample_state *sample =
wl_container_of(listener, sample, tablet_tool_axis);
wl_container_of(listener, sample, tablet_tool_axis);
struct wlr_event_tablet_tool_axis *event = data;
if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X) &&
(event->updated_axes & WLR_TABLET_TOOL_AXIS_Y)) {