mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2025-12-20 09:10:04 +01:00
ei: change the API to match the protocol interfaces closer
Now that the protocol interfaces are more fine-grained, let's match this with the C API too. This is just a rename of things so that in general ei_pointer_*foo now becomes ei_foo*. A few notable renames for better readability here: - ei_device_scroll_delta (because scroll_scroll is awkward) - ei_event_scroll_get_dx/dy and ei_event_scroll_get_discrete_dx/dy to indicate the delta-ness Beyond that, clients must ensure to check/bind to the new EI_DEVICE_CAP_BUTTON and EI_DEVICE_CAP_SCROLL capabilities to be able to send button or scroll events. Note that this API now allows for an EIS implementation to send a device that only has a button or a scroll cap. Or a pointer cap without buttons, etc. It's up to the clients how to handle such devices (probably: ignore them).
This commit is contained in:
parent
6ee202569f
commit
da37da1308
14 changed files with 367 additions and 344 deletions
|
|
@ -225,23 +225,21 @@ handle_msg_done(struct ei_device *device)
|
|||
mask_add(device->capabilities, EI_DEVICE_CAP_POINTER);
|
||||
if (device->pointer_absolute)
|
||||
mask_add(device->capabilities, EI_DEVICE_CAP_POINTER_ABSOLUTE);
|
||||
|
||||
/* button/scroll-only defaults to normal pointer cap */
|
||||
if ((device->scroll || device->button) &&
|
||||
(!device->pointer_absolute)) {
|
||||
mask_add(device->capabilities, EI_DEVICE_CAP_POINTER);
|
||||
}
|
||||
|
||||
if (device->button)
|
||||
mask_add(device->capabilities, EI_DEVICE_CAP_BUTTON);
|
||||
if (device->scroll)
|
||||
mask_add(device->capabilities, EI_DEVICE_CAP_SCROLL);
|
||||
if (device->keyboard)
|
||||
mask_add(device->capabilities, EI_DEVICE_CAP_KEYBOARD);
|
||||
|
||||
if (device->touchscreen)
|
||||
mask_add(device->capabilities, EI_DEVICE_CAP_TOUCH);
|
||||
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_KEYBOARD) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_TOUCH)) {
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_TOUCH) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_BUTTON) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL)) {
|
||||
log_debug(ei, "Rejecting device %#" PRIx64 " '%s' with no known capabilities",
|
||||
ei_device_get_id(device), ei_device_get_name(device));
|
||||
ei_device_close(device);
|
||||
|
|
@ -253,12 +251,14 @@ handle_msg_done(struct ei_device *device)
|
|||
ei_queue_device_added_event(device);
|
||||
ei_device_done(device);
|
||||
log_debug(ei,
|
||||
"Added device %#" PRIx64 " '%s' caps: %s%s%s%s seat: %s",
|
||||
"Added device %#" PRIx64 " '%s' caps: %s%s%s%s%s%s seat: %s",
|
||||
ei_device_get_id(device), ei_device_get_name(device),
|
||||
ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) ? "p" : "",
|
||||
ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE) ? "a" : "",
|
||||
ei_device_has_capability(device, EI_DEVICE_CAP_KEYBOARD) ? "k" : "",
|
||||
ei_device_has_capability(device, EI_DEVICE_CAP_TOUCH) ? "t" : "",
|
||||
ei_device_has_capability(device, EI_DEVICE_CAP_BUTTON) ? "b" : "",
|
||||
ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL) ? "s" : "",
|
||||
ei_seat_get_name(ei_device_get_seat(device)));
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -515,10 +515,9 @@ handle_msg_button(struct ei_button *button,
|
|||
DISCONNECT_IF_SENDER_CONTEXT(device);
|
||||
|
||||
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER)) {
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_BUTTON)) {
|
||||
return brei_result_new(EI_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
||||
"Pointer button event for non-pointer device");
|
||||
"Button event for non-button device");
|
||||
}
|
||||
|
||||
if (device->state == EI_DEVICE_STATE_EMULATING) {
|
||||
|
|
@ -536,10 +535,9 @@ handle_msg_scroll(struct ei_scroll *scroll, float x, float y)
|
|||
|
||||
DISCONNECT_IF_SENDER_CONTEXT(device);
|
||||
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER)) {
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL)) {
|
||||
return brei_result_new(EI_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
||||
"Pointer scroll event for non-pointer device");
|
||||
"Scroll event for non-scroll device");
|
||||
}
|
||||
|
||||
if (device->state == EI_DEVICE_STATE_EMULATING) {
|
||||
|
|
@ -557,10 +555,9 @@ handle_msg_scroll_discrete(struct ei_scroll *scroll, int32_t x, int32_t y)
|
|||
|
||||
DISCONNECT_IF_SENDER_CONTEXT(device);
|
||||
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER)) {
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL)) {
|
||||
return brei_result_new(EI_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
||||
"Pointer scroll discrete event for non-pointer device");
|
||||
"Scroll discrete event for non-scroll device");
|
||||
}
|
||||
|
||||
if (device->state == EI_DEVICE_STATE_EMULATING) {
|
||||
|
|
@ -579,10 +576,9 @@ handle_msg_scroll_stop(struct ei_scroll *scroll,
|
|||
|
||||
DISCONNECT_IF_SENDER_CONTEXT(device);
|
||||
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER)) {
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL)) {
|
||||
return brei_result_new(EI_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
||||
"Pointer scroll stop event for non-pointer device");
|
||||
"Scroll stop event for non-scroll device");
|
||||
}
|
||||
|
||||
if (device->state == EI_DEVICE_STATE_EMULATING) {
|
||||
|
|
@ -1126,6 +1122,8 @@ ei_device_has_capability(struct ei_device *device,
|
|||
case EI_DEVICE_CAP_POINTER_ABSOLUTE:
|
||||
case EI_DEVICE_CAP_KEYBOARD:
|
||||
case EI_DEVICE_CAP_TOUCH:
|
||||
case EI_DEVICE_CAP_BUTTON:
|
||||
case EI_DEVICE_CAP_SCROLL:
|
||||
return mask_all(device->capabilities, cap);
|
||||
}
|
||||
return false;
|
||||
|
|
@ -1354,8 +1352,8 @@ ei_device_pointer_motion_absolute(struct ei_device *device,
|
|||
}
|
||||
|
||||
_public_ void
|
||||
ei_device_pointer_button(struct ei_device *device,
|
||||
uint32_t button, bool is_press)
|
||||
ei_device_button_button(struct ei_device *device,
|
||||
uint32_t button, bool is_press)
|
||||
{
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER)) {
|
||||
log_bug_client(ei_device_get_context(device),
|
||||
|
|
@ -1381,8 +1379,7 @@ ei_device_pointer_button(struct ei_device *device,
|
|||
}
|
||||
|
||||
_public_ void
|
||||
ei_device_pointer_scroll(struct ei_device *device,
|
||||
double x, double y)
|
||||
ei_device_scroll_delta(struct ei_device *device, double x, double y)
|
||||
{
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
||||
|
|
@ -1403,7 +1400,7 @@ ei_device_pointer_scroll(struct ei_device *device,
|
|||
|
||||
|
||||
_public_ void
|
||||
ei_device_pointer_scroll_stop(struct ei_device *device, bool x, bool y)
|
||||
ei_device_scroll_stop(struct ei_device *device, bool x, bool y)
|
||||
{
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
||||
|
|
@ -1433,7 +1430,7 @@ ei_device_pointer_scroll_stop(struct ei_device *device, bool x, bool y)
|
|||
}
|
||||
|
||||
_public_ void
|
||||
ei_device_pointer_scroll_cancel(struct ei_device *device, bool x, bool y)
|
||||
ei_device_scroll_cancel(struct ei_device *device, bool x, bool y)
|
||||
{
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
||||
|
|
@ -1467,8 +1464,7 @@ ei_device_pointer_scroll_cancel(struct ei_device *device, bool x, bool y)
|
|||
}
|
||||
|
||||
_public_ void
|
||||
ei_device_pointer_scroll_discrete(struct ei_device *device,
|
||||
int32_t x, int32_t y)
|
||||
ei_device_scroll_discrete(struct ei_device *device, int32_t x, int32_t y)
|
||||
{
|
||||
if (!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER) &&
|
||||
!ei_device_has_capability(device, EI_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
||||
|
|
|
|||
|
|
@ -54,11 +54,11 @@ ei_event_type_to_string(enum ei_event_type type)
|
|||
CASE_RETURN_STRING(EI_EVENT_DEVICE_STOP_EMULATING);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_MOTION);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_MOTION_ABSOLUTE);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_BUTTON);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_SCROLL);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_SCROLL_STOP);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_SCROLL_CANCEL);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
CASE_RETURN_STRING(EI_EVENT_BUTTON_BUTTON);
|
||||
CASE_RETURN_STRING(EI_EVENT_SCROLL_DELTA);
|
||||
CASE_RETURN_STRING(EI_EVENT_SCROLL_STOP);
|
||||
CASE_RETURN_STRING(EI_EVENT_SCROLL_CANCEL);
|
||||
CASE_RETURN_STRING(EI_EVENT_SCROLL_DISCRETE);
|
||||
CASE_RETURN_STRING(EI_EVENT_KEYBOARD_KEY);
|
||||
CASE_RETURN_STRING(EI_EVENT_TOUCH_DOWN);
|
||||
CASE_RETURN_STRING(EI_EVENT_TOUCH_UP);
|
||||
|
|
@ -86,11 +86,11 @@ ei_event_destroy(struct ei_event *event)
|
|||
case EI_EVENT_DEVICE_STOP_EMULATING:
|
||||
case EI_EVENT_POINTER_MOTION:
|
||||
case EI_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
case EI_EVENT_POINTER_BUTTON:
|
||||
case EI_EVENT_POINTER_SCROLL:
|
||||
case EI_EVENT_POINTER_SCROLL_STOP:
|
||||
case EI_EVENT_POINTER_SCROLL_CANCEL:
|
||||
case EI_EVENT_POINTER_SCROLL_DISCRETE:
|
||||
case EI_EVENT_BUTTON_BUTTON:
|
||||
case EI_EVENT_SCROLL_DELTA:
|
||||
case EI_EVENT_SCROLL_STOP:
|
||||
case EI_EVENT_SCROLL_CANCEL:
|
||||
case EI_EVENT_SCROLL_DISCRETE:
|
||||
case EI_EVENT_KEYBOARD_KEY:
|
||||
case EI_EVENT_TOUCH_DOWN:
|
||||
case EI_EVENT_TOUCH_UP:
|
||||
|
|
@ -209,9 +209,9 @@ ei_event_pointer_get_dx(struct ei_event *event)
|
|||
require_event_type(event, 0.0,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.dx;
|
||||
}
|
||||
|
|
@ -222,9 +222,9 @@ ei_event_pointer_get_dy(struct ei_event *event)
|
|||
require_event_type(event, 0.0,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.dy;
|
||||
}
|
||||
|
|
@ -235,9 +235,9 @@ ei_event_pointer_get_absolute_x(struct ei_event *event)
|
|||
require_event_type(event, 0.0,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.absx;
|
||||
}
|
||||
|
|
@ -248,102 +248,102 @@ ei_event_pointer_get_absolute_y(struct ei_event *event)
|
|||
require_event_type(event, 0.0,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.absy;
|
||||
}
|
||||
|
||||
_public_ uint32_t
|
||||
ei_event_pointer_get_button(struct ei_event *event)
|
||||
ei_event_button_get_button(struct ei_event *event)
|
||||
{
|
||||
require_event_type(event, 0,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.button;
|
||||
}
|
||||
|
||||
_public_ bool
|
||||
ei_event_pointer_get_button_is_press(struct ei_event *event)
|
||||
ei_event_button_get_is_press(struct ei_event *event)
|
||||
{
|
||||
require_event_type(event, false,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.button_is_press;
|
||||
}
|
||||
|
||||
_public_ double
|
||||
ei_event_pointer_get_scroll_x(struct ei_event *event)
|
||||
ei_event_scroll_get_dx(struct ei_event *event)
|
||||
{
|
||||
require_event_type(event, 0,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_DISCRETE);
|
||||
return event->pointer.sx;
|
||||
}
|
||||
|
||||
_public_ double
|
||||
ei_event_pointer_get_scroll_y(struct ei_event *event)
|
||||
ei_event_scroll_get_dy(struct ei_event *event)
|
||||
{
|
||||
require_event_type(event, 0,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_DISCRETE);
|
||||
return event->pointer.sy;
|
||||
}
|
||||
|
||||
_public_ int32_t
|
||||
ei_event_pointer_get_scroll_discrete_x(struct ei_event *event)
|
||||
ei_event_scroll_get_discrete_dx(struct ei_event *event)
|
||||
{
|
||||
require_event_type(event, 0,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_DISCRETE);
|
||||
return event->pointer.sdx;
|
||||
}
|
||||
|
||||
_public_ int32_t
|
||||
ei_event_pointer_get_scroll_discrete_y(struct ei_event *event)
|
||||
ei_event_scroll_get_discrete_dy(struct ei_event *event)
|
||||
{
|
||||
require_event_type(event, 0,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_DISCRETE);
|
||||
return event->pointer.sdy;
|
||||
}
|
||||
|
||||
_public_ bool
|
||||
ei_event_pointer_get_scroll_stop_x(struct ei_event *event)
|
||||
ei_event_scroll_get_stop_x(struct ei_event *event)
|
||||
{
|
||||
require_event_type(event, 0,
|
||||
EI_EVENT_POINTER_SCROLL_STOP,
|
||||
EI_EVENT_POINTER_SCROLL_CANCEL);
|
||||
EI_EVENT_SCROLL_STOP,
|
||||
EI_EVENT_SCROLL_CANCEL);
|
||||
return event->pointer.stop_x;
|
||||
}
|
||||
|
||||
_public_ bool
|
||||
ei_event_pointer_get_scroll_stop_y(struct ei_event *event)
|
||||
ei_event_scroll_get_stop_y(struct ei_event *event)
|
||||
{
|
||||
require_event_type(event, 0,
|
||||
EI_EVENT_POINTER_SCROLL_STOP,
|
||||
EI_EVENT_POINTER_SCROLL_CANCEL);
|
||||
EI_EVENT_SCROLL_STOP,
|
||||
EI_EVENT_SCROLL_CANCEL);
|
||||
return event->pointer.stop_y;
|
||||
}
|
||||
|
||||
|
|
@ -402,11 +402,11 @@ ei_event_get_time(struct ei_event *event)
|
|||
require_event_type(event, 0,
|
||||
EI_EVENT_POINTER_MOTION,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_STOP,
|
||||
EI_EVENT_POINTER_SCROLL_CANCEL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE,
|
||||
EI_EVENT_BUTTON_BUTTON,
|
||||
EI_EVENT_SCROLL_DELTA,
|
||||
EI_EVENT_SCROLL_STOP,
|
||||
EI_EVENT_SCROLL_CANCEL,
|
||||
EI_EVENT_SCROLL_DISCRETE,
|
||||
EI_EVENT_KEYBOARD_KEY,
|
||||
EI_EVENT_TOUCH_DOWN,
|
||||
EI_EVENT_TOUCH_UP,
|
||||
|
|
|
|||
|
|
@ -241,6 +241,10 @@ ei_seat_has_capability(struct ei_seat *seat,
|
|||
return seat->capabilities.map[EI_KEYBOARD_INTERFACE_INDEX] != 0;
|
||||
case EI_DEVICE_CAP_TOUCH:
|
||||
return seat->capabilities.map[EI_TOUCHSCREEN_INTERFACE_INDEX] != 0;
|
||||
case EI_DEVICE_CAP_SCROLL:
|
||||
return seat->capabilities.map[EI_SCROLL_INTERFACE_INDEX] != 0;
|
||||
case EI_DEVICE_CAP_BUTTON:
|
||||
return seat->capabilities.map[EI_BUTTON_INTERFACE_INDEX] != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -270,34 +274,22 @@ ei_seat_cap_mask(struct ei_seat *seat, enum ei_device_capability cap)
|
|||
{
|
||||
switch (cap) {
|
||||
case EI_DEVICE_CAP_POINTER_ABSOLUTE:
|
||||
return seat->capabilities.map[EI_POINTER_ABSOLUTE_INTERFACE_INDEX] |
|
||||
seat->capabilities.map[EI_SCROLL_INTERFACE_INDEX] |
|
||||
seat->capabilities.map[EI_BUTTON_INTERFACE_INDEX];
|
||||
return seat->capabilities.map[EI_POINTER_ABSOLUTE_INTERFACE_INDEX];
|
||||
case EI_DEVICE_CAP_POINTER:
|
||||
return seat->capabilities.map[EI_POINTER_INTERFACE_INDEX] |
|
||||
seat->capabilities.map[EI_SCROLL_INTERFACE_INDEX] |
|
||||
seat->capabilities.map[EI_BUTTON_INTERFACE_INDEX];
|
||||
return seat->capabilities.map[EI_POINTER_INTERFACE_INDEX];
|
||||
case EI_DEVICE_CAP_KEYBOARD:
|
||||
return seat->capabilities.map[EI_KEYBOARD_INTERFACE_INDEX];
|
||||
case EI_DEVICE_CAP_TOUCH:
|
||||
return seat->capabilities.map[EI_TOUCHSCREEN_INTERFACE_INDEX];
|
||||
case EI_DEVICE_CAP_BUTTON:
|
||||
return seat->capabilities.map[EI_BUTTON_INTERFACE_INDEX];
|
||||
case EI_DEVICE_CAP_SCROLL:
|
||||
return seat->capabilities.map[EI_SCROLL_INTERFACE_INDEX];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
ei_seat_pointer_cap_mask(struct ei_seat *seat)
|
||||
{
|
||||
return seat->capabilities.map[EI_POINTER_INTERFACE_INDEX];
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
ei_seat_pointer_absolute_cap_mask(struct ei_seat *seat)
|
||||
{
|
||||
return seat->capabilities.map[EI_POINTER_ABSOLUTE_INTERFACE_INDEX];
|
||||
}
|
||||
|
||||
_public_ void
|
||||
ei_seat_bind_capabilities(struct ei_seat *seat, ...)
|
||||
{
|
||||
|
|
@ -352,16 +344,6 @@ ei_seat_unbind_capabilities(struct ei_seat *seat, ...)
|
|||
mask_remove(mask, ei_seat_cap_mask(seat, cap));
|
||||
}
|
||||
|
||||
/* This is a bit frustrating because scroll/button aren't visible
|
||||
* to the libei C API: if we remove POINTER but *not* POINTER_ABSOLUTE
|
||||
* or vice versa we don't want to remove button/scroll either but the
|
||||
* above code does just that. So here we re-add it if either is present.
|
||||
*/
|
||||
if (mask & ei_seat_pointer_cap_mask(seat))
|
||||
mask_add(mask, ei_seat_cap_mask(seat, EI_DEVICE_CAP_POINTER));
|
||||
if (mask & ei_seat_pointer_absolute_cap_mask(seat))
|
||||
mask_add(mask, ei_seat_cap_mask(seat, EI_DEVICE_CAP_POINTER_ABSOLUTE));
|
||||
|
||||
if (seat->capabilities.bound == mask)
|
||||
return;
|
||||
|
||||
|
|
|
|||
30
src/libei.c
30
src/libei.c
|
|
@ -206,11 +206,11 @@ update_event_timestamp(struct ei_event *event, uint64_t time)
|
|||
switch (event->type) {
|
||||
case EI_EVENT_POINTER_MOTION:
|
||||
case EI_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
case EI_EVENT_POINTER_BUTTON:
|
||||
case EI_EVENT_POINTER_SCROLL:
|
||||
case EI_EVENT_POINTER_SCROLL_STOP:
|
||||
case EI_EVENT_POINTER_SCROLL_CANCEL:
|
||||
case EI_EVENT_POINTER_SCROLL_DISCRETE:
|
||||
case EI_EVENT_BUTTON_BUTTON:
|
||||
case EI_EVENT_SCROLL_DELTA:
|
||||
case EI_EVENT_SCROLL_STOP:
|
||||
case EI_EVENT_SCROLL_CANCEL:
|
||||
case EI_EVENT_SCROLL_DISCRETE:
|
||||
case EI_EVENT_KEYBOARD_KEY:
|
||||
case EI_EVENT_TOUCH_DOWN:
|
||||
case EI_EVENT_TOUCH_UP:
|
||||
|
|
@ -241,11 +241,11 @@ queue_event(struct ei *ei, struct ei_event *event)
|
|||
switch (event->type) {
|
||||
case EI_EVENT_POINTER_MOTION:
|
||||
case EI_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
case EI_EVENT_POINTER_BUTTON:
|
||||
case EI_EVENT_POINTER_SCROLL:
|
||||
case EI_EVENT_POINTER_SCROLL_STOP:
|
||||
case EI_EVENT_POINTER_SCROLL_CANCEL:
|
||||
case EI_EVENT_POINTER_SCROLL_DISCRETE:
|
||||
case EI_EVENT_BUTTON_BUTTON:
|
||||
case EI_EVENT_SCROLL_DELTA:
|
||||
case EI_EVENT_SCROLL_STOP:
|
||||
case EI_EVENT_SCROLL_CANCEL:
|
||||
case EI_EVENT_SCROLL_DISCRETE:
|
||||
case EI_EVENT_KEYBOARD_KEY:
|
||||
case EI_EVENT_TOUCH_DOWN:
|
||||
case EI_EVENT_TOUCH_UP:
|
||||
|
|
@ -462,7 +462,7 @@ ei_queue_pointer_button_event(struct ei_device *device, uint32_t button,
|
|||
{
|
||||
struct ei_event *e = ei_event_new_for_device(device);
|
||||
|
||||
e->type = EI_EVENT_POINTER_BUTTON;
|
||||
e->type = EI_EVENT_BUTTON_BUTTON;
|
||||
e->pointer.button = button;
|
||||
e->pointer.button_is_press = is_press;
|
||||
|
||||
|
|
@ -475,7 +475,7 @@ ei_queue_pointer_scroll_event(struct ei_device *device,
|
|||
{
|
||||
struct ei_event *e = ei_event_new_for_device(device);
|
||||
|
||||
e->type = EI_EVENT_POINTER_SCROLL;
|
||||
e->type = EI_EVENT_SCROLL_DELTA;
|
||||
e->pointer.sx = x;
|
||||
e->pointer.sy = y;
|
||||
|
||||
|
|
@ -488,7 +488,7 @@ ei_queue_pointer_scroll_discrete_event(struct ei_device *device,
|
|||
{
|
||||
struct ei_event *e = ei_event_new_for_device(device);
|
||||
|
||||
e->type = EI_EVENT_POINTER_SCROLL_DISCRETE;
|
||||
e->type = EI_EVENT_SCROLL_DISCRETE;
|
||||
e->pointer.sdx = x;
|
||||
e->pointer.sdy = y;
|
||||
|
||||
|
|
@ -500,7 +500,7 @@ ei_queue_pointer_scroll_stop_event(struct ei_device *device, bool x, bool y)
|
|||
{
|
||||
struct ei_event *e = ei_event_new_for_device(device);
|
||||
|
||||
e->type = EI_EVENT_POINTER_SCROLL_STOP;
|
||||
e->type = EI_EVENT_SCROLL_STOP;
|
||||
e->pointer.stop_x = x;
|
||||
e->pointer.stop_y = y;
|
||||
|
||||
|
|
@ -512,7 +512,7 @@ ei_queue_pointer_scroll_cancel_event(struct ei_device *device, bool x, bool y)
|
|||
{
|
||||
struct ei_event *e = ei_event_new_for_device(device);
|
||||
|
||||
e->type = EI_EVENT_POINTER_SCROLL_CANCEL;
|
||||
e->type = EI_EVENT_SCROLL_CANCEL;
|
||||
e->pointer.stop_x = x;
|
||||
e->pointer.stop_y = y;
|
||||
|
||||
|
|
|
|||
125
src/libei.h
125
src/libei.h
|
|
@ -173,10 +173,12 @@ enum ei_device_type {
|
|||
*
|
||||
*/
|
||||
enum ei_device_capability {
|
||||
EI_DEVICE_CAP_POINTER = 1,
|
||||
EI_DEVICE_CAP_POINTER_ABSOLUTE = 2,
|
||||
EI_DEVICE_CAP_KEYBOARD = 4,
|
||||
EI_DEVICE_CAP_TOUCH = 8,
|
||||
EI_DEVICE_CAP_POINTER = (1 << 0),
|
||||
EI_DEVICE_CAP_POINTER_ABSOLUTE = (1 << 1),
|
||||
EI_DEVICE_CAP_KEYBOARD = (1 << 2),
|
||||
EI_DEVICE_CAP_TOUCH = (1 << 3),
|
||||
EI_DEVICE_CAP_SCROLL = (1 << 4),
|
||||
EI_DEVICE_CAP_BUTTON = (1 << 5),
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -320,16 +322,18 @@ enum ei_event_type {
|
|||
|
||||
/* These events are only generated on a receiver ei context. */
|
||||
EI_EVENT_POINTER_MOTION = 300,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EI_EVENT_POINTER_BUTTON,
|
||||
EI_EVENT_POINTER_SCROLL,
|
||||
EI_EVENT_POINTER_SCROLL_STOP,
|
||||
EI_EVENT_POINTER_SCROLL_CANCEL,
|
||||
EI_EVENT_POINTER_SCROLL_DISCRETE,
|
||||
EI_EVENT_POINTER_MOTION_ABSOLUTE = 400,
|
||||
|
||||
EI_EVENT_KEYBOARD_KEY = 400,
|
||||
EI_EVENT_BUTTON_BUTTON = 500,
|
||||
|
||||
EI_EVENT_TOUCH_DOWN = 500,
|
||||
EI_EVENT_SCROLL_DELTA = 600,
|
||||
EI_EVENT_SCROLL_STOP,
|
||||
EI_EVENT_SCROLL_CANCEL,
|
||||
EI_EVENT_SCROLL_DISCRETE,
|
||||
|
||||
EI_EVENT_KEYBOARD_KEY = 700,
|
||||
|
||||
EI_EVENT_TOUCH_DOWN = 800,
|
||||
EI_EVENT_TOUCH_UP,
|
||||
EI_EVENT_TOUCH_MOTION,
|
||||
};
|
||||
|
|
@ -1140,8 +1144,7 @@ ei_device_pointer_motion_absolute(struct ei_device *device,
|
|||
|
||||
/**
|
||||
* Generate a button event on a device with
|
||||
* the @ref EI_DEVICE_CAP_POINTER_ABSOLUTE or
|
||||
* @ref EI_DEVICE_CAP_POINTER capability.
|
||||
* the @ref EI_DEVICE_CAP_BUTTON capability.
|
||||
*
|
||||
* Button codes must match the defines in ``linux/input-event-codes.h``
|
||||
*
|
||||
|
|
@ -1150,103 +1153,101 @@ ei_device_pointer_motion_absolute(struct ei_device *device,
|
|||
* @param is_press true for button press, false for button release
|
||||
*/
|
||||
void
|
||||
ei_device_pointer_button(struct ei_device *device,
|
||||
uint32_t button, bool is_press);
|
||||
ei_device_button_button(struct ei_device *device,
|
||||
uint32_t button, bool is_press);
|
||||
|
||||
/**
|
||||
* Generate a smooth (pixel-precise) scroll event on a device with
|
||||
* the @ref EI_DEVICE_CAP_POINTER_ABSOLUTE or
|
||||
* @ref EI_DEVICE_CAP_POINTER capability.
|
||||
* the @ref EI_DEVICE_CAP_SCROLL capability.
|
||||
*
|
||||
* @note The server is responsible for emulating discrete scrolling based
|
||||
* on the pixel value, do not call ei_device_pointer_scroll_discrete() for
|
||||
* on the pixel value, do not call ei_device_scroll_discrete() for
|
||||
* the same input event.
|
||||
*
|
||||
* @param device The EI device
|
||||
* @param x The x scroll distance in logical pixels
|
||||
* @param y The y scroll distance in logical pixels
|
||||
*
|
||||
* @see ei_device_pointer_scroll_discrete
|
||||
* @see ei_device_scroll_discrete
|
||||
*/
|
||||
void
|
||||
ei_device_pointer_scroll(struct ei_device *device, double x, double y);
|
||||
ei_device_scroll_delta(struct ei_device *device, double x, double y);
|
||||
|
||||
/**
|
||||
* Generate a discrete scroll event on a device with
|
||||
* the @ref EI_DEVICE_CAP_POINTER_ABSOLUTE or
|
||||
* @ref EI_DEVICE_CAP_POINTER capability.
|
||||
* the @ref EI_DEVICE_CAP_SCROLL capability.
|
||||
*
|
||||
* A discrete scroll event is based logical scroll units (equivalent to one
|
||||
* mouse wheel click). The value for one scroll unit is 120, a fraction or
|
||||
* multiple thereof represents a fraction or multiple of a wheel click.
|
||||
*
|
||||
* @note The server is responsible for emulating pixel-based scrolling based
|
||||
* on the discrete value, do not call ei_device_pointer_scroll() for the
|
||||
* on the discrete value, do not call ei_device_scroll_delta() for the
|
||||
* same input event.
|
||||
*
|
||||
* @param device The EI device
|
||||
* @param x The x scroll distance in fractions or multiples of 120
|
||||
* @param y The y scroll distance in fractions or multiples of 120
|
||||
*
|
||||
* @see ei_device_pointer_scroll
|
||||
* @see ei_device_scroll_delta
|
||||
*/
|
||||
void
|
||||
ei_device_pointer_scroll_discrete(struct ei_device *device, int32_t x, int32_t y);
|
||||
ei_device_scroll_discrete(struct ei_device *device, int32_t x, int32_t y);
|
||||
|
||||
/**
|
||||
* Generate a scroll stop event on a device with the @ref
|
||||
* EI_DEVICE_CAP_POINTER_ABSOLUTE or @ref EI_DEVICE_CAP_POINTER capability.
|
||||
* Generate a scroll stop event on a device with the
|
||||
* @ref EI_DEVICE_CAP_SCROLL capability.
|
||||
*
|
||||
* A scroll stop event notifies the server that the interaction causing a
|
||||
* scroll motion previously triggered with ei_device_pointer_scroll() or
|
||||
* ei_device_pointer_scroll_discrete() has stopped. For example, if all
|
||||
* scroll motion previously triggered with ei_device_scroll_delta() or
|
||||
* ei_device_scroll_discrete() has stopped. For example, if all
|
||||
* fingers are lifted off a touchpad, two-finger scrolling has logically
|
||||
* stopped.
|
||||
*
|
||||
* The server may use this information to e.g. start kinetic scrolling
|
||||
* previously based on the previous finger speed.
|
||||
*
|
||||
* Use ei_device_pointer_scroll_cancel() to signal that the scroll motion has
|
||||
* Use ei_device_scroll_cancel() to signal that the scroll motion has
|
||||
* completely stopped.
|
||||
*
|
||||
* Calling ei_device_pointer_scroll_stop() after
|
||||
* ei_device_pointer_scroll_cancel() without any of ei_device_pointer_scroll()
|
||||
* or ei_device_pointer_scroll_discrete() in between indicates a client logic bug.
|
||||
* Calling ei_device_scroll_stop() after
|
||||
* ei_device_scroll_cancel() without any of ei_device_scroll_delta()
|
||||
* or ei_device_scroll_discrete() in between indicates a client logic bug.
|
||||
*
|
||||
* libei keeps track of the scroll axis and filters duplicate calls to
|
||||
* ei_device_pointer_scroll_stop() for the same axis. A nonzero scroll or
|
||||
* ei_device_scroll_stop() for the same axis. A nonzero scroll or
|
||||
* scroll-discrete value is required for the given axis to re-start scrolling
|
||||
* for that axis.
|
||||
*/
|
||||
void
|
||||
ei_device_pointer_scroll_stop(struct ei_device *device, bool stop_x, bool stop_y);
|
||||
ei_device_scroll_stop(struct ei_device *device, bool stop_x, bool stop_y);
|
||||
|
||||
/**
|
||||
* Generate a scroll cancel event on a device with the @ref
|
||||
* EI_DEVICE_CAP_POINTER_ABSOLUTE or @ref EI_DEVICE_CAP_POINTER capability.
|
||||
* Generate a scroll cancel event on a device with the
|
||||
* @ref EI_DEVICE_CAP_SCROLL capability.
|
||||
*
|
||||
* A scroll cancel event notifies the server that a scroll motion previously
|
||||
* triggered with ei_device_pointer_scroll() or
|
||||
* ei_device_pointer_scroll_discrete() has ceased and no further events should
|
||||
* triggered with ei_device_scroll_delta() or
|
||||
* ei_device_scroll_discrete() has ceased and no further events should
|
||||
* be sent.
|
||||
*
|
||||
* This event indicates that the interaction has stopped to the point where
|
||||
* further (server-emulated) scroll events from this device are wrong.
|
||||
*
|
||||
* Use ei_device_pointer_scroll_stop() to signal that the interaction has
|
||||
* Use ei_device_scroll_stop() to signal that the interaction has
|
||||
* stopped but a server may emulate further scroll events.
|
||||
*
|
||||
* Calling ei_device_pointer_scroll_cancel() after
|
||||
* ei_device_pointer_scroll_stop() without any of ei_device_pointer_scroll()
|
||||
* or ei_device_pointer_scroll_discrete() in between iis permitted.
|
||||
* Calling ei_device_scroll_cancel() after
|
||||
* ei_device_scroll_stop() without any of ei_device_scroll_delta()
|
||||
* or ei_device_scroll_discrete() in between iis permitted.
|
||||
*
|
||||
* libei keeps track of the scroll axis and filters duplicate calls to
|
||||
* ei_device_pointer_scroll_cancel() for the same axis. A nonzero scroll or
|
||||
* ei_device_scroll_cancel() for the same axis. A nonzero scroll or
|
||||
* scroll-discrete value is required for the given axis to re-start scrolling
|
||||
* for that axis.
|
||||
*/
|
||||
void
|
||||
ei_device_pointer_scroll_cancel(struct ei_device *device, bool cancel_x, bool cancel_y);
|
||||
ei_device_scroll_cancel(struct ei_device *device, bool cancel_x, bool cancel_y);
|
||||
|
||||
/**
|
||||
* Generate a key event on a device with
|
||||
|
|
@ -1396,60 +1397,60 @@ double
|
|||
ei_event_pointer_get_absolute_y(struct ei_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EI_EVENT_POINTER_BUTTON return the button
|
||||
* For an event of type @ref EI_EVENT_BUTTON_BUTTON return the button
|
||||
* code as defined in linux/input-event-codes.h
|
||||
*/
|
||||
uint32_t
|
||||
ei_event_pointer_get_button(struct ei_event *event);
|
||||
ei_event_button_get_button(struct ei_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EI_EVENT_POINTER_BUTTON return true if the
|
||||
* For an event of type @ref EI_EVENT_BUTTON_BUTTON return true if the
|
||||
* event is a button press, false for a release.
|
||||
*/
|
||||
bool
|
||||
ei_event_pointer_get_button_is_press(struct ei_event *event);
|
||||
ei_event_button_get_is_press(struct ei_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EI_EVENT_POINTER_SCROLL return the x scroll
|
||||
* For an event of type @ref EI_EVENT_SCROLL_DELTA return the x scroll
|
||||
* distance in logical pixels or mm, depending on the device type.
|
||||
*/
|
||||
double
|
||||
ei_event_pointer_get_scroll_x(struct ei_event *event);
|
||||
ei_event_scroll_get_dx(struct ei_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EI_EVENT_POINTER_SCROLL return the y scroll
|
||||
* For an event of type @ref EI_EVENT_SCROLL_DELTA return the y scroll
|
||||
* distance in logical pixels or mm, depending on the device type.
|
||||
*/
|
||||
double
|
||||
ei_event_pointer_get_scroll_y(struct ei_event *event);
|
||||
ei_event_scroll_get_dy(struct ei_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EI_EVENT_POINTER_SCROLL_CANCEL return whether the
|
||||
* For an event of type @ref EI_EVENT_SCROLL_CANCEL return whether the
|
||||
* x axis has cancelled scrolling.
|
||||
*/
|
||||
bool
|
||||
ei_event_pointer_get_scroll_stop_x(struct ei_event *event);
|
||||
ei_event_scroll_get_stop_x(struct ei_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EI_EVENT_POINTER_SCROLL_STOP return whether the
|
||||
* For an event of type @ref EI_EVENT_SCROLL_STOP return whether the
|
||||
* y axis has stopped scrolling.
|
||||
*/
|
||||
bool
|
||||
ei_event_pointer_get_scroll_stop_y(struct ei_event *event);
|
||||
ei_event_scroll_get_stop_y(struct ei_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EI_EVENT_POINTER_SCROLL_DISCRETE return the x
|
||||
* For an event of type @ref EI_EVENT_SCROLL_DISCRETE return the x
|
||||
* scroll distance in fractions or multiples of 120.
|
||||
*/
|
||||
int32_t
|
||||
ei_event_pointer_get_scroll_discrete_x(struct ei_event *event);
|
||||
ei_event_scroll_get_discrete_dx(struct ei_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EI_EVENT_POINTER_SCROLL_DISCRETE return the y
|
||||
* For an event of type @ref EI_EVENT_SCROLL_DISCRETE return the y
|
||||
* scroll distance in fractions or multiples of 120.
|
||||
*/
|
||||
int32_t
|
||||
ei_event_pointer_get_scroll_discrete_y(struct ei_event *event);
|
||||
ei_event_scroll_get_discrete_dy(struct ei_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EI_EVENT_KEYBOARD_KEY return the key code (as
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ eis_event_destroy(struct eis_event *event)
|
|||
case EIS_EVENT_POINTER_BUTTON:
|
||||
case EIS_EVENT_POINTER_MOTION:
|
||||
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
case EIS_EVENT_POINTER_SCROLL:
|
||||
case EIS_EVENT_POINTER_SCROLL_DELTA:
|
||||
case EIS_EVENT_POINTER_SCROLL_STOP:
|
||||
case EIS_EVENT_POINTER_SCROLL_CANCEL:
|
||||
case EIS_EVENT_POINTER_SCROLL_DISCRETE:
|
||||
|
|
@ -174,7 +174,7 @@ eis_event_get_time(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_STOP,
|
||||
EIS_EVENT_POINTER_SCROLL_CANCEL,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE,
|
||||
|
|
@ -217,7 +217,7 @@ eis_event_pointer_get_dx(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.dx;
|
||||
|
|
@ -230,7 +230,7 @@ eis_event_pointer_get_dy(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.dy;
|
||||
|
|
@ -243,7 +243,7 @@ eis_event_pointer_get_absolute_x(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.absx;
|
||||
|
|
@ -256,7 +256,7 @@ eis_event_pointer_get_absolute_y(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.absy;
|
||||
|
|
@ -269,7 +269,7 @@ eis_event_pointer_get_button(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.button;
|
||||
|
|
@ -282,7 +282,7 @@ eis_event_pointer_get_button_is_press(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
|
||||
return event->pointer.button_is_press;
|
||||
|
|
@ -295,7 +295,7 @@ eis_event_pointer_get_scroll_x(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
return event->pointer.sx;
|
||||
}
|
||||
|
|
@ -307,7 +307,7 @@ eis_event_pointer_get_scroll_y(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
return event->pointer.sy;
|
||||
}
|
||||
|
|
@ -319,7 +319,7 @@ eis_event_pointer_get_scroll_discrete_x(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
return event->pointer.sdx;
|
||||
}
|
||||
|
|
@ -331,7 +331,7 @@ eis_event_pointer_get_scroll_discrete_y(struct eis_event *event)
|
|||
EIS_EVENT_POINTER_MOTION,
|
||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||
EIS_EVENT_POINTER_BUTTON,
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
return event->pointer.sdy;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ eis_event_type_to_string(enum eis_event_type type)
|
|||
CASE_RETURN_STRING(EIS_EVENT_POINTER_MOTION);
|
||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_MOTION_ABSOLUTE);
|
||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_BUTTON);
|
||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_SCROLL);
|
||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_SCROLL_DELTA);
|
||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_SCROLL_STOP);
|
||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_SCROLL_CANCEL);
|
||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
|
|
@ -144,7 +144,7 @@ update_event_timestamp(struct eis_event *event, uint64_t time)
|
|||
case EIS_EVENT_POINTER_MOTION:
|
||||
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
case EIS_EVENT_POINTER_BUTTON:
|
||||
case EIS_EVENT_POINTER_SCROLL:
|
||||
case EIS_EVENT_POINTER_SCROLL_DELTA:
|
||||
case EIS_EVENT_POINTER_SCROLL_STOP:
|
||||
case EIS_EVENT_POINTER_SCROLL_CANCEL:
|
||||
case EIS_EVENT_POINTER_SCROLL_DISCRETE:
|
||||
|
|
@ -180,7 +180,7 @@ eis_queue_event(struct eis_event *event)
|
|||
case EIS_EVENT_POINTER_MOTION:
|
||||
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
case EIS_EVENT_POINTER_BUTTON:
|
||||
case EIS_EVENT_POINTER_SCROLL:
|
||||
case EIS_EVENT_POINTER_SCROLL_DELTA:
|
||||
case EIS_EVENT_POINTER_SCROLL_STOP:
|
||||
case EIS_EVENT_POINTER_SCROLL_CANCEL:
|
||||
case EIS_EVENT_POINTER_SCROLL_DISCRETE:
|
||||
|
|
@ -315,7 +315,7 @@ eis_queue_pointer_scroll_event(struct eis_device *device,
|
|||
double x, double y)
|
||||
{
|
||||
struct eis_event *e = eis_event_new_for_device(device);
|
||||
e->type = EIS_EVENT_POINTER_SCROLL;
|
||||
e->type = EIS_EVENT_POINTER_SCROLL_DELTA;
|
||||
e->pointer.sx = x;
|
||||
e->pointer.sy = y;
|
||||
eis_queue_event(e);
|
||||
|
|
|
|||
16
src/libeis.h
16
src/libeis.h
|
|
@ -210,7 +210,7 @@ enum eis_event_type {
|
|||
* A vertical and/or horizontal scroll event with logical-pixels
|
||||
* or mm precision, depending on the device type.
|
||||
*/
|
||||
EIS_EVENT_POINTER_SCROLL,
|
||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
||||
/**
|
||||
* An ongoing scroll sequence stopped.
|
||||
*/
|
||||
|
|
@ -895,24 +895,24 @@ void
|
|||
eis_device_pointer_motion_absolute(struct eis_device *device,
|
||||
double x, double y);
|
||||
|
||||
/** see @ref ei_device_pointer_button */
|
||||
/** see @ref ei_device_button_button */
|
||||
void
|
||||
eis_device_pointer_button(struct eis_device *device,
|
||||
uint32_t button, bool is_press);
|
||||
|
||||
/** see @ref ei_device_pointer_scroll */
|
||||
/** see @ref ei_device_scroll_delta */
|
||||
void
|
||||
eis_device_pointer_scroll(struct eis_device *device, double x, double y);
|
||||
|
||||
/** see @ref ei_device_pointer_scroll_discrete */
|
||||
/** see @ref ei_device_scroll_discrete */
|
||||
void
|
||||
eis_device_pointer_scroll_discrete(struct eis_device *device, int32_t x, int32_t y);
|
||||
|
||||
/** see @ref ei_device_pointer_scroll_stop */
|
||||
/** see @ref ei_device_scroll_stop */
|
||||
void
|
||||
eis_device_pointer_scroll_stop(struct eis_device *device, bool stop_x, bool stop_y);
|
||||
|
||||
/** see @ref ei_device_pointer_scroll_cancel */
|
||||
/** see @ref ei_device_scroll_cancel */
|
||||
void
|
||||
eis_device_pointer_scroll_cancel(struct eis_device *device, bool cancel_x, bool cancel_y);
|
||||
|
||||
|
|
@ -1039,14 +1039,14 @@ bool
|
|||
eis_event_pointer_get_button_is_press(struct eis_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL return the x scroll
|
||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL_DELTA return the x scroll
|
||||
* distance in logical pixels or mm, depending on the device type.
|
||||
*/
|
||||
double
|
||||
eis_event_pointer_get_scroll_x(struct eis_event *event);
|
||||
|
||||
/**
|
||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL return the y scroll
|
||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL_DELTA return the y scroll
|
||||
* distance in logical pixels or mm, depending on the device type.
|
||||
*/
|
||||
double
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ struct peck {
|
|||
struct ei_device *ei_pointer;
|
||||
struct ei_device *ei_keyboard;
|
||||
struct ei_device *ei_abs;
|
||||
struct ei_device *ei_button;
|
||||
struct ei_device *ei_scroll;
|
||||
struct ei_device *ei_touch;
|
||||
|
||||
uint64_t now;
|
||||
|
|
@ -115,6 +117,8 @@ peck_destroy(struct peck *peck)
|
|||
ei_device_unref(peck->ei_abs);
|
||||
ei_device_unref(peck->ei_keyboard);
|
||||
ei_device_unref(peck->ei_touch);
|
||||
ei_device_unref(peck->ei_button);
|
||||
ei_device_unref(peck->ei_scroll);
|
||||
ei_seat_unref(peck->ei_seat);
|
||||
|
||||
ei_unref(peck->ei);
|
||||
|
|
@ -202,6 +206,20 @@ peck_ei_get_default_pointer_absolute(struct peck *peck)
|
|||
return peck->ei_abs;
|
||||
};
|
||||
|
||||
struct ei_device *
|
||||
peck_ei_get_default_button(struct peck *peck)
|
||||
{
|
||||
munit_assert_ptr_not_null(peck->ei_button);
|
||||
return peck->ei_button;
|
||||
};
|
||||
|
||||
struct ei_device *
|
||||
peck_ei_get_default_scroll(struct peck *peck)
|
||||
{
|
||||
munit_assert_ptr_not_null(peck->ei_scroll);
|
||||
return peck->ei_scroll;
|
||||
};
|
||||
|
||||
struct ei_device *
|
||||
peck_ei_get_default_keyboard(struct peck *peck)
|
||||
{
|
||||
|
|
@ -476,12 +494,16 @@ peck_enable_ei_behavior(struct peck *peck, enum peck_ei_behavior behavior)
|
|||
peck_enable_ei_behavior(peck, PECK_EI_BEHAVIOR_HANDLE_ADDED_POINTER_ABSOLUTE);
|
||||
peck_enable_ei_behavior(peck, PECK_EI_BEHAVIOR_HANDLE_ADDED_KEYBOARD);
|
||||
peck_enable_ei_behavior(peck, PECK_EI_BEHAVIOR_HANDLE_ADDED_TOUCH);
|
||||
peck_enable_ei_behavior(peck, PECK_EI_BEHAVIOR_HANDLE_ADDED_BUTTON);
|
||||
peck_enable_ei_behavior(peck, PECK_EI_BEHAVIOR_HANDLE_ADDED_SCROLL);
|
||||
break;
|
||||
case PECK_EI_BEHAVIOR_AUTOSTART:
|
||||
case PECK_EI_BEHAVIOR_HANDLE_ADDED_POINTER:
|
||||
case PECK_EI_BEHAVIOR_HANDLE_ADDED_POINTER_ABSOLUTE:
|
||||
case PECK_EI_BEHAVIOR_HANDLE_ADDED_KEYBOARD:
|
||||
case PECK_EI_BEHAVIOR_HANDLE_ADDED_TOUCH:
|
||||
case PECK_EI_BEHAVIOR_HANDLE_ADDED_BUTTON:
|
||||
case PECK_EI_BEHAVIOR_HANDLE_ADDED_SCROLL:
|
||||
case PECK_EI_BEHAVIOR_HANDLE_FRAME:
|
||||
flag_set(peck->ei_behavior, behavior);
|
||||
break;
|
||||
|
|
@ -744,7 +766,7 @@ _peck_dispatch_eis(struct peck *peck, int lineno)
|
|||
case EIS_EVENT_POINTER_MOTION:
|
||||
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
case EIS_EVENT_POINTER_BUTTON:
|
||||
case EIS_EVENT_POINTER_SCROLL:
|
||||
case EIS_EVENT_POINTER_SCROLL_DELTA:
|
||||
case EIS_EVENT_POINTER_SCROLL_STOP:
|
||||
case EIS_EVENT_POINTER_SCROLL_CANCEL:
|
||||
case EIS_EVENT_POINTER_SCROLL_DISCRETE:
|
||||
|
|
@ -826,6 +848,14 @@ peck_check_ei_added(struct peck *peck, struct ei_event *e)
|
|||
flag_is_set(peck->ei_behavior, PECK_EI_BEHAVIOR_HANDLE_ADDED_TOUCH))
|
||||
return tristate_yes;
|
||||
|
||||
if (ei_device_has_capability(device, EI_DEVICE_CAP_BUTTON) &
|
||||
flag_is_set(peck->ei_behavior, PECK_EI_BEHAVIOR_HANDLE_ADDED_BUTTON))
|
||||
return tristate_yes;
|
||||
|
||||
if (ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL) &
|
||||
flag_is_set(peck->ei_behavior, PECK_EI_BEHAVIOR_HANDLE_ADDED_SCROLL))
|
||||
return tristate_yes;
|
||||
|
||||
return tristate_unset;
|
||||
}
|
||||
|
||||
|
|
@ -889,11 +919,11 @@ _peck_dispatch_ei(struct peck *peck, int lineno)
|
|||
break;
|
||||
case EI_EVENT_POINTER_MOTION:
|
||||
case EI_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
case EI_EVENT_POINTER_BUTTON:
|
||||
case EI_EVENT_POINTER_SCROLL:
|
||||
case EI_EVENT_POINTER_SCROLL_STOP:
|
||||
case EI_EVENT_POINTER_SCROLL_CANCEL:
|
||||
case EI_EVENT_POINTER_SCROLL_DISCRETE:
|
||||
case EI_EVENT_BUTTON_BUTTON:
|
||||
case EI_EVENT_SCROLL_DELTA:
|
||||
case EI_EVENT_SCROLL_STOP:
|
||||
case EI_EVENT_SCROLL_CANCEL:
|
||||
case EI_EVENT_SCROLL_DISCRETE:
|
||||
case EI_EVENT_KEYBOARD_KEY:
|
||||
case EI_EVENT_KEYBOARD_MODIFIERS:
|
||||
case EI_EVENT_TOUCH_DOWN:
|
||||
|
|
@ -932,7 +962,9 @@ _peck_dispatch_ei(struct peck *peck, int lineno)
|
|||
EI_DEVICE_CAP_POINTER,
|
||||
EI_DEVICE_CAP_POINTER_ABSOLUTE,
|
||||
EI_DEVICE_CAP_KEYBOARD,
|
||||
EI_DEVICE_CAP_TOUCH, NULL);
|
||||
EI_DEVICE_CAP_TOUCH,
|
||||
EI_DEVICE_CAP_BUTTON,
|
||||
EI_DEVICE_CAP_SCROLL, NULL);
|
||||
break;
|
||||
}
|
||||
case EI_EVENT_DEVICE_ADDED:
|
||||
|
|
@ -946,6 +978,10 @@ _peck_dispatch_ei(struct peck *peck, int lineno)
|
|||
peck->ei_keyboard = ei_device_ref(device);
|
||||
if (ei_device_has_capability(device, EI_DEVICE_CAP_TOUCH))
|
||||
peck->ei_touch = ei_device_ref(device);
|
||||
if (ei_device_has_capability(device, EI_DEVICE_CAP_BUTTON))
|
||||
peck->ei_button = ei_device_ref(device);
|
||||
if (ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL))
|
||||
peck->ei_scroll = ei_device_ref(device);
|
||||
break;
|
||||
}
|
||||
case EI_EVENT_DEVICE_RESUMED:
|
||||
|
|
@ -1185,11 +1221,11 @@ peck_ei_event_type_name(enum ei_event_type type)
|
|||
CASE_STRING(DEVICE_STOP_EMULATING);
|
||||
CASE_STRING(POINTER_MOTION);
|
||||
CASE_STRING(POINTER_MOTION_ABSOLUTE);
|
||||
CASE_STRING(POINTER_BUTTON);
|
||||
CASE_STRING(POINTER_SCROLL);
|
||||
CASE_STRING(POINTER_SCROLL_STOP);
|
||||
CASE_STRING(POINTER_SCROLL_CANCEL);
|
||||
CASE_STRING(POINTER_SCROLL_DISCRETE);
|
||||
CASE_STRING(BUTTON_BUTTON);
|
||||
CASE_STRING(SCROLL_DELTA);
|
||||
CASE_STRING(SCROLL_STOP);
|
||||
CASE_STRING(SCROLL_CANCEL);
|
||||
CASE_STRING(SCROLL_DISCRETE);
|
||||
CASE_STRING(KEYBOARD_KEY);
|
||||
CASE_STRING(TOUCH_DOWN);
|
||||
CASE_STRING(TOUCH_UP);
|
||||
|
|
@ -1221,7 +1257,7 @@ peck_eis_event_type_name(enum eis_event_type type)
|
|||
CASE_STRING(POINTER_MOTION);
|
||||
CASE_STRING(POINTER_MOTION_ABSOLUTE);
|
||||
CASE_STRING(POINTER_BUTTON);
|
||||
CASE_STRING(POINTER_SCROLL);
|
||||
CASE_STRING(POINTER_SCROLL_DELTA);
|
||||
CASE_STRING(POINTER_SCROLL_STOP);
|
||||
CASE_STRING(POINTER_SCROLL_CANCEL);
|
||||
CASE_STRING(POINTER_SCROLL_DISCRETE);
|
||||
|
|
|
|||
|
|
@ -125,6 +125,8 @@ enum peck_ei_behavior {
|
|||
PECK_EI_BEHAVIOR_HANDLE_ADDED_POINTER_ABSOLUTE,
|
||||
PECK_EI_BEHAVIOR_HANDLE_ADDED_KEYBOARD,
|
||||
PECK_EI_BEHAVIOR_HANDLE_ADDED_TOUCH,
|
||||
PECK_EI_BEHAVIOR_HANDLE_ADDED_BUTTON,
|
||||
PECK_EI_BEHAVIOR_HANDLE_ADDED_SCROLL,
|
||||
|
||||
PECK_EI_BEHAVIOR_HANDLE_RESUMED,
|
||||
PECK_EI_BEHAVIOR_HANDLE_PAUSED,
|
||||
|
|
@ -189,6 +191,12 @@ peck_ei_get_default_seat(struct peck *peck);
|
|||
struct ei_device *
|
||||
peck_ei_get_default_pointer(struct peck *peck);
|
||||
|
||||
struct ei_device *
|
||||
peck_ei_get_default_button(struct peck *peck);
|
||||
|
||||
struct ei_device *
|
||||
peck_ei_get_default_scroll(struct peck *peck);
|
||||
|
||||
struct ei_device *
|
||||
peck_ei_get_default_keyboard(struct peck *peck);
|
||||
|
||||
|
|
|
|||
|
|
@ -559,7 +559,7 @@ MUNIT_TEST(test_ei_device_pointer_abs)
|
|||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
MUNIT_TEST(test_ei_device_pointer_scroll)
|
||||
MUNIT_TEST(test_ei_device_scroll)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new();
|
||||
|
||||
|
|
@ -570,9 +570,9 @@ MUNIT_TEST(test_ei_device_pointer_scroll)
|
|||
|
||||
with_client(peck) {
|
||||
struct ei_device *device = peck_ei_get_default_pointer(peck);
|
||||
ei_device_pointer_scroll(device, 1.1, 2.2);
|
||||
ei_device_scroll_delta(device, 1.1, 2.2);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_pointer_scroll_discrete(device, 3, 4);
|
||||
ei_device_scroll_discrete(device, 3, 4);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
}
|
||||
|
||||
|
|
@ -580,7 +580,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll)
|
|||
|
||||
with_server(peck) {
|
||||
_unref_(eis_event) *first =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL);
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
||||
munit_assert_double_equal(eis_event_pointer_get_scroll_x(first), 1.1, 2 /* precision */);
|
||||
munit_assert_double_equal(eis_event_pointer_get_scroll_y(first), 2.2, 2 /* precision */);
|
||||
|
||||
|
|
@ -593,7 +593,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll)
|
|||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
MUNIT_TEST(test_ei_device_pointer_scroll_stop)
|
||||
MUNIT_TEST(test_ei_device_scroll_stop)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new();
|
||||
|
||||
|
|
@ -604,26 +604,26 @@ MUNIT_TEST(test_ei_device_pointer_scroll_stop)
|
|||
|
||||
with_client(peck) {
|
||||
struct ei_device *device = peck_ei_get_default_pointer(peck);
|
||||
ei_device_pointer_scroll(device, 1.1, 2.2);
|
||||
ei_device_scroll_delta(device, 1.1, 2.2);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_pointer_scroll_stop(device, true, false);
|
||||
ei_device_scroll_stop(device, true, false);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_pointer_scroll_stop(device, false, true);
|
||||
ei_device_scroll_stop(device, false, true);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
|
||||
/* This should not generate an event */
|
||||
ei_device_pointer_scroll_stop(device, true, true);
|
||||
ei_device_scroll_stop(device, true, true);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
|
||||
/* But scrolling again will re-enable stopping */
|
||||
ei_device_pointer_scroll(device, 3.3, 4.4);
|
||||
ei_device_scroll_delta(device, 3.3, 4.4);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_pointer_scroll_stop(device, true, true);
|
||||
ei_device_scroll_stop(device, true, true);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
|
||||
ei_device_pointer_scroll(device, 3.3, 4.4);
|
||||
ei_device_scroll_delta(device, 3.3, 4.4);
|
||||
/* This one is a client bug and shouldn't trigger an event */
|
||||
ei_device_pointer_scroll_stop(device, false, false);
|
||||
ei_device_scroll_stop(device, false, false);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
}
|
||||
|
||||
|
|
@ -631,7 +631,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll_stop)
|
|||
|
||||
with_server(peck) {
|
||||
_unref_(eis_event) *scroll =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL);
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
||||
|
||||
_unref_(eis_event) *first =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_STOP);
|
||||
|
|
@ -646,7 +646,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll_stop)
|
|||
/* third one doesn't trigger an event */
|
||||
|
||||
_unref_(eis_event) *again =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL);
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
||||
|
||||
_unref_(eis_event) *fourth =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_STOP);
|
||||
|
|
@ -654,7 +654,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll_stop)
|
|||
munit_assert(eis_event_pointer_get_scroll_stop_y(fourth));
|
||||
|
||||
_unref_(eis_event) *again_again =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL);
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
||||
|
||||
peck_assert_no_eis_events(eis);
|
||||
}
|
||||
|
|
@ -662,7 +662,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll_stop)
|
|||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
MUNIT_TEST(test_ei_device_pointer_scroll_cancel)
|
||||
MUNIT_TEST(test_ei_device_scroll_cancel)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new();
|
||||
|
||||
|
|
@ -673,26 +673,26 @@ MUNIT_TEST(test_ei_device_pointer_scroll_cancel)
|
|||
|
||||
with_client(peck) {
|
||||
struct ei_device *device = peck_ei_get_default_pointer(peck);
|
||||
ei_device_pointer_scroll(device, 1.1, 2.2);
|
||||
ei_device_scroll_delta(device, 1.1, 2.2);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_pointer_scroll_cancel(device, true, false);
|
||||
ei_device_scroll_cancel(device, true, false);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_pointer_scroll_cancel(device, false, true);
|
||||
ei_device_scroll_cancel(device, false, true);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
|
||||
/* This should not generate an event */
|
||||
ei_device_pointer_scroll_cancel(device, true, true);
|
||||
ei_device_scroll_cancel(device, true, true);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
|
||||
/* But scrolling again will re-enable stopping */
|
||||
ei_device_pointer_scroll(device, 3.3, 4.4);
|
||||
ei_device_scroll_delta(device, 3.3, 4.4);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_pointer_scroll_cancel(device, true, true);
|
||||
ei_device_scroll_cancel(device, true, true);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
|
||||
ei_device_pointer_scroll(device, 3.3, 4.4);
|
||||
ei_device_scroll_delta(device, 3.3, 4.4);
|
||||
/* This one is a client bug and shouldn't trigger an event */
|
||||
ei_device_pointer_scroll_cancel(device, false, false);
|
||||
ei_device_scroll_cancel(device, false, false);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
}
|
||||
|
||||
|
|
@ -700,7 +700,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll_cancel)
|
|||
|
||||
with_server(peck) {
|
||||
_unref_(eis_event) *scroll =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL);
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
||||
|
||||
_unref_(eis_event) *first =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_CANCEL);
|
||||
|
|
@ -715,7 +715,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll_cancel)
|
|||
/* third one doesn't trigger an event */
|
||||
|
||||
_unref_(eis_event) *again =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL);
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
||||
|
||||
_unref_(eis_event) *fourth =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_CANCEL);
|
||||
|
|
@ -723,7 +723,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll_cancel)
|
|||
munit_assert(eis_event_pointer_get_scroll_stop_y(fourth));
|
||||
|
||||
_unref_(eis_event) *again_again =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL);
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
||||
|
||||
peck_assert_no_eis_events(eis);
|
||||
}
|
||||
|
|
@ -731,7 +731,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll_cancel)
|
|||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
MUNIT_TEST(test_ei_device_pointer_scroll_stop_cancel)
|
||||
MUNIT_TEST(test_ei_device_scroll_stop_cancel)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new();
|
||||
|
||||
|
|
@ -743,17 +743,17 @@ MUNIT_TEST(test_ei_device_pointer_scroll_stop_cancel)
|
|||
/* cancel after stop is fine, stop after cancel is ignored */
|
||||
with_client(peck) {
|
||||
struct ei_device *device = peck_ei_get_default_pointer(peck);
|
||||
ei_device_pointer_scroll(device, 1.1, 2.2);
|
||||
ei_device_scroll_delta(device, 1.1, 2.2);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_pointer_scroll_stop(device, true, false);
|
||||
ei_device_scroll_stop(device, true, false);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_pointer_scroll_cancel(device, true, false);
|
||||
ei_device_scroll_cancel(device, true, false);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
ei_device_pointer_scroll_cancel(device, false, true);
|
||||
ei_device_scroll_cancel(device, false, true);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
|
||||
/* This should not generate an event */
|
||||
ei_device_pointer_scroll_stop(device, true, true);
|
||||
ei_device_scroll_stop(device, true, true);
|
||||
ei_device_frame(device, peck_ei_now(peck));
|
||||
}
|
||||
|
||||
|
|
@ -761,7 +761,7 @@ MUNIT_TEST(test_ei_device_pointer_scroll_stop_cancel)
|
|||
|
||||
with_server(peck) {
|
||||
_unref_(eis_event) *scroll =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL);
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
||||
|
||||
_unref_(eis_event) *stop =
|
||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_STOP);
|
||||
|
|
@ -1633,8 +1633,8 @@ MUNIT_TEST(test_passive_ei_device_pointer_abs)
|
|||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
/* same as test_ei_device_pointer_scroll but for a passive context */
|
||||
MUNIT_TEST(test_passive_ei_device_pointer_scroll)
|
||||
/* same as test_ei_device_scroll_delta but for a passive context */
|
||||
MUNIT_TEST(test_passive_ei_device_scroll_delta)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER);
|
||||
|
||||
|
|
@ -1670,21 +1670,21 @@ MUNIT_TEST(test_passive_ei_device_pointer_scroll)
|
|||
|
||||
with_client(peck) {
|
||||
_unref_(ei_event) *first =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL);
|
||||
munit_assert_double_equal(ei_event_pointer_get_scroll_x(first), 1.1, 2 /* precision */);
|
||||
munit_assert_double_equal(ei_event_pointer_get_scroll_y(first), 2.2, 2 /* precision */);
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_DELTA);
|
||||
munit_assert_double_equal(ei_event_scroll_get_dx(first), 1.1, 2 /* precision */);
|
||||
munit_assert_double_equal(ei_event_scroll_get_dy(first), 2.2, 2 /* precision */);
|
||||
|
||||
_unref_(ei_event) *second =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
munit_assert_int(ei_event_pointer_get_scroll_discrete_x(second), ==, 3);
|
||||
munit_assert_int(ei_event_pointer_get_scroll_discrete_y(second), ==, 4);
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_DISCRETE);
|
||||
munit_assert_int(ei_event_scroll_get_discrete_dx(second), ==, 3);
|
||||
munit_assert_int(ei_event_scroll_get_discrete_dy(second), ==, 4);
|
||||
}
|
||||
|
||||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
/* same as test_ei_device_pointer_scroll_stop but for a passive context */
|
||||
MUNIT_TEST(test_passive_ei_device_pointer_scroll_stop)
|
||||
/* same as test_ei_device_scroll_stop but for a passive context */
|
||||
MUNIT_TEST(test_passive_ei_device_scroll_stop)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER);
|
||||
|
||||
|
|
@ -1737,30 +1737,30 @@ MUNIT_TEST(test_passive_ei_device_pointer_scroll_stop)
|
|||
|
||||
with_client(peck) {
|
||||
_unref_(ei_event) *scroll =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL);
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_DELTA);
|
||||
|
||||
_unref_(ei_event) *first =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL_STOP);
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_x(first));
|
||||
munit_assert(!ei_event_pointer_get_scroll_stop_y(first));
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_STOP);
|
||||
munit_assert(ei_event_scroll_get_stop_x(first));
|
||||
munit_assert(!ei_event_scroll_get_stop_y(first));
|
||||
|
||||
_unref_(ei_event) *second =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL_STOP);
|
||||
munit_assert(!ei_event_pointer_get_scroll_stop_x(second));
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_y(second));
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_STOP);
|
||||
munit_assert(!ei_event_scroll_get_stop_x(second));
|
||||
munit_assert(ei_event_scroll_get_stop_y(second));
|
||||
|
||||
/* third one doesn't trigger an event */
|
||||
|
||||
_unref_(ei_event) *again =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL);
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_DELTA);
|
||||
|
||||
_unref_(ei_event) *fourth =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL_STOP);
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_x(fourth));
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_y(fourth));
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_STOP);
|
||||
munit_assert(ei_event_scroll_get_stop_x(fourth));
|
||||
munit_assert(ei_event_scroll_get_stop_y(fourth));
|
||||
|
||||
_unref_(ei_event) *again_again =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL);
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_DELTA);
|
||||
|
||||
peck_assert_no_ei_events(ei);
|
||||
}
|
||||
|
|
@ -1768,8 +1768,8 @@ MUNIT_TEST(test_passive_ei_device_pointer_scroll_stop)
|
|||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
/* same as test_ei_device_pointer_scroll_cancel but for a passive context */
|
||||
MUNIT_TEST(test_passive_ei_device_pointer_scroll_cancel)
|
||||
/* same as test_ei_device_scroll_cancel but for a passive context */
|
||||
MUNIT_TEST(test_passive_ei_device_scroll_cancel)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER);
|
||||
|
||||
|
|
@ -1822,30 +1822,30 @@ MUNIT_TEST(test_passive_ei_device_pointer_scroll_cancel)
|
|||
|
||||
with_client(peck) {
|
||||
_unref_(ei_event) *scroll =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL);
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_DELTA);
|
||||
|
||||
_unref_(ei_event) *first =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL_CANCEL);
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_x(first));
|
||||
munit_assert(!ei_event_pointer_get_scroll_stop_y(first));
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_CANCEL);
|
||||
munit_assert(ei_event_scroll_get_stop_x(first));
|
||||
munit_assert(!ei_event_scroll_get_stop_y(first));
|
||||
|
||||
_unref_(ei_event) *second =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL_CANCEL);
|
||||
munit_assert(!ei_event_pointer_get_scroll_stop_x(second));
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_y(second));
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_CANCEL);
|
||||
munit_assert(!ei_event_scroll_get_stop_x(second));
|
||||
munit_assert(ei_event_scroll_get_stop_y(second));
|
||||
|
||||
/* third one doesn't trigger an event */
|
||||
|
||||
_unref_(ei_event) *again =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL);
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_DELTA);
|
||||
|
||||
_unref_(ei_event) *fourth =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL_CANCEL);
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_x(fourth));
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_y(fourth));
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_CANCEL);
|
||||
munit_assert(ei_event_scroll_get_stop_x(fourth));
|
||||
munit_assert(ei_event_scroll_get_stop_y(fourth));
|
||||
|
||||
_unref_(ei_event) *again_again =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL);
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_DELTA);
|
||||
|
||||
peck_assert_no_ei_events(ei);
|
||||
}
|
||||
|
|
@ -1853,8 +1853,8 @@ MUNIT_TEST(test_passive_ei_device_pointer_scroll_cancel)
|
|||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
/* same as test_ei_device_pointer_scroll_stop_cancel but for a passive context */
|
||||
MUNIT_TEST(test_passive_ei_device_pointer_scroll_stop_cancel)
|
||||
/* same as test_ei_device_scroll_stop_cancel but for a passive context */
|
||||
MUNIT_TEST(test_passive_ei_device_scroll_stop_cancel)
|
||||
{
|
||||
_unref_(peck) *peck = peck_new_context(PECK_EI_RECEIVER);
|
||||
|
||||
|
|
@ -1903,22 +1903,22 @@ MUNIT_TEST(test_passive_ei_device_pointer_scroll_stop_cancel)
|
|||
|
||||
with_client(peck) {
|
||||
_unref_(ei_event) *scroll =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL);
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_DELTA);
|
||||
|
||||
_unref_(ei_event) *stop =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL_STOP);
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_x(stop));
|
||||
munit_assert(!ei_event_pointer_get_scroll_stop_y(stop));
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_STOP);
|
||||
munit_assert(ei_event_scroll_get_stop_x(stop));
|
||||
munit_assert(!ei_event_scroll_get_stop_y(stop));
|
||||
|
||||
_unref_(ei_event) *first =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL_CANCEL);
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_x(first));
|
||||
munit_assert(!ei_event_pointer_get_scroll_stop_y(first));
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_CANCEL);
|
||||
munit_assert(ei_event_scroll_get_stop_x(first));
|
||||
munit_assert(!ei_event_scroll_get_stop_y(first));
|
||||
|
||||
_unref_(ei_event) *second =
|
||||
peck_ei_next_event(ei, EI_EVENT_POINTER_SCROLL_CANCEL);
|
||||
munit_assert(!ei_event_pointer_get_scroll_stop_x(second));
|
||||
munit_assert(ei_event_pointer_get_scroll_stop_y(second));
|
||||
peck_ei_next_event(ei, EI_EVENT_SCROLL_CANCEL);
|
||||
munit_assert(!ei_event_scroll_get_stop_x(second));
|
||||
munit_assert(ei_event_scroll_get_stop_y(second));
|
||||
|
||||
/* third one doesn't trigger an event */
|
||||
peck_assert_no_ei_events(ei);
|
||||
|
|
|
|||
|
|
@ -100,11 +100,11 @@ event_type(enum ei_event_type type)
|
|||
CASE_RETURN_STRING(EI_EVENT_DEVICE_STOP_EMULATING);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_MOTION);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_MOTION_ABSOLUTE);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_BUTTON);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_SCROLL);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_SCROLL_STOP);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_SCROLL_CANCEL);
|
||||
CASE_RETURN_STRING(EI_EVENT_POINTER_SCROLL_DISCRETE);
|
||||
CASE_RETURN_STRING(EI_EVENT_BUTTON_BUTTON);
|
||||
CASE_RETURN_STRING(EI_EVENT_SCROLL_DELTA);
|
||||
CASE_RETURN_STRING(EI_EVENT_SCROLL_STOP);
|
||||
CASE_RETURN_STRING(EI_EVENT_SCROLL_CANCEL);
|
||||
CASE_RETURN_STRING(EI_EVENT_SCROLL_DISCRETE);
|
||||
CASE_RETURN_STRING(EI_EVENT_KEYBOARD_KEY);
|
||||
CASE_RETURN_STRING(EI_EVENT_TOUCH_DOWN);
|
||||
CASE_RETURN_STRING(EI_EVENT_TOUCH_UP);
|
||||
|
|
@ -239,8 +239,8 @@ print_button_event(struct ei_event *event)
|
|||
{
|
||||
print_device(event);
|
||||
|
||||
uint32_t button = ei_event_pointer_get_button(event);
|
||||
bool press = ei_event_pointer_get_button_is_press(event);
|
||||
uint32_t button = ei_event_button_get_button(event);
|
||||
bool press = ei_event_button_get_is_press(event);
|
||||
|
||||
printf(" button: %u # %s\n", button, libevdev_event_code_get_name(EV_KEY, button));
|
||||
printf(" press: %s\n", press ? "true" : "false");
|
||||
|
|
@ -279,8 +279,8 @@ print_scroll_event(struct ei_event *event)
|
|||
{
|
||||
print_device(event);
|
||||
|
||||
double x = ei_event_pointer_get_scroll_x(event);
|
||||
double y = ei_event_pointer_get_scroll_y(event);
|
||||
double x = ei_event_scroll_get_dx(event);
|
||||
double y = ei_event_scroll_get_dy(event);
|
||||
|
||||
printf(" scroll: [%f, %f]\n", x, y);
|
||||
}
|
||||
|
|
@ -290,8 +290,8 @@ print_scroll_discrete_event(struct ei_event *event)
|
|||
{
|
||||
print_device(event);
|
||||
|
||||
int32_t x = ei_event_pointer_get_scroll_discrete_x(event);
|
||||
int32_t y = ei_event_pointer_get_scroll_discrete_y(event);
|
||||
int32_t x = ei_event_scroll_get_discrete_dx(event);
|
||||
int32_t y = ei_event_scroll_get_discrete_dy(event);
|
||||
|
||||
printf(" scroll: [%d, %d]\n", x, y);
|
||||
}
|
||||
|
|
@ -301,8 +301,8 @@ print_scroll_stop_event(struct ei_event *event)
|
|||
{
|
||||
print_device(event);
|
||||
|
||||
bool x = ei_event_pointer_get_scroll_stop_x(event);
|
||||
bool y = ei_event_pointer_get_scroll_stop_y(event);
|
||||
bool x = ei_event_scroll_get_stop_x(event);
|
||||
bool y = ei_event_scroll_get_stop_y(event);
|
||||
|
||||
printf(" scroll: [%s, %s]\n", truefalse(x), truefalse(y));
|
||||
}
|
||||
|
|
@ -448,7 +448,7 @@ int main(int argc, char **argv)
|
|||
case EI_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
print_abs_event(e);
|
||||
break;
|
||||
case EI_EVENT_POINTER_BUTTON:
|
||||
case EI_EVENT_BUTTON_BUTTON:
|
||||
print_button_event(e);
|
||||
break;
|
||||
case EI_EVENT_KEYBOARD_KEY:
|
||||
|
|
@ -459,14 +459,14 @@ int main(int argc, char **argv)
|
|||
case EI_EVENT_TOUCH_UP:
|
||||
print_touch_event(e);
|
||||
break;
|
||||
case EI_EVENT_POINTER_SCROLL:
|
||||
case EI_EVENT_SCROLL_DELTA:
|
||||
print_scroll_event(e);
|
||||
break;
|
||||
case EI_EVENT_POINTER_SCROLL_DISCRETE:
|
||||
case EI_EVENT_SCROLL_DISCRETE:
|
||||
print_scroll_discrete_event(e);
|
||||
break;
|
||||
case EI_EVENT_POINTER_SCROLL_STOP:
|
||||
case EI_EVENT_POINTER_SCROLL_CANCEL:
|
||||
case EI_EVENT_SCROLL_STOP:
|
||||
case EI_EVENT_SCROLL_CANCEL:
|
||||
print_scroll_stop_event(e);
|
||||
break;
|
||||
case EI_EVENT_KEYBOARD_MODIFIERS:
|
||||
|
|
|
|||
|
|
@ -431,25 +431,25 @@ int main(int argc, char **argv)
|
|||
ei_event_pointer_get_absolute_y(e));
|
||||
}
|
||||
break;
|
||||
case EI_EVENT_POINTER_BUTTON:
|
||||
case EI_EVENT_BUTTON_BUTTON:
|
||||
{
|
||||
colorprint("button %u (%s)\n",
|
||||
ei_event_pointer_get_button(e),
|
||||
ei_event_pointer_get_button_is_press(e) ? "press" : "release");
|
||||
ei_event_button_get_button(e),
|
||||
ei_event_button_get_is_press(e) ? "press" : "release");
|
||||
}
|
||||
break;
|
||||
case EI_EVENT_POINTER_SCROLL:
|
||||
case EI_EVENT_SCROLL_DELTA:
|
||||
{
|
||||
colorprint("scroll %.2f/%.2f\n",
|
||||
ei_event_pointer_get_scroll_x(e),
|
||||
ei_event_pointer_get_scroll_y(e));
|
||||
ei_event_scroll_get_dx(e),
|
||||
ei_event_scroll_get_dy(e));
|
||||
}
|
||||
break;
|
||||
case EI_EVENT_POINTER_SCROLL_DISCRETE:
|
||||
case EI_EVENT_SCROLL_DISCRETE:
|
||||
{
|
||||
colorprint("scroll discrete %d/%d\n",
|
||||
ei_event_pointer_get_scroll_discrete_x(e),
|
||||
ei_event_pointer_get_scroll_discrete_y(e));
|
||||
ei_event_scroll_get_discrete_dx(e),
|
||||
ei_event_scroll_get_discrete_dy(e));
|
||||
}
|
||||
break;
|
||||
case EI_EVENT_KEYBOARD_KEY:
|
||||
|
|
@ -492,17 +492,17 @@ int main(int argc, char **argv)
|
|||
ei_device_pointer_motion(ptr, -1, 1);
|
||||
/* BTN_LEFT */
|
||||
colorprint("sending button event\n");
|
||||
ei_device_pointer_button(ptr, BTN_LEFT, true);
|
||||
ei_device_button_button(ptr, BTN_LEFT, true);
|
||||
ei_device_frame(ptr, now);
|
||||
now += interval;
|
||||
ei_device_pointer_button(ptr, BTN_LEFT, false);
|
||||
ei_device_button_button(ptr, BTN_LEFT, false);
|
||||
ei_device_frame(ptr, now);
|
||||
now += interval;
|
||||
colorprint("sending scroll events\n");
|
||||
ei_device_pointer_scroll(ptr, 1, 1);
|
||||
ei_device_scroll_delta(ptr, 1, 1);
|
||||
ei_device_frame(ptr, now);
|
||||
now += interval;
|
||||
ei_device_pointer_scroll_discrete(ptr, 1, 1);
|
||||
ei_device_scroll_discrete(ptr, 1, 1);
|
||||
ei_device_frame(ptr, now);
|
||||
now += interval;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ eis_demo_server_printf_handle_event(struct eis_demo_server *server,
|
|||
eis_event_pointer_get_button_is_press(e) ? "press" : "release");
|
||||
}
|
||||
break;
|
||||
case EIS_EVENT_POINTER_SCROLL:
|
||||
case EIS_EVENT_POINTER_SCROLL_DELTA:
|
||||
{
|
||||
colorprint("scroll %.2f/%.2f\n",
|
||||
eis_event_pointer_get_scroll_x(e),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue