mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-06 14:08:03 +02:00
reis: use the same message helper macro we already use for eis/ei
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
95f00361b3
commit
6768b8170b
4 changed files with 18 additions and 20 deletions
|
|
@ -191,7 +191,7 @@ message ClientMessage {
|
|||
TouchMotion touch_motion = 15;
|
||||
TouchUp touch_up = 16;
|
||||
ConfigureName configure_name = 17;
|
||||
ConfigureCapabilities configure_caps = 18;
|
||||
ConfigureCapabilities configure_capabilities = 18;
|
||||
Frame frame = 19;
|
||||
StartEmulating start_emulating = 20;
|
||||
StopEmulating stop_emulating = 21;
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ log_wire_message(struct ei *ei, const ClientMessage *msg, int error)
|
|||
MSG_STRING_CASE(TOUCH_MOTION);
|
||||
MSG_STRING_CASE(TOUCH_UP);
|
||||
MSG_STRING_CASE(CONFIGURE_NAME);
|
||||
MSG_STRING_CASE(CONFIGURE_CAPS);
|
||||
MSG_STRING_CASE(CONFIGURE_CAPABILITIES);
|
||||
MSG_STRING_CASE(FRAME);
|
||||
MSG_STRING_CASE(PROPERTY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -405,11 +405,11 @@ eis_proto_handle_message(struct eis_client *client,
|
|||
rc = call(configure_name, client,
|
||||
proto->configure_name->name);
|
||||
break;
|
||||
case CLIENT_MESSAGE__MSG_CONFIGURE_CAPS:
|
||||
case CLIENT_MESSAGE__MSG_CONFIGURE_CAPABILITIES:
|
||||
rc = call(configure_capabilities, client,
|
||||
proto->configure_caps->policy_is_allow,
|
||||
proto->configure_caps->allowed_capabilities,
|
||||
proto->configure_caps->denied_capabilities);
|
||||
proto->configure_capabilities->policy_is_allow,
|
||||
proto->configure_capabilities->allowed_capabilities,
|
||||
proto->configure_capabilities->denied_capabilities);
|
||||
break;
|
||||
case CLIENT_MESSAGE__MSG_FRAME:
|
||||
rc = call(frame, client, proto->frame->deviceid);
|
||||
|
|
|
|||
|
|
@ -77,16 +77,18 @@ reis_new(void)
|
|||
return reis;
|
||||
}
|
||||
|
||||
#define prepare_msg(_type, _struct, _field) \
|
||||
ClientMessage msg = CLIENT_MESSAGE__INIT; \
|
||||
_struct _field = _type##__INIT; \
|
||||
msg.msg_case = CLIENT_MESSAGE__MSG_##_type; \
|
||||
msg._field = &_field
|
||||
|
||||
_public_ int
|
||||
reis_apply(struct reis *reis, int eisfd)
|
||||
{
|
||||
if (reis->name) {
|
||||
ConfigureName n = CONFIGURE_NAME__INIT;
|
||||
n.name = reis->name;
|
||||
|
||||
ClientMessage msg = CLIENT_MESSAGE__INIT;
|
||||
msg.configure_name = &n;
|
||||
msg.msg_case = CLIENT_MESSAGE__MSG_CONFIGURE_NAME;
|
||||
prepare_msg(CONFIGURE_NAME, ConfigureName, configure_name);
|
||||
configure_name.name = reis->name;
|
||||
|
||||
int rc = send_msg(eisfd, &msg);
|
||||
if (rc)
|
||||
|
|
@ -94,14 +96,10 @@ reis_apply(struct reis *reis, int eisfd)
|
|||
}
|
||||
|
||||
if (!reis->policy_is_allow || reis->allow || reis->deny) {
|
||||
ConfigureCapabilities c = CONFIGURE_CAPABILITIES__INIT;
|
||||
c.policy_is_allow = reis->policy_is_allow;
|
||||
c.allowed_capabilities = reis->allow;
|
||||
c.denied_capabilities = reis->deny;
|
||||
|
||||
ClientMessage msg = CLIENT_MESSAGE__INIT;
|
||||
msg.configure_caps = &c;
|
||||
msg.msg_case = CLIENT_MESSAGE__MSG_CONFIGURE_CAPS;
|
||||
prepare_msg(CONFIGURE_CAPABILITIES, ConfigureCapabilities, configure_capabilities);
|
||||
configure_capabilities.policy_is_allow = reis->policy_is_allow;
|
||||
configure_capabilities.allowed_capabilities = reis->allow;
|
||||
configure_capabilities.denied_capabilities = reis->deny;
|
||||
|
||||
int rc = send_msg(eisfd, &msg);
|
||||
if (rc)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue