mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2025-12-20 15:00:06 +01:00
eis: change the API to match the protocol interfaces closer
Same as the corresponding ei change a few commits ago, this one does all the EIS renaming in the same manner. As with the libei changes, an EIS implementation must now handle the EIS_DEVICE_CAP_BUTTON and EI_DEVICE_CAP_SCROLL capabilities. In virtually all cases, clients will likely expect that a device with the pointer or absolute pointer capabilities will also have button and scroll capabilities.
This commit is contained in:
parent
da37da1308
commit
e6954b76d3
11 changed files with 288 additions and 235 deletions
|
|
@ -160,6 +160,8 @@ eis_client_has_capability(struct eis_client *client,
|
||||||
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
||||||
case EIS_DEVICE_CAP_KEYBOARD:
|
case EIS_DEVICE_CAP_KEYBOARD:
|
||||||
case EIS_DEVICE_CAP_TOUCH:
|
case EIS_DEVICE_CAP_TOUCH:
|
||||||
|
case EIS_DEVICE_CAP_BUTTON:
|
||||||
|
case EIS_DEVICE_CAP_SCROLL:
|
||||||
return mask_all(client->restrictions.cap_allow_mask, cap);
|
return mask_all(client->restrictions.cap_allow_mask, cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -392,10 +392,9 @@ client_msg_button(struct eis_button *button, uint32_t btn, uint32_t state)
|
||||||
|
|
||||||
DISCONNECT_IF_RECEIVER_CONTEXT(device);
|
DISCONNECT_IF_RECEIVER_CONTEXT(device);
|
||||||
|
|
||||||
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_BUTTON)) {
|
||||||
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER)) {
|
|
||||||
return brei_result_new(EIS_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
return brei_result_new(EIS_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
||||||
"Pointer button event for non-pointer device");
|
"Button event for non-button device");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->state == EIS_DEVICE_STATE_EMULATING) {
|
if (device->state == EIS_DEVICE_STATE_EMULATING) {
|
||||||
|
|
@ -413,10 +412,9 @@ client_msg_scroll(struct eis_scroll *scroll, float x, float y)
|
||||||
|
|
||||||
DISCONNECT_IF_RECEIVER_CONTEXT(device);
|
DISCONNECT_IF_RECEIVER_CONTEXT(device);
|
||||||
|
|
||||||
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
|
||||||
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER)) {
|
|
||||||
return brei_result_new(EIS_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
return brei_result_new(EIS_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
||||||
"Pointer scroll event for non-pointer device");
|
"Scroll event for non-scroll device");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->state == EIS_DEVICE_STATE_EMULATING) {
|
if (device->state == EIS_DEVICE_STATE_EMULATING) {
|
||||||
|
|
@ -434,10 +432,9 @@ client_msg_scroll_discrete(struct eis_scroll *scroll, int32_t x, int32_t y)
|
||||||
|
|
||||||
DISCONNECT_IF_RECEIVER_CONTEXT(device);
|
DISCONNECT_IF_RECEIVER_CONTEXT(device);
|
||||||
|
|
||||||
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
|
||||||
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER)) {
|
|
||||||
return brei_result_new(EIS_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
return brei_result_new(EIS_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
||||||
"Pointer scroll discrete event for non-pointer device");
|
"Scroll discrete event for non-scroll device");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->state == EIS_DEVICE_STATE_EMULATING) {
|
if (device->state == EIS_DEVICE_STATE_EMULATING) {
|
||||||
|
|
@ -456,10 +453,9 @@ client_msg_scroll_stop(struct eis_scroll *scroll,
|
||||||
|
|
||||||
DISCONNECT_IF_RECEIVER_CONTEXT(device);
|
DISCONNECT_IF_RECEIVER_CONTEXT(device);
|
||||||
|
|
||||||
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
|
||||||
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER)) {
|
|
||||||
return brei_result_new(EIS_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
return brei_result_new(EIS_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
||||||
"Pointer scroll stop event for non-pointer device");
|
"Scroll stop event for non-scroll device");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->state == EIS_DEVICE_STATE_EMULATING) {
|
if (device->state == EIS_DEVICE_STATE_EMULATING) {
|
||||||
|
|
@ -753,6 +749,8 @@ eis_device_configure_capability(struct eis_device *device, enum eis_device_capab
|
||||||
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
||||||
case EIS_DEVICE_CAP_KEYBOARD:
|
case EIS_DEVICE_CAP_KEYBOARD:
|
||||||
case EIS_DEVICE_CAP_TOUCH:
|
case EIS_DEVICE_CAP_TOUCH:
|
||||||
|
case EIS_DEVICE_CAP_BUTTON:
|
||||||
|
case EIS_DEVICE_CAP_SCROLL:
|
||||||
mask_add(device->capabilities, cap);
|
mask_add(device->capabilities, cap);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -822,7 +820,6 @@ eis_device_add(struct eis_device *device)
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
if (eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
||||||
device->pointer_absolute = eis_pointer_absolute_new(device);
|
device->pointer_absolute = eis_pointer_absolute_new(device);
|
||||||
rc = eis_device_event_interface(device, eis_pointer_absolute_get_id(device->pointer_absolute),
|
rc = eis_device_event_interface(device, eis_pointer_absolute_get_id(device->pointer_absolute),
|
||||||
|
|
@ -831,16 +828,15 @@ eis_device_add(struct eis_device *device)
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
if (eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
|
||||||
if (eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) ||
|
|
||||||
eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
|
||||||
device->scroll = eis_scroll_new(device);
|
device->scroll = eis_scroll_new(device);
|
||||||
rc = eis_device_event_interface(device, eis_scroll_get_id(device->scroll),
|
rc = eis_device_event_interface(device, eis_scroll_get_id(device->scroll),
|
||||||
EIS_SCROLL_INTERFACE_NAME,
|
EIS_SCROLL_INTERFACE_NAME,
|
||||||
eis_scroll_get_version(device->scroll));
|
eis_scroll_get_version(device->scroll));
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
if (eis_device_has_capability(device, EIS_DEVICE_CAP_BUTTON)) {
|
||||||
device->button = eis_button_new(device);
|
device->button = eis_button_new(device);
|
||||||
rc = eis_device_event_interface(device, eis_button_get_id(device->button),
|
rc = eis_device_event_interface(device, eis_button_get_id(device->button),
|
||||||
EIS_BUTTON_INTERFACE_NAME,
|
EIS_BUTTON_INTERFACE_NAME,
|
||||||
|
|
@ -935,6 +931,8 @@ eis_device_has_capability(struct eis_device *device,
|
||||||
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
||||||
case EIS_DEVICE_CAP_KEYBOARD:
|
case EIS_DEVICE_CAP_KEYBOARD:
|
||||||
case EIS_DEVICE_CAP_TOUCH:
|
case EIS_DEVICE_CAP_TOUCH:
|
||||||
|
case EIS_DEVICE_CAP_BUTTON:
|
||||||
|
case EIS_DEVICE_CAP_SCROLL:
|
||||||
return mask_all(device->capabilities, cap);
|
return mask_all(device->capabilities, cap);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1033,12 +1031,12 @@ eis_device_pointer_motion_absolute(struct eis_device *device,
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ void
|
_public_ void
|
||||||
eis_device_pointer_button(struct eis_device *device,
|
eis_device_button_button(struct eis_device *device,
|
||||||
uint32_t button, bool is_press)
|
uint32_t button, bool is_press)
|
||||||
{
|
{
|
||||||
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER)) {
|
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_BUTTON)) {
|
||||||
log_bug_client(eis_device_get_context(device),
|
log_bug_client(eis_device_get_context(device),
|
||||||
"%s: device is not a pointer", __func__);
|
"%s: device is not a button device", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1072,13 +1070,11 @@ eis_device_resume_scrolling(struct eis_device *device, double x, double y)
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ void
|
_public_ void
|
||||||
eis_device_pointer_scroll(struct eis_device *device,
|
eis_device_scroll_delta(struct eis_device *device, double x, double y)
|
||||||
double x, double y)
|
|
||||||
{
|
{
|
||||||
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
|
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
|
||||||
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
|
||||||
log_bug_client(eis_device_get_context(device),
|
log_bug_client(eis_device_get_context(device),
|
||||||
"%s: device is not a (absolute) pointer", __func__);
|
"%s: device is not a scroll device", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->state != EIS_DEVICE_STATE_EMULATING)
|
if (device->state != EIS_DEVICE_STATE_EMULATING)
|
||||||
|
|
@ -1092,13 +1088,13 @@ eis_device_pointer_scroll(struct eis_device *device,
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ void
|
_public_ void
|
||||||
eis_device_pointer_scroll_stop(struct eis_device *device, bool x, bool y)
|
eis_device_scroll_stop(struct eis_device *device, bool x, bool y)
|
||||||
{
|
{
|
||||||
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
|
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
|
||||||
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
|
||||||
log_bug_client(eis_device_get_context(device),
|
log_bug_client(eis_device_get_context(device),
|
||||||
"%s: device is not a (absolute) pointer", __func__);
|
"%s: device is not a scroll device", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->state != EIS_DEVICE_STATE_EMULATING)
|
if (device->state != EIS_DEVICE_STATE_EMULATING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1120,13 +1116,13 @@ eis_device_pointer_scroll_stop(struct eis_device *device, bool x, bool y)
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ void
|
_public_ void
|
||||||
eis_device_pointer_scroll_cancel(struct eis_device *device, bool x, bool y)
|
eis_device_scroll_cancel(struct eis_device *device, bool x, bool y)
|
||||||
{
|
{
|
||||||
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
|
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
|
||||||
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
|
||||||
log_bug_client(eis_device_get_context(device),
|
log_bug_client(eis_device_get_context(device),
|
||||||
"%s: device is not a (absolute) pointer", __func__);
|
"%s: device is not a scroll device", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->state != EIS_DEVICE_STATE_EMULATING)
|
if (device->state != EIS_DEVICE_STATE_EMULATING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1152,13 +1148,11 @@ eis_device_pointer_scroll_cancel(struct eis_device *device, bool x, bool y)
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ void
|
_public_ void
|
||||||
eis_device_pointer_scroll_discrete(struct eis_device *device,
|
eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y)
|
||||||
int32_t x, int32_t y)
|
|
||||||
{
|
{
|
||||||
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER) &&
|
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
|
||||||
!eis_device_has_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE)) {
|
|
||||||
log_bug_client(eis_device_get_context(device),
|
log_bug_client(eis_device_get_context(device),
|
||||||
"%s: device is not a (absolute) pointer", __func__);
|
"%s: device is not a scroll device", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->state != EIS_DEVICE_STATE_EMULATING)
|
if (device->state != EIS_DEVICE_STATE_EMULATING)
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ eis_event_destroy(struct eis_event *event)
|
||||||
case EIS_EVENT_DEVICE_CLOSED:
|
case EIS_EVENT_DEVICE_CLOSED:
|
||||||
case EIS_EVENT_DEVICE_START_EMULATING:
|
case EIS_EVENT_DEVICE_START_EMULATING:
|
||||||
case EIS_EVENT_DEVICE_STOP_EMULATING:
|
case EIS_EVENT_DEVICE_STOP_EMULATING:
|
||||||
case EIS_EVENT_POINTER_BUTTON:
|
case EIS_EVENT_BUTTON_BUTTON:
|
||||||
case EIS_EVENT_POINTER_MOTION:
|
case EIS_EVENT_POINTER_MOTION:
|
||||||
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||||
case EIS_EVENT_POINTER_SCROLL_DELTA:
|
case EIS_EVENT_SCROLL_DELTA:
|
||||||
case EIS_EVENT_POINTER_SCROLL_STOP:
|
case EIS_EVENT_SCROLL_STOP:
|
||||||
case EIS_EVENT_POINTER_SCROLL_CANCEL:
|
case EIS_EVENT_SCROLL_CANCEL:
|
||||||
case EIS_EVENT_POINTER_SCROLL_DISCRETE:
|
case EIS_EVENT_SCROLL_DISCRETE:
|
||||||
case EIS_EVENT_KEYBOARD_KEY:
|
case EIS_EVENT_KEYBOARD_KEY:
|
||||||
case EIS_EVENT_TOUCH_DOWN:
|
case EIS_EVENT_TOUCH_DOWN:
|
||||||
case EIS_EVENT_TOUCH_MOTION:
|
case EIS_EVENT_TOUCH_MOTION:
|
||||||
|
|
@ -173,11 +173,11 @@ eis_event_get_time(struct eis_event *event)
|
||||||
require_event_type(event, 0,
|
require_event_type(event, 0,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_STOP,
|
EIS_EVENT_SCROLL_STOP,
|
||||||
EIS_EVENT_POINTER_SCROLL_CANCEL,
|
EIS_EVENT_SCROLL_CANCEL,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE,
|
EIS_EVENT_SCROLL_DISCRETE,
|
||||||
EIS_EVENT_KEYBOARD_KEY,
|
EIS_EVENT_KEYBOARD_KEY,
|
||||||
EIS_EVENT_TOUCH_DOWN,
|
EIS_EVENT_TOUCH_DOWN,
|
||||||
EIS_EVENT_TOUCH_UP,
|
EIS_EVENT_TOUCH_UP,
|
||||||
|
|
@ -197,6 +197,8 @@ eis_event_seat_has_capability(struct eis_event *event, enum eis_device_capabilit
|
||||||
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
||||||
case EIS_DEVICE_CAP_KEYBOARD:
|
case EIS_DEVICE_CAP_KEYBOARD:
|
||||||
case EIS_DEVICE_CAP_TOUCH:
|
case EIS_DEVICE_CAP_TOUCH:
|
||||||
|
case EIS_DEVICE_CAP_BUTTON:
|
||||||
|
case EIS_DEVICE_CAP_SCROLL:
|
||||||
return mask_all(event->bind.capabilities, cap);
|
return mask_all(event->bind.capabilities, cap);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -216,9 +218,9 @@ eis_event_pointer_get_dx(struct eis_event *event)
|
||||||
require_event_type(event, 0.0,
|
require_event_type(event, 0.0,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
EIS_EVENT_SCROLL_DISCRETE);
|
||||||
|
|
||||||
return event->pointer.dx;
|
return event->pointer.dx;
|
||||||
}
|
}
|
||||||
|
|
@ -229,9 +231,9 @@ eis_event_pointer_get_dy(struct eis_event *event)
|
||||||
require_event_type(event, 0.0,
|
require_event_type(event, 0.0,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
EIS_EVENT_SCROLL_DISCRETE);
|
||||||
|
|
||||||
return event->pointer.dy;
|
return event->pointer.dy;
|
||||||
}
|
}
|
||||||
|
|
@ -242,9 +244,9 @@ eis_event_pointer_get_absolute_x(struct eis_event *event)
|
||||||
require_event_type(event, 0.0,
|
require_event_type(event, 0.0,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
EIS_EVENT_SCROLL_DISCRETE);
|
||||||
|
|
||||||
return event->pointer.absx;
|
return event->pointer.absx;
|
||||||
}
|
}
|
||||||
|
|
@ -255,102 +257,102 @@ eis_event_pointer_get_absolute_y(struct eis_event *event)
|
||||||
require_event_type(event, 0.0,
|
require_event_type(event, 0.0,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
EIS_EVENT_SCROLL_DISCRETE);
|
||||||
|
|
||||||
return event->pointer.absy;
|
return event->pointer.absy;
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ uint32_t
|
_public_ uint32_t
|
||||||
eis_event_pointer_get_button(struct eis_event *event)
|
eis_event_button_get_button(struct eis_event *event)
|
||||||
{
|
{
|
||||||
require_event_type(event, 0,
|
require_event_type(event, 0,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
EIS_EVENT_SCROLL_DISCRETE);
|
||||||
|
|
||||||
return event->pointer.button;
|
return event->pointer.button;
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ bool
|
_public_ bool
|
||||||
eis_event_pointer_get_button_is_press(struct eis_event *event)
|
eis_event_button_get_is_press(struct eis_event *event)
|
||||||
{
|
{
|
||||||
require_event_type(event, false,
|
require_event_type(event, false,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
EIS_EVENT_SCROLL_DISCRETE);
|
||||||
|
|
||||||
return event->pointer.button_is_press;
|
return event->pointer.button_is_press;
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ double
|
_public_ double
|
||||||
eis_event_pointer_get_scroll_x(struct eis_event *event)
|
eis_event_scroll_get_dx(struct eis_event *event)
|
||||||
{
|
{
|
||||||
require_event_type(event, 0,
|
require_event_type(event, 0,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
EIS_EVENT_SCROLL_DISCRETE);
|
||||||
return event->pointer.sx;
|
return event->pointer.sx;
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ double
|
_public_ double
|
||||||
eis_event_pointer_get_scroll_y(struct eis_event *event)
|
eis_event_scroll_get_dy(struct eis_event *event)
|
||||||
{
|
{
|
||||||
require_event_type(event, 0,
|
require_event_type(event, 0,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
EIS_EVENT_SCROLL_DISCRETE);
|
||||||
return event->pointer.sy;
|
return event->pointer.sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ int32_t
|
_public_ int32_t
|
||||||
eis_event_pointer_get_scroll_discrete_x(struct eis_event *event)
|
eis_event_scroll_get_discrete_dx(struct eis_event *event)
|
||||||
{
|
{
|
||||||
require_event_type(event, 0,
|
require_event_type(event, 0,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
EIS_EVENT_SCROLL_DISCRETE);
|
||||||
return event->pointer.sdx;
|
return event->pointer.sdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ int32_t
|
_public_ int32_t
|
||||||
eis_event_pointer_get_scroll_discrete_y(struct eis_event *event)
|
eis_event_scroll_get_discrete_dy(struct eis_event *event)
|
||||||
{
|
{
|
||||||
require_event_type(event, 0,
|
require_event_type(event, 0,
|
||||||
EIS_EVENT_POINTER_MOTION,
|
EIS_EVENT_POINTER_MOTION,
|
||||||
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
EIS_EVENT_POINTER_MOTION_ABSOLUTE,
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
EIS_EVENT_SCROLL_DISCRETE);
|
||||||
return event->pointer.sdy;
|
return event->pointer.sdy;
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ bool
|
_public_ bool
|
||||||
eis_event_pointer_get_scroll_stop_x(struct eis_event *event)
|
eis_event_scroll_get_stop_x(struct eis_event *event)
|
||||||
{
|
{
|
||||||
require_event_type(event, 0,
|
require_event_type(event, 0,
|
||||||
EIS_EVENT_POINTER_SCROLL_STOP,
|
EIS_EVENT_SCROLL_STOP,
|
||||||
EIS_EVENT_POINTER_SCROLL_CANCEL);
|
EIS_EVENT_SCROLL_CANCEL);
|
||||||
return event->pointer.stop_x;
|
return event->pointer.stop_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ bool
|
_public_ bool
|
||||||
eis_event_pointer_get_scroll_stop_y(struct eis_event *event)
|
eis_event_scroll_get_stop_y(struct eis_event *event)
|
||||||
{
|
{
|
||||||
require_event_type(event, 0,
|
require_event_type(event, 0,
|
||||||
EIS_EVENT_POINTER_SCROLL_STOP,
|
EIS_EVENT_SCROLL_STOP,
|
||||||
EIS_EVENT_POINTER_SCROLL_CANCEL);
|
EIS_EVENT_SCROLL_CANCEL);
|
||||||
return event->pointer.stop_y;
|
return event->pointer.stop_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,9 +104,10 @@ client_msg_bind(struct eis_seat *seat, uint64_t caps)
|
||||||
capabilities |= EIS_DEVICE_CAP_KEYBOARD;
|
capabilities |= EIS_DEVICE_CAP_KEYBOARD;
|
||||||
if (caps & bit(EIS_TOUCHSCREEN_INTERFACE_INDEX))
|
if (caps & bit(EIS_TOUCHSCREEN_INTERFACE_INDEX))
|
||||||
capabilities |= EIS_DEVICE_CAP_TOUCH;
|
capabilities |= EIS_DEVICE_CAP_TOUCH;
|
||||||
|
if (caps & bit(EIS_BUTTON_INTERFACE_INDEX))
|
||||||
/* Note: a client binding to button/scroll only
|
capabilities |= EIS_DEVICE_CAP_BUTTON;
|
||||||
ends up with libeis capabilities 0. */
|
if (caps & bit(EIS_SCROLL_INTERFACE_INDEX))
|
||||||
|
capabilities |= EIS_DEVICE_CAP_SCROLL;
|
||||||
|
|
||||||
eis_seat_bind(seat, capabilities);
|
eis_seat_bind(seat, capabilities);
|
||||||
|
|
||||||
|
|
@ -299,6 +300,8 @@ eis_seat_configure_capability(struct eis_seat *seat,
|
||||||
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
||||||
case EIS_DEVICE_CAP_KEYBOARD:
|
case EIS_DEVICE_CAP_KEYBOARD:
|
||||||
case EIS_DEVICE_CAP_TOUCH:
|
case EIS_DEVICE_CAP_TOUCH:
|
||||||
|
case EIS_DEVICE_CAP_BUTTON:
|
||||||
|
case EIS_DEVICE_CAP_SCROLL:
|
||||||
mask_add(seat->capabilities.c_mask, cap);
|
mask_add(seat->capabilities.c_mask, cap);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -313,6 +316,8 @@ eis_seat_has_capability(struct eis_seat *seat,
|
||||||
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
case EIS_DEVICE_CAP_POINTER_ABSOLUTE:
|
||||||
case EIS_DEVICE_CAP_KEYBOARD:
|
case EIS_DEVICE_CAP_KEYBOARD:
|
||||||
case EIS_DEVICE_CAP_TOUCH:
|
case EIS_DEVICE_CAP_TOUCH:
|
||||||
|
case EIS_DEVICE_CAP_BUTTON:
|
||||||
|
case EIS_DEVICE_CAP_SCROLL:
|
||||||
return mask_all(seat->capabilities.c_mask, cap);
|
return mask_all(seat->capabilities.c_mask, cap);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
40
src/libeis.c
40
src/libeis.c
|
|
@ -122,11 +122,11 @@ eis_event_type_to_string(enum eis_event_type type)
|
||||||
CASE_RETURN_STRING(EIS_EVENT_DEVICE_STOP_EMULATING);
|
CASE_RETURN_STRING(EIS_EVENT_DEVICE_STOP_EMULATING);
|
||||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_MOTION);
|
CASE_RETURN_STRING(EIS_EVENT_POINTER_MOTION);
|
||||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_MOTION_ABSOLUTE);
|
CASE_RETURN_STRING(EIS_EVENT_POINTER_MOTION_ABSOLUTE);
|
||||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_BUTTON);
|
CASE_RETURN_STRING(EIS_EVENT_BUTTON_BUTTON);
|
||||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_SCROLL_DELTA);
|
CASE_RETURN_STRING(EIS_EVENT_SCROLL_DELTA);
|
||||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_SCROLL_STOP);
|
CASE_RETURN_STRING(EIS_EVENT_SCROLL_STOP);
|
||||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_SCROLL_CANCEL);
|
CASE_RETURN_STRING(EIS_EVENT_SCROLL_CANCEL);
|
||||||
CASE_RETURN_STRING(EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
CASE_RETURN_STRING(EIS_EVENT_SCROLL_DISCRETE);
|
||||||
CASE_RETURN_STRING(EIS_EVENT_KEYBOARD_KEY);
|
CASE_RETURN_STRING(EIS_EVENT_KEYBOARD_KEY);
|
||||||
CASE_RETURN_STRING(EIS_EVENT_TOUCH_DOWN);
|
CASE_RETURN_STRING(EIS_EVENT_TOUCH_DOWN);
|
||||||
CASE_RETURN_STRING(EIS_EVENT_TOUCH_UP);
|
CASE_RETURN_STRING(EIS_EVENT_TOUCH_UP);
|
||||||
|
|
@ -143,11 +143,11 @@ update_event_timestamp(struct eis_event *event, uint64_t time)
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case EIS_EVENT_POINTER_MOTION:
|
case EIS_EVENT_POINTER_MOTION:
|
||||||
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||||
case EIS_EVENT_POINTER_BUTTON:
|
case EIS_EVENT_BUTTON_BUTTON:
|
||||||
case EIS_EVENT_POINTER_SCROLL_DELTA:
|
case EIS_EVENT_SCROLL_DELTA:
|
||||||
case EIS_EVENT_POINTER_SCROLL_STOP:
|
case EIS_EVENT_SCROLL_STOP:
|
||||||
case EIS_EVENT_POINTER_SCROLL_CANCEL:
|
case EIS_EVENT_SCROLL_CANCEL:
|
||||||
case EIS_EVENT_POINTER_SCROLL_DISCRETE:
|
case EIS_EVENT_SCROLL_DISCRETE:
|
||||||
case EIS_EVENT_KEYBOARD_KEY:
|
case EIS_EVENT_KEYBOARD_KEY:
|
||||||
case EIS_EVENT_TOUCH_DOWN:
|
case EIS_EVENT_TOUCH_DOWN:
|
||||||
case EIS_EVENT_TOUCH_UP:
|
case EIS_EVENT_TOUCH_UP:
|
||||||
|
|
@ -179,11 +179,11 @@ eis_queue_event(struct eis_event *event)
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case EIS_EVENT_POINTER_MOTION:
|
case EIS_EVENT_POINTER_MOTION:
|
||||||
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||||
case EIS_EVENT_POINTER_BUTTON:
|
case EIS_EVENT_BUTTON_BUTTON:
|
||||||
case EIS_EVENT_POINTER_SCROLL_DELTA:
|
case EIS_EVENT_SCROLL_DELTA:
|
||||||
case EIS_EVENT_POINTER_SCROLL_STOP:
|
case EIS_EVENT_SCROLL_STOP:
|
||||||
case EIS_EVENT_POINTER_SCROLL_CANCEL:
|
case EIS_EVENT_SCROLL_CANCEL:
|
||||||
case EIS_EVENT_POINTER_SCROLL_DISCRETE:
|
case EIS_EVENT_SCROLL_DISCRETE:
|
||||||
case EIS_EVENT_KEYBOARD_KEY:
|
case EIS_EVENT_KEYBOARD_KEY:
|
||||||
case EIS_EVENT_TOUCH_DOWN:
|
case EIS_EVENT_TOUCH_DOWN:
|
||||||
case EIS_EVENT_TOUCH_UP:
|
case EIS_EVENT_TOUCH_UP:
|
||||||
|
|
@ -303,7 +303,7 @@ eis_queue_pointer_button_event(struct eis_device *device, uint32_t button,
|
||||||
bool is_press)
|
bool is_press)
|
||||||
{
|
{
|
||||||
struct eis_event *e = eis_event_new_for_device(device);
|
struct eis_event *e = eis_event_new_for_device(device);
|
||||||
e->type = EIS_EVENT_POINTER_BUTTON;
|
e->type = EIS_EVENT_BUTTON_BUTTON;
|
||||||
e->pointer.button = button;
|
e->pointer.button = button;
|
||||||
e->pointer.button_is_press = is_press;
|
e->pointer.button_is_press = is_press;
|
||||||
|
|
||||||
|
|
@ -315,7 +315,7 @@ eis_queue_pointer_scroll_event(struct eis_device *device,
|
||||||
double x, double y)
|
double x, double y)
|
||||||
{
|
{
|
||||||
struct eis_event *e = eis_event_new_for_device(device);
|
struct eis_event *e = eis_event_new_for_device(device);
|
||||||
e->type = EIS_EVENT_POINTER_SCROLL_DELTA;
|
e->type = EIS_EVENT_SCROLL_DELTA;
|
||||||
e->pointer.sx = x;
|
e->pointer.sx = x;
|
||||||
e->pointer.sy = y;
|
e->pointer.sy = y;
|
||||||
eis_queue_event(e);
|
eis_queue_event(e);
|
||||||
|
|
@ -326,7 +326,7 @@ eis_queue_pointer_scroll_discrete_event(struct eis_device *device,
|
||||||
int32_t x, int32_t y)
|
int32_t x, int32_t y)
|
||||||
{
|
{
|
||||||
struct eis_event *e = eis_event_new_for_device(device);
|
struct eis_event *e = eis_event_new_for_device(device);
|
||||||
e->type = EIS_EVENT_POINTER_SCROLL_DISCRETE;
|
e->type = EIS_EVENT_SCROLL_DISCRETE;
|
||||||
e->pointer.sdx = x;
|
e->pointer.sdx = x;
|
||||||
e->pointer.sdy = y;
|
e->pointer.sdy = y;
|
||||||
eis_queue_event(e);
|
eis_queue_event(e);
|
||||||
|
|
@ -336,7 +336,7 @@ void
|
||||||
eis_queue_pointer_scroll_stop_event(struct eis_device *device, bool x, bool y)
|
eis_queue_pointer_scroll_stop_event(struct eis_device *device, bool x, bool y)
|
||||||
{
|
{
|
||||||
struct eis_event *e = eis_event_new_for_device(device);
|
struct eis_event *e = eis_event_new_for_device(device);
|
||||||
e->type = EIS_EVENT_POINTER_SCROLL_STOP;
|
e->type = EIS_EVENT_SCROLL_STOP;
|
||||||
e->pointer.stop_x = x;
|
e->pointer.stop_x = x;
|
||||||
e->pointer.stop_y = y;
|
e->pointer.stop_y = y;
|
||||||
eis_queue_event(e);
|
eis_queue_event(e);
|
||||||
|
|
@ -346,7 +346,7 @@ void
|
||||||
eis_queue_pointer_scroll_cancel_event(struct eis_device *device, bool x, bool y)
|
eis_queue_pointer_scroll_cancel_event(struct eis_device *device, bool x, bool y)
|
||||||
{
|
{
|
||||||
struct eis_event *e = eis_event_new_for_device(device);
|
struct eis_event *e = eis_event_new_for_device(device);
|
||||||
e->type = EIS_EVENT_POINTER_SCROLL_CANCEL;
|
e->type = EIS_EVENT_SCROLL_CANCEL;
|
||||||
e->pointer.stop_x = x;
|
e->pointer.stop_x = x;
|
||||||
e->pointer.stop_y = y;
|
e->pointer.stop_y = y;
|
||||||
eis_queue_event(e);
|
eis_queue_event(e);
|
||||||
|
|
|
||||||
68
src/libeis.h
68
src/libeis.h
|
|
@ -119,10 +119,12 @@ enum eis_device_type {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eis_device_capability {
|
enum eis_device_capability {
|
||||||
EIS_DEVICE_CAP_POINTER = 1,
|
EIS_DEVICE_CAP_POINTER = (1 << 0),
|
||||||
EIS_DEVICE_CAP_POINTER_ABSOLUTE = 2,
|
EIS_DEVICE_CAP_POINTER_ABSOLUTE = (1 << 1),
|
||||||
EIS_DEVICE_CAP_KEYBOARD = 4,
|
EIS_DEVICE_CAP_KEYBOARD = (1 << 2),
|
||||||
EIS_DEVICE_CAP_TOUCH = 8,
|
EIS_DEVICE_CAP_TOUCH = (1 << 3),
|
||||||
|
EIS_DEVICE_CAP_SCROLL = (1 << 4),
|
||||||
|
EIS_DEVICE_CAP_BUTTON = (1 << 5),
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eis_keymap_type {
|
enum eis_keymap_type {
|
||||||
|
|
@ -205,25 +207,25 @@ enum eis_event_type {
|
||||||
/**
|
/**
|
||||||
* A button press or release event
|
* A button press or release event
|
||||||
*/
|
*/
|
||||||
EIS_EVENT_POINTER_BUTTON,
|
EIS_EVENT_BUTTON_BUTTON,
|
||||||
/**
|
/**
|
||||||
* A vertical and/or horizontal scroll event with logical-pixels
|
* A vertical and/or horizontal scroll event with logical-pixels
|
||||||
* or mm precision, depending on the device type.
|
* or mm precision, depending on the device type.
|
||||||
*/
|
*/
|
||||||
EIS_EVENT_POINTER_SCROLL_DELTA,
|
EIS_EVENT_SCROLL_DELTA,
|
||||||
/**
|
/**
|
||||||
* An ongoing scroll sequence stopped.
|
* An ongoing scroll sequence stopped.
|
||||||
*/
|
*/
|
||||||
EIS_EVENT_POINTER_SCROLL_STOP,
|
EIS_EVENT_SCROLL_STOP,
|
||||||
/**
|
/**
|
||||||
* An ongoing scroll sequence was cancelled.
|
* An ongoing scroll sequence was cancelled.
|
||||||
*/
|
*/
|
||||||
EIS_EVENT_POINTER_SCROLL_CANCEL,
|
EIS_EVENT_SCROLL_CANCEL,
|
||||||
/**
|
/**
|
||||||
* A vertical and/or horizontal scroll event with a discrete range in
|
* A vertical and/or horizontal scroll event with a discrete range in
|
||||||
* logical scroll steps, like a scroll wheel.
|
* logical scroll steps, like a scroll wheel.
|
||||||
*/
|
*/
|
||||||
EIS_EVENT_POINTER_SCROLL_DISCRETE,
|
EIS_EVENT_SCROLL_DISCRETE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A key press or release event
|
* A key press or release event
|
||||||
|
|
@ -897,24 +899,24 @@ eis_device_pointer_motion_absolute(struct eis_device *device,
|
||||||
|
|
||||||
/** see @ref ei_device_button_button */
|
/** see @ref ei_device_button_button */
|
||||||
void
|
void
|
||||||
eis_device_pointer_button(struct eis_device *device,
|
eis_device_button_button(struct eis_device *device,
|
||||||
uint32_t button, bool is_press);
|
uint32_t button, bool is_press);
|
||||||
|
|
||||||
/** see @ref ei_device_scroll_delta */
|
/** see @ref ei_device_scroll_delta */
|
||||||
void
|
void
|
||||||
eis_device_pointer_scroll(struct eis_device *device, double x, double y);
|
eis_device_scroll_delta(struct eis_device *device, double x, double y);
|
||||||
|
|
||||||
/** see @ref ei_device_scroll_discrete */
|
/** see @ref ei_device_scroll_discrete */
|
||||||
void
|
void
|
||||||
eis_device_pointer_scroll_discrete(struct eis_device *device, int32_t x, int32_t y);
|
eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y);
|
||||||
|
|
||||||
/** see @ref ei_device_scroll_stop */
|
/** see @ref ei_device_scroll_stop */
|
||||||
void
|
void
|
||||||
eis_device_pointer_scroll_stop(struct eis_device *device, bool stop_x, bool stop_y);
|
eis_device_scroll_stop(struct eis_device *device, bool stop_x, bool stop_y);
|
||||||
|
|
||||||
/** see @ref ei_device_scroll_cancel */
|
/** see @ref ei_device_scroll_cancel */
|
||||||
void
|
void
|
||||||
eis_device_pointer_scroll_cancel(struct eis_device *device, bool cancel_x, bool cancel_y);
|
eis_device_scroll_cancel(struct eis_device *device, bool cancel_x, bool cancel_y);
|
||||||
|
|
||||||
/** see @ref ei_device_keyboard_key */
|
/** see @ref ei_device_keyboard_key */
|
||||||
void
|
void
|
||||||
|
|
@ -1025,66 +1027,66 @@ double
|
||||||
eis_event_pointer_get_absolute_y(struct eis_event *event);
|
eis_event_pointer_get_absolute_y(struct eis_event *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For an event of type @ref EIS_EVENT_POINTER_BUTTON return the button
|
* For an event of type @ref EIS_EVENT_BUTTON_BUTTON return the button
|
||||||
* code as defined in linux/input-event-codes.h
|
* code as defined in linux/input-event-codes.h
|
||||||
*/
|
*/
|
||||||
uint32_t
|
uint32_t
|
||||||
eis_event_pointer_get_button(struct eis_event *event);
|
eis_event_button_get_button(struct eis_event *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For an event of type @ref EIS_EVENT_POINTER_BUTTON return true if the
|
* For an event of type @ref EIS_EVENT_BUTTON_BUTTON return true if the
|
||||||
* event is a button press, false for a release.
|
* event is a button press, false for a release.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
eis_event_pointer_get_button_is_press(struct eis_event *event);
|
eis_event_button_get_is_press(struct eis_event *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL_DELTA return the x scroll
|
* For an event of type @ref EIS_EVENT_SCROLL_DELTA return the x scroll
|
||||||
* distance in logical pixels or mm, depending on the device type.
|
* distance in logical pixels or mm, depending on the device type.
|
||||||
*/
|
*/
|
||||||
double
|
double
|
||||||
eis_event_pointer_get_scroll_x(struct eis_event *event);
|
eis_event_scroll_get_dx(struct eis_event *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL_DELTA return the y scroll
|
* For an event of type @ref EIS_EVENT_SCROLL_DELTA return the y scroll
|
||||||
* distance in logical pixels or mm, depending on the device type.
|
* distance in logical pixels or mm, depending on the device type.
|
||||||
*/
|
*/
|
||||||
double
|
double
|
||||||
eis_event_pointer_get_scroll_y(struct eis_event *event);
|
eis_event_scroll_get_dy(struct eis_event *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL_STOP return whether the
|
* For an event of type @ref EIS_EVENT_SCROLL_STOP return whether the
|
||||||
* x axis has stopped scrolling.
|
* x axis has stopped scrolling.
|
||||||
*
|
*
|
||||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL_CANCEL return whether the
|
* For an event of type @ref EIS_EVENT_SCROLL_CANCEL return whether the
|
||||||
* x axis has cancelled scrolling.
|
* x axis has cancelled scrolling.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
eis_event_pointer_get_scroll_stop_x(struct eis_event *event);
|
eis_event_scroll_get_stop_x(struct eis_event *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL_STOP return whether the
|
* For an event of type @ref EIS_EVENT_SCROLL_STOP return whether the
|
||||||
* y axis has stopped scrolling.
|
* y axis has stopped scrolling.
|
||||||
*
|
*
|
||||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL_CANCEL return whether the
|
* For an event of type @ref EIS_EVENT_SCROLL_CANCEL return whether the
|
||||||
* y axis has cancelled scrolling.
|
* y axis has cancelled scrolling.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
eis_event_pointer_get_scroll_stop_y(struct eis_event *event);
|
eis_event_scroll_get_stop_y(struct eis_event *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL_DISCRETE return the x
|
* For an event of type @ref EIS_EVENT_SCROLL_DISCRETE return the x
|
||||||
* scroll distance in fractions or multiples of 120.
|
* scroll distance in fractions or multiples of 120.
|
||||||
*/
|
*/
|
||||||
int32_t
|
int32_t
|
||||||
eis_event_pointer_get_scroll_discrete_x(struct eis_event *event);
|
eis_event_scroll_get_discrete_dx(struct eis_event *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For an event of type @ref EIS_EVENT_POINTER_SCROLL_DISCRETE return the y
|
* For an event of type @ref EIS_EVENT_SCROLL_DISCRETE return the y
|
||||||
* scroll distance in fractions or multiples of 120.
|
* scroll distance in fractions or multiples of 120.
|
||||||
*/
|
*/
|
||||||
int32_t
|
int32_t
|
||||||
eis_event_pointer_get_scroll_discrete_y(struct eis_event *event);
|
eis_event_scroll_get_discrete_dy(struct eis_event *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For an event of type @ref EIS_EVENT_KEYBOARD_KEY return the key code (as
|
* For an event of type @ref EIS_EVENT_KEYBOARD_KEY return the key code (as
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ struct peck {
|
||||||
struct eis_device *eis_pointer;
|
struct eis_device *eis_pointer;
|
||||||
struct eis_device *eis_keyboard;
|
struct eis_device *eis_keyboard;
|
||||||
struct eis_device *eis_abs;
|
struct eis_device *eis_abs;
|
||||||
|
struct eis_device *eis_button;
|
||||||
|
struct eis_device *eis_scroll;
|
||||||
struct eis_device *eis_touch;
|
struct eis_device *eis_touch;
|
||||||
|
|
||||||
struct ei_seat *ei_seat;
|
struct ei_seat *ei_seat;
|
||||||
|
|
@ -111,6 +113,8 @@ peck_destroy(struct peck *peck)
|
||||||
eis_device_unref(peck->eis_abs);
|
eis_device_unref(peck->eis_abs);
|
||||||
eis_device_unref(peck->eis_keyboard);
|
eis_device_unref(peck->eis_keyboard);
|
||||||
eis_device_unref(peck->eis_touch);
|
eis_device_unref(peck->eis_touch);
|
||||||
|
eis_device_unref(peck->eis_button);
|
||||||
|
eis_device_unref(peck->eis_scroll);
|
||||||
eis_seat_unref(peck->eis_seat);
|
eis_seat_unref(peck->eis_seat);
|
||||||
|
|
||||||
ei_device_unref(peck->ei_pointer);
|
ei_device_unref(peck->ei_pointer);
|
||||||
|
|
@ -171,6 +175,20 @@ peck_eis_get_default_pointer_absolute(struct peck *peck)
|
||||||
return peck->eis_abs;
|
return peck->eis_abs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct eis_device *
|
||||||
|
peck_eis_get_default_button(struct peck *peck)
|
||||||
|
{
|
||||||
|
munit_assert_ptr_not_null(peck->eis_button);
|
||||||
|
return peck->eis_button;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct eis_device *
|
||||||
|
peck_eis_get_default_scroll(struct peck *peck)
|
||||||
|
{
|
||||||
|
munit_assert_ptr_not_null(peck->eis_scroll);
|
||||||
|
return peck->eis_scroll;
|
||||||
|
};
|
||||||
|
|
||||||
struct eis_device *
|
struct eis_device *
|
||||||
peck_eis_get_default_keyboard(struct peck *peck)
|
peck_eis_get_default_keyboard(struct peck *peck)
|
||||||
{
|
{
|
||||||
|
|
@ -523,6 +541,8 @@ peck_create_eis_seat(struct peck *peck, struct eis_client *client)
|
||||||
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_POINTER_ABSOLUTE);
|
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_POINTER_ABSOLUTE);
|
||||||
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_KEYBOARD);
|
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_KEYBOARD);
|
||||||
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_TOUCH);
|
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_TOUCH);
|
||||||
|
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_BUTTON);
|
||||||
|
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_SCROLL);
|
||||||
|
|
||||||
log_debug(peck, "EIS adding seat: '%s'\n", eis_seat_get_name(seat));
|
log_debug(peck, "EIS adding seat: '%s'\n", eis_seat_get_name(seat));
|
||||||
eis_seat_add(seat);
|
eis_seat_add(seat);
|
||||||
|
|
@ -554,6 +574,8 @@ peck_eis_create_pointer(struct peck *peck, struct eis_seat *seat, const char *na
|
||||||
|
|
||||||
eis_device_configure_name(device, name);
|
eis_device_configure_name(device, name);
|
||||||
eis_device_configure_capability(device, EIS_DEVICE_CAP_POINTER);
|
eis_device_configure_capability(device, EIS_DEVICE_CAP_POINTER);
|
||||||
|
eis_device_configure_capability(device, EIS_DEVICE_CAP_BUTTON);
|
||||||
|
eis_device_configure_capability(device, EIS_DEVICE_CAP_SCROLL);
|
||||||
eis_device_add(device);
|
eis_device_add(device);
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
|
|
@ -570,6 +592,8 @@ peck_eis_create_pointer_absolute(struct peck *peck, struct eis_seat *seat, const
|
||||||
|
|
||||||
eis_device_configure_name(device, name);
|
eis_device_configure_name(device, name);
|
||||||
eis_device_configure_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE);
|
eis_device_configure_capability(device, EIS_DEVICE_CAP_POINTER_ABSOLUTE);
|
||||||
|
eis_device_configure_capability(device, EIS_DEVICE_CAP_BUTTON);
|
||||||
|
eis_device_configure_capability(device, EIS_DEVICE_CAP_SCROLL);
|
||||||
eis_region_add(region);
|
eis_region_add(region);
|
||||||
eis_device_add(device);
|
eis_device_add(device);
|
||||||
|
|
||||||
|
|
@ -692,6 +716,8 @@ peck_handle_eis_seat_bind(struct peck *peck, struct eis_event *e)
|
||||||
if (!eis_event_seat_has_capability(e, EIS_DEVICE_CAP_POINTER) &&
|
if (!eis_event_seat_has_capability(e, EIS_DEVICE_CAP_POINTER) &&
|
||||||
!eis_event_seat_has_capability(e, EIS_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
!eis_event_seat_has_capability(e, EIS_DEVICE_CAP_POINTER_ABSOLUTE) &&
|
||||||
!eis_event_seat_has_capability(e, EIS_DEVICE_CAP_KEYBOARD) &&
|
!eis_event_seat_has_capability(e, EIS_DEVICE_CAP_KEYBOARD) &&
|
||||||
|
!eis_event_seat_has_capability(e, EIS_DEVICE_CAP_BUTTON) &&
|
||||||
|
!eis_event_seat_has_capability(e, EIS_DEVICE_CAP_SCROLL) &&
|
||||||
!eis_event_seat_has_capability(e, EIS_DEVICE_CAP_TOUCH))
|
!eis_event_seat_has_capability(e, EIS_DEVICE_CAP_TOUCH))
|
||||||
eis_seat_remove(seat);
|
eis_seat_remove(seat);
|
||||||
}
|
}
|
||||||
|
|
@ -708,6 +734,10 @@ peck_eis_device_remove(struct peck *peck, struct eis_device *device)
|
||||||
peck->eis_keyboard = eis_device_unref(device);
|
peck->eis_keyboard = eis_device_unref(device);
|
||||||
if (device == peck->eis_touch)
|
if (device == peck->eis_touch)
|
||||||
peck->eis_touch = eis_device_unref(device);
|
peck->eis_touch = eis_device_unref(device);
|
||||||
|
if (device == peck->eis_button)
|
||||||
|
peck->eis_button = eis_device_unref(device);
|
||||||
|
if (device == peck->eis_scroll)
|
||||||
|
peck->eis_scroll = eis_device_unref(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -765,11 +795,11 @@ _peck_dispatch_eis(struct peck *peck, int lineno)
|
||||||
break;
|
break;
|
||||||
case EIS_EVENT_POINTER_MOTION:
|
case EIS_EVENT_POINTER_MOTION:
|
||||||
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
case EIS_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||||
case EIS_EVENT_POINTER_BUTTON:
|
case EIS_EVENT_BUTTON_BUTTON:
|
||||||
case EIS_EVENT_POINTER_SCROLL_DELTA:
|
case EIS_EVENT_SCROLL_DELTA:
|
||||||
case EIS_EVENT_POINTER_SCROLL_STOP:
|
case EIS_EVENT_SCROLL_STOP:
|
||||||
case EIS_EVENT_POINTER_SCROLL_CANCEL:
|
case EIS_EVENT_SCROLL_CANCEL:
|
||||||
case EIS_EVENT_POINTER_SCROLL_DISCRETE:
|
case EIS_EVENT_SCROLL_DISCRETE:
|
||||||
case EIS_EVENT_KEYBOARD_KEY:
|
case EIS_EVENT_KEYBOARD_KEY:
|
||||||
case EIS_EVENT_TOUCH_DOWN:
|
case EIS_EVENT_TOUCH_DOWN:
|
||||||
case EIS_EVENT_TOUCH_UP:
|
case EIS_EVENT_TOUCH_UP:
|
||||||
|
|
@ -1256,11 +1286,11 @@ peck_eis_event_type_name(enum eis_event_type type)
|
||||||
CASE_STRING(DEVICE_STOP_EMULATING);
|
CASE_STRING(DEVICE_STOP_EMULATING);
|
||||||
CASE_STRING(POINTER_MOTION);
|
CASE_STRING(POINTER_MOTION);
|
||||||
CASE_STRING(POINTER_MOTION_ABSOLUTE);
|
CASE_STRING(POINTER_MOTION_ABSOLUTE);
|
||||||
CASE_STRING(POINTER_BUTTON);
|
CASE_STRING(BUTTON_BUTTON);
|
||||||
CASE_STRING(POINTER_SCROLL_DELTA);
|
CASE_STRING(SCROLL_DELTA);
|
||||||
CASE_STRING(POINTER_SCROLL_STOP);
|
CASE_STRING(SCROLL_STOP);
|
||||||
CASE_STRING(POINTER_SCROLL_CANCEL);
|
CASE_STRING(SCROLL_CANCEL);
|
||||||
CASE_STRING(POINTER_SCROLL_DISCRETE);
|
CASE_STRING(SCROLL_DISCRETE);
|
||||||
CASE_STRING(KEYBOARD_KEY);
|
CASE_STRING(KEYBOARD_KEY);
|
||||||
CASE_STRING(TOUCH_DOWN);
|
CASE_STRING(TOUCH_DOWN);
|
||||||
CASE_STRING(TOUCH_UP);
|
CASE_STRING(TOUCH_UP);
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,12 @@ peck_eis_get_default_pointer_absolute(struct peck *peck);
|
||||||
struct eis_device *
|
struct eis_device *
|
||||||
peck_eis_get_default_touch(struct peck *peck);
|
peck_eis_get_default_touch(struct peck *peck);
|
||||||
|
|
||||||
|
struct eis_device *
|
||||||
|
peck_eis_get_default_button(struct peck *peck);
|
||||||
|
|
||||||
|
struct eis_device *
|
||||||
|
peck_eis_get_default_scroll(struct peck *peck);
|
||||||
|
|
||||||
struct ei_seat *
|
struct ei_seat *
|
||||||
peck_ei_get_default_seat(struct peck *peck);
|
peck_ei_get_default_seat(struct peck *peck);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -580,14 +580,14 @@ MUNIT_TEST(test_ei_device_scroll)
|
||||||
|
|
||||||
with_server(peck) {
|
with_server(peck) {
|
||||||
_unref_(eis_event) *first =
|
_unref_(eis_event) *first =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_DELTA);
|
||||||
munit_assert_double_equal(eis_event_pointer_get_scroll_x(first), 1.1, 2 /* precision */);
|
munit_assert_double_equal(eis_event_scroll_get_dx(first), 1.1, 2 /* precision */);
|
||||||
munit_assert_double_equal(eis_event_pointer_get_scroll_y(first), 2.2, 2 /* precision */);
|
munit_assert_double_equal(eis_event_scroll_get_dy(first), 2.2, 2 /* precision */);
|
||||||
|
|
||||||
_unref_(eis_event) *second =
|
_unref_(eis_event) *second =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DISCRETE);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_DISCRETE);
|
||||||
munit_assert_int(eis_event_pointer_get_scroll_discrete_x(second), ==, 3);
|
munit_assert_int(eis_event_scroll_get_discrete_dx(second), ==, 3);
|
||||||
munit_assert_int(eis_event_pointer_get_scroll_discrete_y(second), ==, 4);
|
munit_assert_int(eis_event_scroll_get_discrete_dy(second), ==, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MUNIT_OK;
|
return MUNIT_OK;
|
||||||
|
|
@ -631,30 +631,30 @@ MUNIT_TEST(test_ei_device_scroll_stop)
|
||||||
|
|
||||||
with_server(peck) {
|
with_server(peck) {
|
||||||
_unref_(eis_event) *scroll =
|
_unref_(eis_event) *scroll =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_DELTA);
|
||||||
|
|
||||||
_unref_(eis_event) *first =
|
_unref_(eis_event) *first =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_STOP);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_STOP);
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_x(first));
|
munit_assert(eis_event_scroll_get_stop_x(first));
|
||||||
munit_assert(!eis_event_pointer_get_scroll_stop_y(first));
|
munit_assert(!eis_event_scroll_get_stop_y(first));
|
||||||
|
|
||||||
_unref_(eis_event) *second =
|
_unref_(eis_event) *second =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_STOP);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_STOP);
|
||||||
munit_assert(!eis_event_pointer_get_scroll_stop_x(second));
|
munit_assert(!eis_event_scroll_get_stop_x(second));
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_y(second));
|
munit_assert(eis_event_scroll_get_stop_y(second));
|
||||||
|
|
||||||
/* third one doesn't trigger an event */
|
/* third one doesn't trigger an event */
|
||||||
|
|
||||||
_unref_(eis_event) *again =
|
_unref_(eis_event) *again =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_DELTA);
|
||||||
|
|
||||||
_unref_(eis_event) *fourth =
|
_unref_(eis_event) *fourth =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_STOP);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_STOP);
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_x(fourth));
|
munit_assert(eis_event_scroll_get_stop_x(fourth));
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_y(fourth));
|
munit_assert(eis_event_scroll_get_stop_y(fourth));
|
||||||
|
|
||||||
_unref_(eis_event) *again_again =
|
_unref_(eis_event) *again_again =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_DELTA);
|
||||||
|
|
||||||
peck_assert_no_eis_events(eis);
|
peck_assert_no_eis_events(eis);
|
||||||
}
|
}
|
||||||
|
|
@ -700,30 +700,30 @@ MUNIT_TEST(test_ei_device_scroll_cancel)
|
||||||
|
|
||||||
with_server(peck) {
|
with_server(peck) {
|
||||||
_unref_(eis_event) *scroll =
|
_unref_(eis_event) *scroll =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_DELTA);
|
||||||
|
|
||||||
_unref_(eis_event) *first =
|
_unref_(eis_event) *first =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_CANCEL);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_CANCEL);
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_x(first));
|
munit_assert(eis_event_scroll_get_stop_x(first));
|
||||||
munit_assert(!eis_event_pointer_get_scroll_stop_y(first));
|
munit_assert(!eis_event_scroll_get_stop_y(first));
|
||||||
|
|
||||||
_unref_(eis_event) *second =
|
_unref_(eis_event) *second =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_CANCEL);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_CANCEL);
|
||||||
munit_assert(!eis_event_pointer_get_scroll_stop_x(second));
|
munit_assert(!eis_event_scroll_get_stop_x(second));
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_y(second));
|
munit_assert(eis_event_scroll_get_stop_y(second));
|
||||||
|
|
||||||
/* third one doesn't trigger an event */
|
/* third one doesn't trigger an event */
|
||||||
|
|
||||||
_unref_(eis_event) *again =
|
_unref_(eis_event) *again =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_DELTA);
|
||||||
|
|
||||||
_unref_(eis_event) *fourth =
|
_unref_(eis_event) *fourth =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_CANCEL);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_CANCEL);
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_x(fourth));
|
munit_assert(eis_event_scroll_get_stop_x(fourth));
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_y(fourth));
|
munit_assert(eis_event_scroll_get_stop_y(fourth));
|
||||||
|
|
||||||
_unref_(eis_event) *again_again =
|
_unref_(eis_event) *again_again =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_DELTA);
|
||||||
|
|
||||||
peck_assert_no_eis_events(eis);
|
peck_assert_no_eis_events(eis);
|
||||||
}
|
}
|
||||||
|
|
@ -761,22 +761,22 @@ MUNIT_TEST(test_ei_device_scroll_stop_cancel)
|
||||||
|
|
||||||
with_server(peck) {
|
with_server(peck) {
|
||||||
_unref_(eis_event) *scroll =
|
_unref_(eis_event) *scroll =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_DELTA);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_DELTA);
|
||||||
|
|
||||||
_unref_(eis_event) *stop =
|
_unref_(eis_event) *stop =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_STOP);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_STOP);
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_x(stop));
|
munit_assert(eis_event_scroll_get_stop_x(stop));
|
||||||
munit_assert(!eis_event_pointer_get_scroll_stop_y(stop));
|
munit_assert(!eis_event_scroll_get_stop_y(stop));
|
||||||
|
|
||||||
_unref_(eis_event) *first =
|
_unref_(eis_event) *first =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_CANCEL);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_CANCEL);
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_x(first));
|
munit_assert(eis_event_scroll_get_stop_x(first));
|
||||||
munit_assert(!eis_event_pointer_get_scroll_stop_y(first));
|
munit_assert(!eis_event_scroll_get_stop_y(first));
|
||||||
|
|
||||||
_unref_(eis_event) *second =
|
_unref_(eis_event) *second =
|
||||||
peck_eis_next_event(eis, EIS_EVENT_POINTER_SCROLL_CANCEL);
|
peck_eis_next_event(eis, EIS_EVENT_SCROLL_CANCEL);
|
||||||
munit_assert(!eis_event_pointer_get_scroll_stop_x(second));
|
munit_assert(!eis_event_scroll_get_stop_x(second));
|
||||||
munit_assert(eis_event_pointer_get_scroll_stop_y(second));
|
munit_assert(eis_event_scroll_get_stop_y(second));
|
||||||
|
|
||||||
/* third one doesn't trigger an event */
|
/* third one doesn't trigger an event */
|
||||||
peck_assert_no_eis_events(eis);
|
peck_assert_no_eis_events(eis);
|
||||||
|
|
@ -1660,9 +1660,9 @@ MUNIT_TEST(test_passive_ei_device_scroll_delta)
|
||||||
|
|
||||||
with_server(peck) {
|
with_server(peck) {
|
||||||
struct eis_device *device = peck_eis_get_default_pointer(peck);
|
struct eis_device *device = peck_eis_get_default_pointer(peck);
|
||||||
eis_device_pointer_scroll(device, 1.1, 2.2);
|
eis_device_scroll_delta(device, 1.1, 2.2);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
eis_device_pointer_scroll_discrete(device, 3, 4);
|
eis_device_scroll_discrete(device, 3, 4);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1710,26 +1710,26 @@ MUNIT_TEST(test_passive_ei_device_scroll_stop)
|
||||||
|
|
||||||
with_server(peck) {
|
with_server(peck) {
|
||||||
struct eis_device *device = peck_eis_get_default_pointer(peck);
|
struct eis_device *device = peck_eis_get_default_pointer(peck);
|
||||||
eis_device_pointer_scroll(device, 1.1, 2.2);
|
eis_device_scroll_delta(device, 1.1, 2.2);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
eis_device_pointer_scroll_stop(device, true, false);
|
eis_device_scroll_stop(device, true, false);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
eis_device_pointer_scroll_stop(device, false, true);
|
eis_device_scroll_stop(device, false, true);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
|
|
||||||
/* This should not generate an event */
|
/* This should not generate an event */
|
||||||
eis_device_pointer_scroll_stop(device, true, true);
|
eis_device_scroll_stop(device, true, true);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
|
|
||||||
/* But scrolling again will re-enable stopping */
|
/* But scrolling again will re-enable stopping */
|
||||||
eis_device_pointer_scroll(device, 3.3, 4.4);
|
eis_device_scroll_delta(device, 3.3, 4.4);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
eis_device_pointer_scroll_stop(device, true, true);
|
eis_device_scroll_stop(device, true, true);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
|
|
||||||
eis_device_pointer_scroll(device, 3.3, 4.4);
|
eis_device_scroll_delta(device, 3.3, 4.4);
|
||||||
/* This one is a client bug and shouldn't trigger an event */
|
/* This one is a client bug and shouldn't trigger an event */
|
||||||
eis_device_pointer_scroll_stop(device, false, false);
|
eis_device_scroll_stop(device, false, false);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1795,26 +1795,26 @@ MUNIT_TEST(test_passive_ei_device_scroll_cancel)
|
||||||
|
|
||||||
with_server(peck) {
|
with_server(peck) {
|
||||||
struct eis_device *device = peck_eis_get_default_pointer(peck);
|
struct eis_device *device = peck_eis_get_default_pointer(peck);
|
||||||
eis_device_pointer_scroll(device, 1.1, 2.2);
|
eis_device_scroll_delta(device, 1.1, 2.2);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
eis_device_pointer_scroll_cancel(device, true, false);
|
eis_device_scroll_cancel(device, true, false);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
eis_device_pointer_scroll_cancel(device, false, true);
|
eis_device_scroll_cancel(device, false, true);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
|
|
||||||
/* This should not generate an event */
|
/* This should not generate an event */
|
||||||
eis_device_pointer_scroll_cancel(device, true, true);
|
eis_device_scroll_cancel(device, true, true);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
|
|
||||||
/* But scrolling again will re-enable stopping */
|
/* But scrolling again will re-enable stopping */
|
||||||
eis_device_pointer_scroll(device, 3.3, 4.4);
|
eis_device_scroll_delta(device, 3.3, 4.4);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
eis_device_pointer_scroll_cancel(device, true, true);
|
eis_device_scroll_cancel(device, true, true);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
|
|
||||||
eis_device_pointer_scroll(device, 3.3, 4.4);
|
eis_device_scroll_delta(device, 3.3, 4.4);
|
||||||
/* This one is a client bug and shouldn't trigger an event */
|
/* This one is a client bug and shouldn't trigger an event */
|
||||||
eis_device_pointer_scroll_cancel(device, false, false);
|
eis_device_scroll_cancel(device, false, false);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1881,21 +1881,21 @@ MUNIT_TEST(test_passive_ei_device_scroll_stop_cancel)
|
||||||
/* cancel after stop is fine, stop after cancel is ignored */
|
/* cancel after stop is fine, stop after cancel is ignored */
|
||||||
with_server(peck) {
|
with_server(peck) {
|
||||||
struct eis_device *device = peck_eis_get_default_pointer(peck);
|
struct eis_device *device = peck_eis_get_default_pointer(peck);
|
||||||
eis_device_pointer_scroll(device, 1.1, 2.2);
|
eis_device_scroll_delta(device, 1.1, 2.2);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
peck_mark(peck);
|
peck_mark(peck);
|
||||||
eis_device_pointer_scroll_stop(device, true, false);
|
eis_device_scroll_stop(device, true, false);
|
||||||
peck_mark(peck);
|
peck_mark(peck);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
eis_device_pointer_scroll_cancel(device, true, false);
|
eis_device_scroll_cancel(device, true, false);
|
||||||
peck_mark(peck);
|
peck_mark(peck);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
eis_device_pointer_scroll_cancel(device, false, true);
|
eis_device_scroll_cancel(device, false, true);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
peck_mark(peck);
|
peck_mark(peck);
|
||||||
|
|
||||||
/* This should not generate an event */
|
/* This should not generate an event */
|
||||||
eis_device_pointer_scroll_stop(device, true, true);
|
eis_device_scroll_stop(device, true, true);
|
||||||
eis_device_frame(device, peck_eis_now(peck));
|
eis_device_frame(device, peck_eis_now(peck));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,8 @@ create_mouse(struct eis_demo_server *server, struct eis_seat *seat,
|
||||||
|
|
||||||
eis_device_configure_name(device, devicename);
|
eis_device_configure_name(device, devicename);
|
||||||
eis_device_configure_capability(device, EIS_DEVICE_CAP_POINTER);
|
eis_device_configure_capability(device, EIS_DEVICE_CAP_POINTER);
|
||||||
|
eis_device_configure_capability(device, EIS_DEVICE_CAP_BUTTON);
|
||||||
|
eis_device_configure_capability(device, EIS_DEVICE_CAP_SCROLL);
|
||||||
|
|
||||||
_cleanup_libevdev_ struct libevdev *dev = libevdev_new();
|
_cleanup_libevdev_ struct libevdev *dev = libevdev_new();
|
||||||
libevdev_set_name(dev, devicename);
|
libevdev_set_name(dev, devicename);
|
||||||
|
|
@ -137,6 +139,8 @@ eis_demo_server_uinput_handle_event(struct eis_demo_server *server,
|
||||||
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_POINTER_ABSOLUTE);
|
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_POINTER_ABSOLUTE);
|
||||||
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_KEYBOARD);
|
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_KEYBOARD);
|
||||||
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_TOUCH);
|
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_TOUCH);
|
||||||
|
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_BUTTON);
|
||||||
|
eis_seat_configure_capability(seat, EIS_DEVICE_CAP_SCROLL);
|
||||||
eis_seat_add(seat);
|
eis_seat_add(seat);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -203,11 +207,11 @@ eis_demo_server_uinput_handle_event(struct eis_demo_server *server,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EIS_EVENT_POINTER_BUTTON:
|
case EIS_EVENT_BUTTON_BUTTON:
|
||||||
{
|
{
|
||||||
struct eis_device *device = eis_event_get_device(e);
|
struct eis_device *device = eis_event_get_device(e);
|
||||||
uint32_t button = eis_event_pointer_get_button(e);
|
uint32_t button = eis_event_button_get_button(e);
|
||||||
bool state = eis_event_pointer_get_button_is_press(e);
|
bool state = eis_event_button_get_is_press(e);
|
||||||
colorprint("%s %s\n",
|
colorprint("%s %s\n",
|
||||||
libevdev_event_code_get_name(EV_KEY, button),
|
libevdev_event_code_get_name(EV_KEY, button),
|
||||||
state ? "press" : "release");
|
state ? "press" : "release");
|
||||||
|
|
|
||||||
|
|
@ -257,6 +257,8 @@ add_device(struct eis_demo_server *server, struct eis_client *client,
|
||||||
struct eis_device *ptr = eis_seat_new_device(seat);
|
struct eis_device *ptr = eis_seat_new_device(seat);
|
||||||
eis_device_configure_name(ptr, "test pointer");
|
eis_device_configure_name(ptr, "test pointer");
|
||||||
eis_device_configure_capability(ptr, EIS_DEVICE_CAP_POINTER);
|
eis_device_configure_capability(ptr, EIS_DEVICE_CAP_POINTER);
|
||||||
|
eis_device_configure_capability(ptr, EIS_DEVICE_CAP_BUTTON);
|
||||||
|
eis_device_configure_capability(ptr, EIS_DEVICE_CAP_SCROLL);
|
||||||
_unref_(eis_region) *rel_region = eis_device_new_region(ptr);
|
_unref_(eis_region) *rel_region = eis_device_new_region(ptr);
|
||||||
eis_region_set_size(rel_region, 1920, 1080);
|
eis_region_set_size(rel_region, 1920, 1080);
|
||||||
eis_region_set_offset(rel_region, 0, 0);
|
eis_region_set_offset(rel_region, 0, 0);
|
||||||
|
|
@ -275,6 +277,8 @@ add_device(struct eis_demo_server *server, struct eis_client *client,
|
||||||
struct eis_device *abs = eis_seat_new_device(seat);
|
struct eis_device *abs = eis_seat_new_device(seat);
|
||||||
eis_device_configure_name(abs, "test abs pointer");
|
eis_device_configure_name(abs, "test abs pointer");
|
||||||
eis_device_configure_capability(abs, EIS_DEVICE_CAP_POINTER_ABSOLUTE);
|
eis_device_configure_capability(abs, EIS_DEVICE_CAP_POINTER_ABSOLUTE);
|
||||||
|
eis_device_configure_capability(abs, EIS_DEVICE_CAP_BUTTON);
|
||||||
|
eis_device_configure_capability(abs, EIS_DEVICE_CAP_SCROLL);
|
||||||
_unref_(eis_region) *region = eis_device_new_region(abs);
|
_unref_(eis_region) *region = eis_device_new_region(abs);
|
||||||
eis_region_set_size(region, 1920, 1080);
|
eis_region_set_size(region, 1920, 1080);
|
||||||
eis_region_set_offset(region, 0, 0);
|
eis_region_set_offset(region, 0, 0);
|
||||||
|
|
@ -318,6 +322,10 @@ add_device(struct eis_demo_server *server, struct eis_client *client,
|
||||||
device = steal(&touchscreen);
|
device = steal(&touchscreen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case EIS_DEVICE_CAP_BUTTON:
|
||||||
|
case EIS_DEVICE_CAP_SCROLL:
|
||||||
|
/* Mixed in with pointer/abs - good enough for a demo server */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
|
|
@ -473,25 +481,25 @@ eis_demo_server_printf_handle_event(struct eis_demo_server *server,
|
||||||
eis_event_pointer_get_absolute_y(e));
|
eis_event_pointer_get_absolute_y(e));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EIS_EVENT_POINTER_BUTTON:
|
case EIS_EVENT_BUTTON_BUTTON:
|
||||||
{
|
{
|
||||||
colorprint("button %u (%s)\n",
|
colorprint("button %u (%s)\n",
|
||||||
eis_event_pointer_get_button(e),
|
eis_event_button_get_button(e),
|
||||||
eis_event_pointer_get_button_is_press(e) ? "press" : "release");
|
eis_event_button_get_is_press(e) ? "press" : "release");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EIS_EVENT_POINTER_SCROLL_DELTA:
|
case EIS_EVENT_SCROLL_DELTA:
|
||||||
{
|
{
|
||||||
colorprint("scroll %.2f/%.2f\n",
|
colorprint("scroll %.2f/%.2f\n",
|
||||||
eis_event_pointer_get_scroll_x(e),
|
eis_event_scroll_get_dx(e),
|
||||||
eis_event_pointer_get_scroll_y(e));
|
eis_event_scroll_get_dy(e));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EIS_EVENT_POINTER_SCROLL_DISCRETE:
|
case EIS_EVENT_SCROLL_DISCRETE:
|
||||||
{
|
{
|
||||||
colorprint("scroll discrete %d/%d\n",
|
colorprint("scroll discrete %d/%d\n",
|
||||||
eis_event_pointer_get_scroll_discrete_x(e),
|
eis_event_scroll_get_discrete_dx(e),
|
||||||
eis_event_pointer_get_scroll_discrete_y(e));
|
eis_event_scroll_get_discrete_dy(e));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EIS_EVENT_KEYBOARD_KEY:
|
case EIS_EVENT_KEYBOARD_KEY:
|
||||||
|
|
@ -680,17 +688,17 @@ int main(int argc, char **argv)
|
||||||
eis_device_pointer_motion(ptr, -1, 1);
|
eis_device_pointer_motion(ptr, -1, 1);
|
||||||
/* BTN_LEFT */
|
/* BTN_LEFT */
|
||||||
colorprint("sending button event\n");
|
colorprint("sending button event\n");
|
||||||
eis_device_pointer_button(ptr, BTN_LEFT, true);
|
eis_device_button_button(ptr, BTN_LEFT, true);
|
||||||
eis_device_frame(ptr, now);
|
eis_device_frame(ptr, now);
|
||||||
now += interval;
|
now += interval;
|
||||||
eis_device_pointer_button(ptr, BTN_LEFT, false);
|
eis_device_button_button(ptr, BTN_LEFT, false);
|
||||||
eis_device_frame(ptr, now);
|
eis_device_frame(ptr, now);
|
||||||
now += interval;
|
now += interval;
|
||||||
colorprint("sending scroll events\n");
|
colorprint("sending scroll events\n");
|
||||||
eis_device_pointer_scroll(ptr, 1, 1);
|
eis_device_scroll_delta(ptr, 1, 1);
|
||||||
eis_device_frame(ptr, now);
|
eis_device_frame(ptr, now);
|
||||||
now += interval;
|
now += interval;
|
||||||
eis_device_pointer_scroll_discrete(ptr, 1, 1);
|
eis_device_scroll_discrete(ptr, 1, 1);
|
||||||
eis_device_frame(ptr, now);
|
eis_device_frame(ptr, now);
|
||||||
now += interval;
|
now += interval;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue