mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2025-12-20 12:40:06 +01:00
Fix region check for devices with multiple regions
Use the ei(s)_device_in_region() to check for any region. Closes #56
This commit is contained in:
parent
87705ef97c
commit
0f81114544
2 changed files with 22 additions and 38 deletions
|
|
@ -1673,14 +1673,11 @@ ei_touch_down(struct ei_touch *touch, double x, double y)
|
|||
return;
|
||||
}
|
||||
|
||||
struct ei_region *r;
|
||||
list_for_each(r, &device->regions, link) {
|
||||
if (!ei_region_contains(r, x, y)) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
|
||||
touch->state = TOUCH_IS_UP;
|
||||
return;
|
||||
}
|
||||
if (!ei_device_in_region(device, x, y)) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
|
||||
touch->state = TOUCH_IS_UP;
|
||||
return;
|
||||
}
|
||||
|
||||
touch->state = TOUCH_IS_DOWN;
|
||||
|
|
@ -1705,14 +1702,11 @@ ei_touch_motion(struct ei_touch *touch, double x, double y)
|
|||
return;
|
||||
}
|
||||
|
||||
struct ei_region *r;
|
||||
list_for_each(r, &device->regions, link) {
|
||||
if (!ei_region_contains(r, x, y)) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
|
||||
ei_touch_up(touch);
|
||||
return;
|
||||
}
|
||||
if (!ei_device_in_region(device, x, y)) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
|
||||
ei_touch_up(touch);
|
||||
return;
|
||||
}
|
||||
|
||||
ei_send_touch_motion(touch->device, touch->tracking_id, x, y);
|
||||
|
|
|
|||
|
|
@ -1041,12 +1041,8 @@ eis_device_pointer_motion_absolute(struct eis_device *device,
|
|||
if (device->state != EIS_DEVICE_STATE_EMULATING)
|
||||
return;
|
||||
|
||||
struct eis_region *r;
|
||||
list_for_each(r, &device->regions, link) {
|
||||
if (!eis_region_contains(r, x, y)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!eis_device_in_region(device, x, y))
|
||||
return;
|
||||
|
||||
device->send_frame_event = true;
|
||||
|
||||
|
|
@ -1263,14 +1259,11 @@ eis_touch_down(struct eis_touch *touch, double x, double y)
|
|||
return;
|
||||
}
|
||||
|
||||
struct eis_region *r;
|
||||
list_for_each(r, &device->regions, link) {
|
||||
if (!eis_region_contains(r, x, y)) {
|
||||
log_bug_client(eis_device_get_context(device),
|
||||
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
|
||||
touch->state = TOUCH_IS_UP;
|
||||
return;
|
||||
}
|
||||
if (!eis_device_in_region(device, x, y)) {
|
||||
log_bug_client(eis_device_get_context(device),
|
||||
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
|
||||
touch->state = TOUCH_IS_UP;
|
||||
return;
|
||||
}
|
||||
|
||||
touch->state = TOUCH_IS_DOWN;
|
||||
|
|
@ -1286,14 +1279,11 @@ eis_touch_motion(struct eis_touch *touch, double x, double y)
|
|||
return;
|
||||
|
||||
struct eis_device *device = eis_touch_get_device(touch);
|
||||
struct eis_region *r;
|
||||
list_for_each(r, &device->regions, link) {
|
||||
if (!eis_region_contains(r, x, y)) {
|
||||
log_bug_client(eis_device_get_context(device),
|
||||
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
|
||||
eis_touch_up(touch);
|
||||
return;
|
||||
}
|
||||
if (!eis_device_in_region(device, x, y)) {
|
||||
log_bug_client(eis_device_get_context(device),
|
||||
"%s: touch %u has invalid x/y coordinates", __func__, touch->tracking_id);
|
||||
eis_touch_up(touch);
|
||||
return;
|
||||
}
|
||||
|
||||
device->send_frame_event = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue