mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-04-21 18:20:40 +02:00
Add a bunch of warnings when sending events outside of emulating
This commit is contained in:
parent
4c874469d5
commit
1f37500607
1 changed files with 55 additions and 10 deletions
|
|
@ -384,8 +384,11 @@ ei_device_pointer_motion(struct ei_device *device,
|
|||
return;
|
||||
}
|
||||
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING)
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
ei_send_pointer_rel(device, x, y);
|
||||
}
|
||||
|
|
@ -400,8 +403,11 @@ ei_device_pointer_motion_absolute(struct ei_device *device,
|
|||
return;
|
||||
}
|
||||
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING)
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
struct ei_region *r;
|
||||
list_for_each(r, &device->regions, link) {
|
||||
|
|
@ -423,8 +429,11 @@ ei_device_pointer_button(struct ei_device *device,
|
|||
return;
|
||||
}
|
||||
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING)
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ignore anything < BTN_MOUSE. Avoids the common error of sending
|
||||
* numerical buttons instead of BTN_LEFT and friends. */
|
||||
|
|
@ -460,8 +469,11 @@ ei_device_pointer_scroll(struct ei_device *device,
|
|||
"%s: device is not a (absolute) pointer\n", __func__);
|
||||
}
|
||||
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING)
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
ei_device_resume_scrolling(device, x, y);
|
||||
|
||||
|
|
@ -476,8 +488,12 @@ ei_device_pointer_scroll_stop(struct ei_device *device, bool x, bool y)
|
|||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not a (absolute) pointer\n", __func__);
|
||||
}
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING)
|
||||
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Filter out duplicate scroll stop requests */
|
||||
if (x && !device->scroll.x_is_stopped)
|
||||
|
|
@ -502,8 +518,12 @@ ei_device_pointer_scroll_cancel(struct ei_device *device, bool x, bool y)
|
|||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not a (absolute) pointer\n", __func__);
|
||||
}
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING)
|
||||
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Filter out duplicate scroll cancelled requests */
|
||||
if (x && !device->scroll.x_is_cancelled) {
|
||||
|
|
@ -534,8 +554,11 @@ ei_device_pointer_scroll_discrete(struct ei_device *device,
|
|||
"%s: device is not a (absolute) pointer\n", __func__);
|
||||
}
|
||||
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING)
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
ei_device_resume_scrolling(device, x, y);
|
||||
|
||||
|
|
@ -552,8 +575,11 @@ ei_device_keyboard_key(struct ei_device *device,
|
|||
return;
|
||||
}
|
||||
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING)
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
ei_send_keyboard_key(device, key, is_press);
|
||||
}
|
||||
|
|
@ -605,6 +631,12 @@ ei_touch_down(struct ei_touch *touch, double x, double y)
|
|||
{
|
||||
struct ei_device *device = ei_touch_get_device(touch);
|
||||
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (touch->state != TOUCH_IS_NEW) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: touch %u already down or up\n", __func__, touch->tracking_id);
|
||||
|
|
@ -629,10 +661,17 @@ ei_touch_down(struct ei_touch *touch, double x, double y)
|
|||
_public_ void
|
||||
ei_touch_motion(struct ei_touch *touch, double x, double y)
|
||||
{
|
||||
struct ei_device *device = ei_touch_get_device(touch);
|
||||
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (touch->state != TOUCH_IS_DOWN)
|
||||
return;
|
||||
|
||||
struct ei_device *device = ei_touch_get_device(touch);
|
||||
struct ei_region *r;
|
||||
list_for_each(r, &device->regions, link) {
|
||||
if (!ei_region_contains(r, x, y)) {
|
||||
|
|
@ -649,8 +688,14 @@ ei_touch_motion(struct ei_touch *touch, double x, double y)
|
|||
_public_ void
|
||||
ei_touch_up(struct ei_touch *touch)
|
||||
{
|
||||
struct ei_device *device = ei_touch_get_device(touch);
|
||||
if (device->state != EI_DEVICE_STATE_EMULATING) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: device is not not emulating\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (touch->state != TOUCH_IS_DOWN) {
|
||||
struct ei_device *device = ei_touch_get_device(touch);
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
"%s: touch %u is not currently down\n", __func__, touch->tracking_id);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue