mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-03 23:08:11 +02:00
proto: split the touch event into its three separate events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
6749bf3121
commit
09929534bf
3 changed files with 48 additions and 40 deletions
|
|
@ -122,15 +122,25 @@ message KeyboardKey {
|
|||
bool state = 3;
|
||||
}
|
||||
|
||||
message Touch {
|
||||
message TouchDown {
|
||||
uint32 deviceid = 1;
|
||||
uint32 touchid = 2;
|
||||
bool is_down = 3;
|
||||
bool is_up = 4;
|
||||
double x = 5;
|
||||
double y = 6;
|
||||
}
|
||||
|
||||
message TouchMotion {
|
||||
uint32 deviceid = 1;
|
||||
uint32 touchid = 2;
|
||||
double x = 5;
|
||||
double y = 6;
|
||||
}
|
||||
|
||||
message TouchUp {
|
||||
uint32 deviceid = 1;
|
||||
uint32 touchid = 2;
|
||||
}
|
||||
|
||||
message ClientMessage {
|
||||
oneof msg {
|
||||
Connect connect = 1;
|
||||
|
|
@ -144,9 +154,11 @@ message ClientMessage {
|
|||
ScrollDiscrete disc = 9;
|
||||
PointerButton button = 10;
|
||||
KeyboardKey key = 11;
|
||||
Touch touch = 12;
|
||||
ConfigureName configure_name = 13;
|
||||
ConfigureCapabilities configure_caps = 14;
|
||||
TouchDown touch_down = 12;
|
||||
TouchMotion touch_motion = 13;
|
||||
TouchUp touch_up = 14;
|
||||
ConfigureName configure_name = 15;
|
||||
ConfigureCapabilities configure_caps = 16;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -147,7 +147,9 @@ log_wire_message(struct ei *ei, const ClientMessage *msg, int error)
|
|||
MSG_STRING_CASE(SCROLL);
|
||||
MSG_STRING_CASE(DISC);
|
||||
MSG_STRING_CASE(KEY);
|
||||
MSG_STRING_CASE(TOUCH);
|
||||
MSG_STRING_CASE(TOUCH_DOWN);
|
||||
MSG_STRING_CASE(TOUCH_MOTION);
|
||||
MSG_STRING_CASE(TOUCH_UP);
|
||||
MSG_STRING_CASE(CONFIGURE_NAME);
|
||||
MSG_STRING_CASE(CONFIGURE_CAPS);
|
||||
default:
|
||||
|
|
@ -366,17 +368,15 @@ static int
|
|||
ei_proto_send_touch_down(struct ei_device *device, uint32_t tid, double x, double y)
|
||||
{
|
||||
ClientMessage msg = CLIENT_MESSAGE__INIT;
|
||||
Touch touch = TOUCH__INIT;
|
||||
TouchDown touch = TOUCH_DOWN__INIT;
|
||||
|
||||
touch.deviceid = device->id;
|
||||
touch.touchid = tid;
|
||||
touch.is_down = true;
|
||||
touch.is_up = false;
|
||||
touch.x = x;
|
||||
touch.y = y;
|
||||
|
||||
msg.touch = &touch;
|
||||
msg.msg_case = CLIENT_MESSAGE__MSG_TOUCH;
|
||||
msg.touch_down = &touch;
|
||||
msg.msg_case = CLIENT_MESSAGE__MSG_TOUCH_DOWN;
|
||||
|
||||
return ei_proto_send_msg(ei_device_get_context(device), &msg);
|
||||
}
|
||||
|
|
@ -385,17 +385,15 @@ static int
|
|||
ei_proto_send_touch_motion(struct ei_device *device, uint32_t tid, double x, double y)
|
||||
{
|
||||
ClientMessage msg = CLIENT_MESSAGE__INIT;
|
||||
Touch touch = TOUCH__INIT;
|
||||
TouchMotion touch = TOUCH_MOTION__INIT;
|
||||
|
||||
touch.deviceid = device->id;
|
||||
touch.touchid = tid;
|
||||
touch.is_down = false;
|
||||
touch.is_up = false;
|
||||
touch.x = x;
|
||||
touch.y = y;
|
||||
|
||||
msg.touch = &touch;
|
||||
msg.msg_case = CLIENT_MESSAGE__MSG_TOUCH;
|
||||
msg.touch_motion = &touch;
|
||||
msg.msg_case = CLIENT_MESSAGE__MSG_TOUCH_MOTION;
|
||||
|
||||
return ei_proto_send_msg(ei_device_get_context(device), &msg);
|
||||
}
|
||||
|
|
@ -404,15 +402,13 @@ static int
|
|||
ei_proto_send_touch_up(struct ei_device *device, uint32_t tid)
|
||||
{
|
||||
ClientMessage msg = CLIENT_MESSAGE__INIT;
|
||||
Touch touch = TOUCH__INIT;
|
||||
TouchUp touch = TOUCH_UP__INIT;
|
||||
|
||||
touch.deviceid = device->id;
|
||||
touch.touchid = tid;
|
||||
touch.is_down = false;
|
||||
touch.is_up = true;
|
||||
|
||||
msg.touch = &touch;
|
||||
msg.msg_case = CLIENT_MESSAGE__MSG_TOUCH;
|
||||
msg.touch_up = &touch;
|
||||
msg.msg_case = CLIENT_MESSAGE__MSG_TOUCH_UP;
|
||||
|
||||
return ei_proto_send_msg(ei_device_get_context(device), &msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,24 +367,24 @@ eis_proto_handle_message(struct eis_client *client,
|
|||
proto->key->key,
|
||||
proto->key->state);
|
||||
break;
|
||||
case CLIENT_MESSAGE__MSG_TOUCH:
|
||||
if (proto->touch->is_down) {
|
||||
rc = call(touch_down, client,
|
||||
proto->touch->deviceid,
|
||||
proto->touch->touchid,
|
||||
proto->touch->x,
|
||||
proto->touch->y);
|
||||
} else if (proto->touch->is_up) {
|
||||
rc = call(touch_up, client,
|
||||
proto->touch->deviceid,
|
||||
proto->touch->touchid);
|
||||
} else {
|
||||
rc = call(touch_motion, client,
|
||||
proto->touch->deviceid,
|
||||
proto->touch->touchid,
|
||||
proto->touch->x,
|
||||
proto->touch->y);
|
||||
}
|
||||
case CLIENT_MESSAGE__MSG_TOUCH_DOWN:
|
||||
rc = call(touch_down, client,
|
||||
proto->touch_down->deviceid,
|
||||
proto->touch_down->touchid,
|
||||
proto->touch_down->x,
|
||||
proto->touch_down->y);
|
||||
break;
|
||||
case CLIENT_MESSAGE__MSG_TOUCH_MOTION:
|
||||
rc = call(touch_motion, client,
|
||||
proto->touch_motion->deviceid,
|
||||
proto->touch_motion->touchid,
|
||||
proto->touch_motion->x,
|
||||
proto->touch_motion->y);
|
||||
break;
|
||||
case CLIENT_MESSAGE__MSG_TOUCH_UP:
|
||||
rc = call(touch_up, client,
|
||||
proto->touch_up->deviceid,
|
||||
proto->touch_up->touchid);
|
||||
break;
|
||||
case CLIENT_MESSAGE__MSG_CONFIGURE_NAME:
|
||||
rc = call(configure_name, client,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue