From f61986e8dbadf1be3f3d850356d939ef57f942a0 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Thu, 16 Nov 2017 17:53:52 -0500 Subject: rename touch slot to touch id --- examples/pointer.c | 8 ++++---- examples/support/shared.c | 8 ++++---- examples/support/shared.h | 8 ++++---- examples/touch.c | 14 +++++++------- 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'examples') diff --git a/examples/pointer.c b/examples/pointer.c index 476cc617..8fafb3d6 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -55,7 +55,7 @@ struct sample_state { }; struct touch_point { - int32_t slot; + int32_t touch_id; double x, y; }; @@ -199,7 +199,7 @@ static void handle_touch_up(struct wl_listener *listener, void *data) { struct wlr_event_touch_up *event = data; for (size_t i = 0; i < sample->touch_points->length; ++i) { struct touch_point *point = sample->touch_points->items[i]; - if (point->slot == event->slot) { + if (point->touch_id == event->touch_id) { wlr_list_del(sample->touch_points, i); break; } @@ -212,7 +212,7 @@ static void handle_touch_down(struct wl_listener *listener, void *data) { struct sample_state *sample = wl_container_of(listener, sample, touch_down); struct wlr_event_touch_down *event = data; struct touch_point *point = calloc(1, sizeof(struct touch_point)); - point->slot = event->slot; + point->touch_id = event->touch_id; point->x = event->x_mm / event->width_mm; point->y = event->y_mm / event->height_mm; if (wlr_list_add(sample->touch_points, point) == -1) { @@ -228,7 +228,7 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) { 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]; - if (point->slot == event->slot) { + if (point->touch_id == event->touch_id) { point->x = event->x_mm / event->width_mm; point->y = event->y_mm / event->height_mm; break; diff --git a/examples/support/shared.c b/examples/support/shared.c index 07614d86..811c09a6 100644 --- a/examples/support/shared.c +++ b/examples/support/shared.c @@ -136,7 +136,7 @@ static void touch_down_notify(struct wl_listener *listener, void *data) { struct wlr_event_touch_down *event = data; struct touch_state *tstate = wl_container_of(listener, tstate, down); if (tstate->compositor->touch_down_cb) { - tstate->compositor->touch_down_cb(tstate, event->slot, + tstate->compositor->touch_down_cb(tstate, event->touch_id, event->x_mm, event->y_mm, event->width_mm, event->height_mm); } } @@ -145,7 +145,7 @@ static void touch_motion_notify(struct wl_listener *listener, void *data) { struct wlr_event_touch_motion *event = data; struct touch_state *tstate = wl_container_of(listener, tstate, motion); if (tstate->compositor->touch_motion_cb) { - tstate->compositor->touch_motion_cb(tstate, event->slot, + tstate->compositor->touch_motion_cb(tstate, event->touch_id, event->x_mm, event->y_mm, event->width_mm, event->height_mm); } } @@ -154,7 +154,7 @@ static void touch_up_notify(struct wl_listener *listener, void *data) { struct wlr_event_touch_up *event = data; struct touch_state *tstate = wl_container_of(listener, tstate, up); if (tstate->compositor->touch_up_cb) { - tstate->compositor->touch_up_cb(tstate, event->slot); + tstate->compositor->touch_up_cb(tstate, event->touch_id); } } @@ -162,7 +162,7 @@ static void touch_cancel_notify(struct wl_listener *listener, void *data) { struct wlr_event_touch_cancel *event = data; struct touch_state *tstate = wl_container_of(listener, tstate, cancel); if (tstate->compositor->touch_cancel_cb) { - tstate->compositor->touch_cancel_cb(tstate, event->slot); + tstate->compositor->touch_cancel_cb(tstate, event->touch_id); } } diff --git a/examples/support/shared.h b/examples/support/shared.h index cf75f5fe..014b709e 100644 --- a/examples/support/shared.h +++ b/examples/support/shared.h @@ -95,12 +95,12 @@ struct compositor_state { enum wlr_axis_source source, enum wlr_axis_orientation orientation, double delta); - void (*touch_down_cb)(struct touch_state *s, int32_t slot, + void (*touch_down_cb)(struct touch_state *s, int32_t touch_id, double x, double y, double width, double height); - void (*touch_motion_cb)(struct touch_state *s, int32_t slot, + void (*touch_motion_cb)(struct touch_state *s, int32_t touch_id, double x, double y, double width, double height); - void (*touch_up_cb)(struct touch_state *s, int32_t slot); - void (*touch_cancel_cb)(struct touch_state *s, int32_t slot); + void (*touch_up_cb)(struct touch_state *s, int32_t touch_id); + void (*touch_cancel_cb)(struct touch_state *s, int32_t touch_id); void (*tool_axis_cb)(struct tablet_tool_state *s, struct wlr_event_tablet_tool_axis *event); void (*tool_proximity_cb)(struct tablet_tool_state *s, diff --git a/examples/touch.c b/examples/touch.c index df6c6c48..d1891525 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -28,7 +28,7 @@ struct sample_state { }; struct touch_point { - int32_t slot; + int32_t touch_id; double x, y; }; @@ -58,11 +58,11 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts wlr_output_swap_buffers(wlr_output); } -static void handle_touch_down(struct touch_state *tstate, int32_t slot, +static void handle_touch_down(struct touch_state *tstate, int32_t touch_id, double x, double y, double width, double height) { struct sample_state *sample = tstate->compositor->data; struct touch_point *point = calloc(1, sizeof(struct touch_point)); - point->slot = slot; + point->touch_id = touch_id; point->x = x / width; point->y = y / height; if (wlr_list_add(sample->touch_points, point) == -1) { @@ -70,23 +70,23 @@ static void handle_touch_down(struct touch_state *tstate, int32_t slot, } } -static void handle_touch_up(struct touch_state *tstate, int32_t slot) { +static void handle_touch_up(struct touch_state *tstate, int32_t touch_id) { struct sample_state *sample = tstate->compositor->data; for (size_t i = 0; i < sample->touch_points->length; ++i) { struct touch_point *point = sample->touch_points->items[i]; - if (point->slot == slot) { + if (point->touch_id == touch_id) { wlr_list_del(sample->touch_points, i); break; } } } -static void handle_touch_motion(struct touch_state *tstate, int32_t slot, +static void handle_touch_motion(struct touch_state *tstate, int32_t touch_id, double x, double y, double width, double height) { struct sample_state *sample = tstate->compositor->data; for (size_t i = 0; i < sample->touch_points->length; ++i) { struct touch_point *point = sample->touch_points->items[i]; - if (point->slot == slot) { + if (point->touch_id == touch_id) { point->x = x / width; point->y = y / height; break; -- cgit v1.2.3