mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-02-03 20:40:28 +01:00
proto: add the context-type attribute to events and requests
This allows us to mark/filter requests and events that are only available on a given context type.
This commit is contained in:
parent
fb5b607c13
commit
56004836b9
4 changed files with 56 additions and 26 deletions
|
|
@ -70,6 +70,16 @@ by the EIS implementation. It must no longer be used by the client.
|
|||
{% endraw %}
|
||||
{% endif %}
|
||||
|
||||
{% if request.context_type %}
|
||||
{% raw %}
|
||||
{{% notice style="note" %}}
|
||||
{% endraw %}
|
||||
This request is only available for clients of `ei_handshake.context_type.{{request.context_type}}`.
|
||||
{% raw %}
|
||||
{{% /notice %}}
|
||||
{% endraw %}
|
||||
{% endif %}
|
||||
|
||||
{{request.description.text|ei_escape_names}}
|
||||
|
||||
{% endfor %}
|
||||
|
|
@ -106,6 +116,16 @@ by the EIS implementation. It must no longer be used by the client.
|
|||
{% endraw %}
|
||||
{% endif %}
|
||||
|
||||
{% if event.context_type %}
|
||||
{% raw %}
|
||||
{{% notice style="note" %}}
|
||||
{% endraw %}
|
||||
This event is only available for clients of `ei_handshake.context_type.{{event.context_type}}`.
|
||||
{% raw %}
|
||||
{{% /notice %}}
|
||||
{% endraw %}
|
||||
{% endif %}
|
||||
|
||||
{{event.description.text|ei_escape_names}}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -139,9 +139,15 @@ class Message:
|
|||
interface: "Interface" = attr.ib()
|
||||
description: Optional[Description] = attr.ib(default=None)
|
||||
is_destructor: bool = attr.ib(default=False)
|
||||
context_type: Optional[str] = attr.ib(default=None)
|
||||
|
||||
arguments: list[Argument] = attr.ib(init=False, factory=list)
|
||||
|
||||
@context_type.validator # type: ignore
|
||||
def _context_type_validate(self, attr, value):
|
||||
if value not in [None, "sender", "receiver"]:
|
||||
raise ValueError(f"Invalid context type {value}")
|
||||
|
||||
def add_argument(self, arg: Argument) -> None:
|
||||
if arg.name in [a.name for a in self.arguments]:
|
||||
raise ValueError(f"Duplicate argument name '{arg.name}'")
|
||||
|
|
@ -570,6 +576,7 @@ class ProtocolParser(xml.sax.handler.ContentHandler):
|
|||
interface=self.current_interface,
|
||||
is_destructor=is_destructor,
|
||||
)
|
||||
request.context_type = attrs.get("context-type")
|
||||
try:
|
||||
self.current_interface.add_request(request)
|
||||
except ValueError as e:
|
||||
|
|
@ -604,6 +611,7 @@ class ProtocolParser(xml.sax.handler.ContentHandler):
|
|||
interface=self.current_interface,
|
||||
is_destructor=is_destructor,
|
||||
)
|
||||
event.context_type = attrs.get("context-type")
|
||||
try:
|
||||
self.current_interface.add_event(event)
|
||||
except ValueError as e:
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@
|
|||
<!ELEMENT request (description?,arg*)>
|
||||
<!ATTLIST request name CDATA #REQUIRED>
|
||||
<!ATTLIST request type CDATA #IMPLIED>
|
||||
<!ATTLIST request context-type CDATA #IMPLIED>
|
||||
<!ATTLIST request since CDATA #IMPLIED>
|
||||
<!ELEMENT event (description?,arg*)>
|
||||
<!ATTLIST event name CDATA #REQUIRED>
|
||||
<!ATTLIST event context-type CDATA #IMPLIED>
|
||||
<!ATTLIST event type CDATA #IMPLIED>
|
||||
<!ATTLIST event since CDATA #IMPLIED>
|
||||
<!ELEMENT enum (description?,entry*)>
|
||||
|
|
|
|||
|
|
@ -735,7 +735,7 @@
|
|||
</description>
|
||||
</request>
|
||||
|
||||
<request name="start_emulating" since="1">
|
||||
<request name="start_emulating" since="1" context-type="sender">
|
||||
<description summary="Device start emulating request">
|
||||
Notify the EIS implementation that the given device is about to start
|
||||
sending events. This should be seen more as a transactional boundary than a
|
||||
|
|
@ -767,7 +767,7 @@
|
|||
<arg name="sequence" type="uint32" summary="sequence number to identify this emulation sequence"/>
|
||||
</request>
|
||||
|
||||
<request name="stop_emulating" since="1">
|
||||
<request name="stop_emulating" since="1" context-type="sender">
|
||||
<description summary="Device start emulating request">
|
||||
Notify the EIS implementation that the given device is no longer sending
|
||||
events. See ei_device.start_emulating for details.
|
||||
|
|
@ -778,7 +778,7 @@
|
|||
<arg name="last_serial" type="uint32" summary="the last serial sent by the EIS implementation"/>
|
||||
</request>
|
||||
|
||||
<request name="frame" since="1">
|
||||
<request name="frame" since="1" context-type="sender">
|
||||
<description summary="Device frame request">
|
||||
Generate a frame event to group the current set of events
|
||||
into a logical hardware event. This function must be called after one
|
||||
|
|
@ -1053,7 +1053,7 @@
|
|||
<arg name="serial" type="uint32" summary="this event's serial number"/>
|
||||
</event>
|
||||
|
||||
<event name="start_emulating" since="1">
|
||||
<event name="start_emulating" since="1" context-type="receiver">
|
||||
<description summary="Device start emulating event">
|
||||
See the ei_device.start_emulating request for details.
|
||||
|
||||
|
|
@ -1064,7 +1064,7 @@
|
|||
<arg name="sequence" type="uint32"/>
|
||||
</event>
|
||||
|
||||
<event name="stop_emulating" since="1">
|
||||
<event name="stop_emulating" since="1" context-type="receiver">
|
||||
<description summary="Device stop emulating event">
|
||||
See the ei_device.stop_emulating request for details.
|
||||
|
||||
|
|
@ -1074,7 +1074,7 @@
|
|||
<arg name="serial" type="uint32" summary="this event's serial number"/>
|
||||
</event>
|
||||
|
||||
<event name="frame" since="1">
|
||||
<event name="frame" since="1" context-type="receiver">
|
||||
<description summary="Device frame event">
|
||||
See the ei_device.frame request for details.
|
||||
|
||||
|
|
@ -1110,7 +1110,7 @@
|
|||
</description>
|
||||
</request>
|
||||
|
||||
<request name="motion_relative" since="1">
|
||||
<request name="motion_relative" since="1" context-type="sender">
|
||||
<description summary="Relative motion request">
|
||||
Generate a relative motion event on this pointer.
|
||||
|
||||
|
|
@ -1127,7 +1127,7 @@
|
|||
<arg name="y" type="float" summary="the y movement in logical pixels"/>
|
||||
</request>
|
||||
|
||||
<request name="motion_absolute" since="1">
|
||||
<request name="motion_absolute" since="1" context-type="sender">
|
||||
<description summary="Absolute motion request">
|
||||
Generate an absolute motion event on this pointer. The x/y
|
||||
coordinates must be within the device's regions or the event
|
||||
|
|
@ -1146,7 +1146,7 @@
|
|||
<arg name="y" type="float" summary="the y position in logical pixels"/>
|
||||
</request>
|
||||
|
||||
<request name="scroll" since="1">
|
||||
<request name="scroll" since="1" context-type="sender">
|
||||
<description summary="Scroll request">
|
||||
Generate a a smooth (pixel-precise) scroll event on this pointer.
|
||||
Clients must not send ei_pointer.scroll_discrete events for the same event,
|
||||
|
|
@ -1163,7 +1163,7 @@
|
|||
<arg name="y" type="float" summary="the y movement in logical pixels"/>
|
||||
</request>
|
||||
|
||||
<request name="scroll_discrete" since="1">
|
||||
<request name="scroll_discrete" since="1" context-type="sender">
|
||||
<description summary="Scroll discrete request">
|
||||
Generate a a discrete (e.g. wheel) scroll event on this pointer.
|
||||
Clients must not send ei_pointer.scroll events for the same event,
|
||||
|
|
@ -1184,7 +1184,7 @@
|
|||
<arg name="y" type="int32" summary="the y movement in fractions or multiple of 120"/>
|
||||
</request>
|
||||
|
||||
<request name="scroll_stop" since="1">
|
||||
<request name="scroll_stop" since="1" context-type="sender">
|
||||
<description summary="Scroll stop request">
|
||||
Generate a a scroll stop or cancel event on this pointer.
|
||||
|
||||
|
|
@ -1222,7 +1222,7 @@
|
|||
<entry name="press" value="1" summary="the button is logically down"/>
|
||||
</enum>
|
||||
|
||||
<request name="button" since="1">
|
||||
<request name="button" since="1" context-type="sender">
|
||||
<description summary="Button state change request">
|
||||
Generate a button event on this pointer.
|
||||
|
||||
|
|
@ -1252,7 +1252,7 @@
|
|||
<arg name="serial" type="uint32" summary="this event's serial number"/>
|
||||
</event>
|
||||
|
||||
<event name="motion_relative" since="1">
|
||||
<event name="motion_relative" since="1" context-type="receiver">
|
||||
<description summary="Relative motion event">
|
||||
See the ei_pointer.motion_relative request for details.
|
||||
|
||||
|
|
@ -1263,7 +1263,7 @@
|
|||
<arg name="y" type="float"/>
|
||||
</event>
|
||||
|
||||
<event name="motion_absolute" since="1">
|
||||
<event name="motion_absolute" since="1" context-type="receiver">
|
||||
<description summary="Absolute motion event">
|
||||
See the ei_pointer.motion_absolute request for details.
|
||||
|
||||
|
|
@ -1274,7 +1274,7 @@
|
|||
<arg name="y" type="float"/>
|
||||
</event>
|
||||
|
||||
<event name="scroll" since="1">
|
||||
<event name="scroll" since="1" context-type="receiver">
|
||||
<description summary="Scroll event">
|
||||
See the ei_pointer.scroll request for details.
|
||||
|
||||
|
|
@ -1285,7 +1285,7 @@
|
|||
<arg name="y" type="float"/>
|
||||
</event>
|
||||
|
||||
<event name="scroll_discrete" since="1">
|
||||
<event name="scroll_discrete" since="1" context-type="receiver">
|
||||
<description summary="Discrete scroll event">
|
||||
See the ei_pointer.scroll_discrete request for details.
|
||||
|
||||
|
|
@ -1296,7 +1296,7 @@
|
|||
<arg name="y" type="int32"/>
|
||||
</event>
|
||||
|
||||
<event name="scroll_stop" since="1">
|
||||
<event name="scroll_stop" since="1" context-type="receiver">
|
||||
<description summary="Scroll stop event">
|
||||
|
||||
See the ei_pointer.scroll_stop request for details.
|
||||
|
|
@ -1308,7 +1308,7 @@
|
|||
<arg name="is_cancel" type="uint32"/>
|
||||
</event>
|
||||
|
||||
<event name="button" since="1">
|
||||
<event name="button" since="1" context-type="receiver">
|
||||
<description summary="Button state change event">
|
||||
See the ei_pointer.button request for details.
|
||||
|
||||
|
|
@ -1356,7 +1356,7 @@
|
|||
<entry name="press" value="1" summary="the key is logically down"/>
|
||||
</enum>
|
||||
|
||||
<request name="key" since="1">
|
||||
<request name="key" since="1" context-type="sender">
|
||||
<description summary="Key state change request">
|
||||
Generate a key event on this keyboard. If the device has an
|
||||
ei_device.keymap, the key code corresponds to that keymap.
|
||||
|
|
@ -1419,7 +1419,7 @@
|
|||
<arg name="keymap" type="fd" summary="file descriptor to the keymap"/>
|
||||
</event>
|
||||
|
||||
<event name="key" since="1">
|
||||
<event name="key" since="1" context-type="receiver">
|
||||
<description summary="Key state change event">
|
||||
See the ei_keyboard.key request for details.
|
||||
|
||||
|
|
@ -1481,7 +1481,7 @@
|
|||
</description>
|
||||
</request>
|
||||
|
||||
<request name="down" since="1">
|
||||
<request name="down" since="1" context-type="sender">
|
||||
<description summary="touch down request">
|
||||
Notifies the EIS implementation about a new touch logically down at the
|
||||
given coordinates. The touchid is a unique id for this touch. Touchids
|
||||
|
|
@ -1498,7 +1498,7 @@
|
|||
<arg name="y" type="float" summary="touch y coordinate in logical pixels"/>
|
||||
</request>
|
||||
|
||||
<request name="motion" since="1">
|
||||
<request name="motion" since="1" context-type="sender">
|
||||
<description summary="touch motion request">
|
||||
Notifies the EIS implementation about an existing touch changing position to
|
||||
the given coordinates. The touchid is the unique id for this touch previously
|
||||
|
|
@ -1515,7 +1515,7 @@
|
|||
<arg name="y" type="float" summary="touch y coordinate in logical pixels"/>
|
||||
</request>
|
||||
|
||||
<request name="up" since="1">
|
||||
<request name="up" since="1" context-type="sender">
|
||||
<description summary="touch up request">
|
||||
Notifies the EIS implementation about an existing touch being logically
|
||||
up. The touchid is the unique id for this touch previously
|
||||
|
|
@ -1543,7 +1543,7 @@
|
|||
<arg name="serial" type="uint32" summary="this event's serial number"/>
|
||||
</event>
|
||||
|
||||
<event name="down" since="1">
|
||||
<event name="down" since="1" context-type="receiver">
|
||||
<description summary="touch down request">
|
||||
See the ei_touchscreen.down request for details.
|
||||
|
||||
|
|
@ -1558,7 +1558,7 @@
|
|||
<arg name="y" type="float"/>
|
||||
</event>
|
||||
|
||||
<event name="motion" since="1">
|
||||
<event name="motion" since="1" context-type="receiver">
|
||||
<description summary="touch motion request">
|
||||
See the ei_touchscreen.motion request for details.
|
||||
|
||||
|
|
@ -1573,7 +1573,7 @@
|
|||
<arg name="y" type="float"/>
|
||||
</event>
|
||||
|
||||
<event name="up" since="1">
|
||||
<event name="up" since="1" context-type="receiver">
|
||||
<description summary="touch motion request">
|
||||
See the ei_touchscreen.up request for details.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue