aboutsummaryrefslogtreecommitdiff
path: root/examples/touch.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-11-19 22:28:51 +0100
committeremersion <contact@emersion.fr>2017-11-19 22:28:51 +0100
commit7904b625f0c6a8cef684d60ba136de1ba48e848e (patch)
tree3d7001509a6229e1b17a0f4c26960e720857c8a9 /examples/touch.c
parent7375931686e6a58c08a7727ce2f5d88e0be9adfa (diff)
parentfae8d6289a470b8abcf36a5f4b0030ef504caf0b (diff)
Merge branch 'master' into laggy-move-resize
Diffstat (limited to 'examples/touch.c')
-rw-r--r--examples/touch.c14
1 files changed, 7 insertions, 7 deletions
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;