mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-04-24 02:10:43 +02:00
libweston: notify_touch API to use weston_touch_device
Relay touch input events into libweston core through the weston_touch_device, so that the core can tell which individual physical device they come from. This is necessary for supporting touchscreen calibration, where one needs to process a single physical device at a time instead of the aggregate of all touch devices on the weston_seat. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> v1 Tested-by: Matt Hoosier <matt.hoosier@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
09fbe14e8f
commit
bcbce33000
5 changed files with 23 additions and 24 deletions
|
|
@ -2146,7 +2146,7 @@ input_handle_touch_down(void *data, struct wl_touch *wl_touch,
|
|||
|
||||
weston_output_transform_coordinate(&output->base, x, y, &x, &y);
|
||||
|
||||
notify_touch(&input->base, &ts, id, x, y, WL_TOUCH_DOWN);
|
||||
notify_touch(input->touch_device, &ts, id, x, y, WL_TOUCH_DOWN);
|
||||
input->touch_active = true;
|
||||
}
|
||||
|
||||
|
|
@ -2187,7 +2187,7 @@ input_handle_touch_up(void *data, struct wl_touch *wl_touch,
|
|||
}
|
||||
|
||||
if (active)
|
||||
notify_touch(&input->base, &ts, id, 0, 0, WL_TOUCH_UP);
|
||||
notify_touch(input->touch_device, &ts, id, 0, 0, WL_TOUCH_UP);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -2216,7 +2216,7 @@ input_handle_touch_motion(void *data, struct wl_touch *wl_touch,
|
|||
|
||||
weston_output_transform_coordinate(&output->base, x, y, &x, &y);
|
||||
|
||||
notify_touch(&input->base, &ts, id, x, y, WL_TOUCH_MOTION);
|
||||
notify_touch(input->touch_device, &ts, id, x, y, WL_TOUCH_MOTION);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -2227,7 +2227,7 @@ input_handle_touch_frame(void *data, struct wl_touch *wl_touch)
|
|||
if (!input->touch_focus || !input->touch_active)
|
||||
return;
|
||||
|
||||
notify_touch_frame(&input->base);
|
||||
notify_touch_frame(input->touch_device);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -2238,7 +2238,7 @@ input_handle_touch_cancel(void *data, struct wl_touch *wl_touch)
|
|||
if (!input->touch_focus || !input->touch_active)
|
||||
return;
|
||||
|
||||
notify_touch_cancel(&input->base);
|
||||
notify_touch_cancel(input->touch_device);
|
||||
}
|
||||
|
||||
static const struct wl_touch_listener touch_listener = {
|
||||
|
|
|
|||
|
|
@ -1543,13 +1543,13 @@ void
|
|||
notify_keyboard_focus_out(struct weston_seat *seat);
|
||||
|
||||
void
|
||||
notify_touch(struct weston_seat *seat, const struct timespec *time,
|
||||
notify_touch(struct weston_touch_device *device, const struct timespec *time,
|
||||
int touch_id, double x, double y, int touch_type);
|
||||
void
|
||||
notify_touch_frame(struct weston_seat *seat);
|
||||
notify_touch_frame(struct weston_touch_device *device);
|
||||
|
||||
void
|
||||
notify_touch_cancel(struct weston_seat *seat);
|
||||
notify_touch_cancel(struct weston_touch_device *device);
|
||||
|
||||
void
|
||||
weston_layer_entry_insert(struct weston_layer_entry *list,
|
||||
|
|
|
|||
|
|
@ -2347,12 +2347,12 @@ weston_touch_set_focus(struct weston_touch *touch, struct weston_view *view)
|
|||
*
|
||||
*/
|
||||
WL_EXPORT void
|
||||
notify_touch(struct weston_seat *seat, const struct timespec *time,
|
||||
notify_touch(struct weston_touch_device *device, const struct timespec *time,
|
||||
int touch_id, double double_x, double double_y, int touch_type)
|
||||
{
|
||||
struct weston_compositor *ec = seat->compositor;
|
||||
struct weston_touch *touch = weston_seat_get_touch(seat);
|
||||
struct weston_touch_grab *grab = touch->grab;
|
||||
struct weston_touch *touch = device->aggregate;
|
||||
struct weston_touch_grab *grab = device->aggregate->grab;
|
||||
struct weston_compositor *ec = device->aggregate->seat->compositor;
|
||||
struct weston_view *ev;
|
||||
wl_fixed_t sx, sy;
|
||||
wl_fixed_t x = wl_fixed_from_double(double_x);
|
||||
|
|
@ -2426,19 +2426,17 @@ notify_touch(struct weston_seat *seat, const struct timespec *time,
|
|||
}
|
||||
|
||||
WL_EXPORT void
|
||||
notify_touch_frame(struct weston_seat *seat)
|
||||
notify_touch_frame(struct weston_touch_device *device)
|
||||
{
|
||||
struct weston_touch *touch = weston_seat_get_touch(seat);
|
||||
struct weston_touch_grab *grab = touch->grab;
|
||||
struct weston_touch_grab *grab = device->aggregate->grab;
|
||||
|
||||
grab->interface->frame(grab);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
notify_touch_cancel(struct weston_seat *seat)
|
||||
notify_touch_cancel(struct weston_touch_device *device)
|
||||
{
|
||||
struct weston_touch *touch = weston_seat_get_touch(seat);
|
||||
struct weston_touch_grab *grab = touch->grab;
|
||||
struct weston_touch_grab *grab = device->aggregate->grab;
|
||||
|
||||
grab->interface->cancel(grab);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ handle_touch_with_coords(struct libinput_device *libinput_device,
|
|||
weston_output_transform_coordinate(device->output,
|
||||
x, y, &x, &y);
|
||||
|
||||
notify_touch(device->seat, &time, slot, x, y, touch_type);
|
||||
notify_touch(device->touch_device, &time, slot, x, y, touch_type);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -467,7 +467,7 @@ handle_touch_up(struct libinput_device *libinput_device,
|
|||
timespec_from_usec(&time,
|
||||
libinput_event_touch_get_time_usec(touch_event));
|
||||
|
||||
notify_touch(device->seat, &time, slot, 0, 0, WL_TOUCH_UP);
|
||||
notify_touch(device->touch_device, &time, slot, 0, 0, WL_TOUCH_UP);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -476,9 +476,8 @@ handle_touch_frame(struct libinput_device *libinput_device,
|
|||
{
|
||||
struct evdev_device *device =
|
||||
libinput_device_get_user_data(libinput_device);
|
||||
struct weston_seat *seat = device->seat;
|
||||
|
||||
notify_touch_frame(seat);
|
||||
notify_touch_frame(device->touch_device);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -595,12 +595,14 @@ send_touch(struct wl_client *client, struct wl_resource *resource,
|
|||
int32_t touch_id, wl_fixed_t x, wl_fixed_t y, uint32_t touch_type)
|
||||
{
|
||||
struct weston_test *test = wl_resource_get_user_data(resource);
|
||||
struct weston_seat *seat = get_seat(test);
|
||||
struct weston_touch_device *device = test->touch_device[0];
|
||||
struct timespec time;
|
||||
|
||||
assert(device);
|
||||
|
||||
timespec_from_proto(&time, tv_sec_hi, tv_sec_lo, tv_nsec);
|
||||
|
||||
notify_touch(seat, &time, touch_id, wl_fixed_to_double(x),
|
||||
notify_touch(device, &time, touch_id, wl_fixed_to_double(x),
|
||||
wl_fixed_to_double(y), touch_type);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue