rename touch slot to touch id

This commit is contained in:
Tony Crisci 2017-11-16 17:53:52 -05:00
parent fb18e345a6
commit f61986e8db
7 changed files with 36 additions and 36 deletions

View file

@ -33,7 +33,7 @@ void handle_touch_down(struct libinput_event *event,
wlr_event.device = wlr_dev;
wlr_event.time_msec =
usec_to_msec(libinput_event_touch_get_time_usec(tevent));
wlr_event.slot = libinput_event_touch_get_slot(tevent);
wlr_event.touch_id = libinput_event_touch_get_slot(tevent);
wlr_event.x_mm = libinput_event_touch_get_x(tevent);
wlr_event.y_mm = libinput_event_touch_get_y(tevent);
libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm);
@ -54,7 +54,7 @@ void handle_touch_up(struct libinput_event *event,
wlr_event.device = wlr_dev;
wlr_event.time_msec =
usec_to_msec(libinput_event_touch_get_time_usec(tevent));
wlr_event.slot = libinput_event_touch_get_slot(tevent);
wlr_event.touch_id = libinput_event_touch_get_slot(tevent);
wl_signal_emit(&wlr_dev->touch->events.up, &wlr_event);
}
@ -72,7 +72,7 @@ void handle_touch_motion(struct libinput_event *event,
wlr_event.device = wlr_dev;
wlr_event.time_msec =
usec_to_msec(libinput_event_touch_get_time_usec(tevent));
wlr_event.slot = libinput_event_touch_get_slot(tevent);
wlr_event.touch_id = libinput_event_touch_get_slot(tevent);
wlr_event.x_mm = libinput_event_touch_get_x(tevent);
wlr_event.y_mm = libinput_event_touch_get_y(tevent);
libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm);
@ -93,6 +93,6 @@ void handle_touch_cancel(struct libinput_event *event,
wlr_event.device = wlr_dev;
wlr_event.time_msec =
usec_to_msec(libinput_event_touch_get_time_usec(tevent));
wlr_event.slot = libinput_event_touch_get_slot(tevent);
wlr_event.touch_id = libinput_event_touch_get_slot(tevent);
wl_signal_emit(&wlr_dev->touch->events.cancel, &wlr_event);
}

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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,

View file

@ -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;

View file

@ -22,7 +22,7 @@ struct wlr_touch {
struct wlr_event_touch_down {
struct wlr_input_device *device;
uint32_t time_msec;
int32_t slot;
int32_t touch_id;
double x_mm, y_mm;
double width_mm, height_mm;
};
@ -30,13 +30,13 @@ struct wlr_event_touch_down {
struct wlr_event_touch_up {
struct wlr_input_device *device;
uint32_t time_msec;
int32_t slot;
int32_t touch_id;
};
struct wlr_event_touch_motion {
struct wlr_input_device *device;
uint32_t time_msec;
int32_t slot;
int32_t touch_id;
double x_mm, y_mm;
double width_mm, height_mm;
};
@ -44,7 +44,7 @@ struct wlr_event_touch_motion {
struct wlr_event_touch_cancel {
struct wlr_input_device *device;
uint32_t time_msec;
int32_t slot;
int32_t touch_id;
};
#endif

View file

@ -237,11 +237,11 @@ void roots_cursor_handle_touch_down(struct roots_cursor *cursor,
uint32_t serial = 0;
if (surface) {
serial = wlr_seat_touch_notify_down(cursor->seat->seat, surface,
event->time_msec, event->slot, sx, sy);
event->time_msec, event->touch_id, sx, sy);
}
if (serial && wlr_seat_touch_num_points(cursor->seat->seat) == 1) {
cursor->seat->touch_id = event->slot;
cursor->seat->touch_id = event->touch_id;
cursor->seat->touch_x = lx;
cursor->seat->touch_y = ly;
roots_cursor_press_button(cursor, event->device, event->time_msec,
@ -251,7 +251,7 @@ void roots_cursor_handle_touch_down(struct roots_cursor *cursor,
void roots_cursor_handle_touch_up(struct roots_cursor *cursor,
struct wlr_event_touch_up *event) {
struct wlr_touch_point *point = wlr_seat_touch_get_point(cursor->seat->seat, event->slot);
struct wlr_touch_point *point = wlr_seat_touch_get_point(cursor->seat->seat, event->touch_id);
if (!point) {
return;
}
@ -261,14 +261,14 @@ void roots_cursor_handle_touch_up(struct roots_cursor *cursor,
BTN_LEFT, 0, cursor->seat->touch_x, cursor->seat->touch_y);
}
wlr_seat_touch_notify_up(cursor->seat->seat, event->time_msec, event->slot);
wlr_seat_touch_notify_up(cursor->seat->seat, event->time_msec, event->touch_id);
}
void roots_cursor_handle_touch_motion(struct roots_cursor *cursor,
struct wlr_event_touch_motion *event) {
struct roots_desktop *desktop = cursor->seat->input->server->desktop;
struct wlr_touch_point *point =
wlr_seat_touch_get_point(cursor->seat->seat, event->slot);
wlr_seat_touch_get_point(cursor->seat->seat, event->touch_id);
if (!point) {
return;
}
@ -288,15 +288,15 @@ void roots_cursor_handle_touch_motion(struct roots_cursor *cursor,
if (surface) {
wlr_seat_touch_point_focus(cursor->seat->seat, surface,
event->time_msec, event->slot, sx, sy);
event->time_msec, event->touch_id, sx, sy);
wlr_seat_touch_notify_motion(cursor->seat->seat, event->time_msec,
event->slot, sx, sy);
event->touch_id, sx, sy);
} else {
wlr_seat_touch_point_clear_focus(cursor->seat->seat, event->time_msec,
event->slot);
event->touch_id);
}
if (event->slot == cursor->seat->touch_id) {
if (event->touch_id == cursor->seat->touch_id) {
cursor->seat->touch_x = lx;
cursor->seat->touch_y = ly;
}