Commit graph

135 commits

Author SHA1 Message Date
Peter Hutterer
d319c3a725 protocol: rename "type" arguments and events
Type is a reserved keyword in many languages, let's make this easier for
those.
2023-03-03 11:27:01 +10:00
Peter Hutterer
658a861c2a proto: add a serial number to the modifiers event 2023-03-03 11:27:01 +10:00
Peter Hutterer
36a3fd0166 meson: hook up a dtd check via xmllint 2023-03-03 11:27:01 +10:00
Peter Hutterer
b7ac763241 protocol: change type=bitmask to use the wayland protocol's bitfield=true 2023-03-03 11:27:01 +10:00
Peter Hutterer
5c860507e5 protocol: more explanations 2023-03-03 11:27:01 +10:00
Peter Hutterer
2227690287 scanner: parse the copyright tag 2023-03-03 11:27:01 +10:00
Peter Hutterer
8692e2592a scanner: use the proper SAXException class
The one we get is an internal subclass, let's not do that.
2023-03-03 11:27:01 +10:00
Peter Hutterer
7ad74b9886 scanner: fix mypy errors 2023-03-03 11:27:01 +10:00
Peter Hutterer
5f69ee2417 proto: switch to use the Wayland message header
No real functional changes, this just changes the message header to be
header = [object_id, msglen << 16 | opcode].

The only difference to the wayland protocol is now the fixed vs float
but otherwise tools that can print/debug/mangle the wayland protocol
should be easily adjustable for this protocol too..
2023-03-03 11:27:01 +10:00
Peter Hutterer
b5805c3e8a protocol: improve a comment 2023-03-03 11:27:01 +10:00
Peter Hutterer
e592a3d85a scanner: fix a few black complaints 2023-03-03 11:27:01 +10:00
Peter Hutterer
c8986b88ba scanner: parse the descriptions as well 2023-03-03 11:27:01 +10:00
Peter Hutterer
e5b37dedc8 protocol: add serial numbers to the various destroy events
This should allow EIS to track whether events that were sent before or
after a destruction of a resource.
2023-03-03 11:27:01 +10:00
Peter Hutterer
cebf4ce048 protocol: correct some comments 2023-03-03 11:27:01 +10:00
Peter Hutterer
cc0a06aed6 scanner: rename to as_c_arg and c_type for the c-specific functions 2023-03-03 11:27:01 +10:00
Peter Hutterer
4293f2f040 scanner: factor out the protocol type mapping to be global 2023-03-03 11:27:01 +10:00
Peter Hutterer
5e6e4d8fc9 scanner: separate the parser from the actual protocol
Let's not leak anything related to XML parsing into the class
we use as the actual protocol description.
2023-03-03 11:27:01 +10:00
Peter Hutterer
4414c91fca scanner: rename run to run_counter 2023-03-03 11:27:01 +10:00
Peter Hutterer
3499d26300 scanner: slightly clean up the XML error handling
Slight improvement in the code, nothing more.
2023-03-03 11:27:01 +10:00
Peter Hutterer
381bc9222a scanner: don't allow incoming/outgoing for modes other than ei/eis
We support mode "brei" now but that doesn't have a definition of incoming or
outgoing.
2023-03-03 11:27:01 +10:00
Peter Hutterer
0e70d06706 scanner: comments and some more type annotations 2023-03-03 11:27:01 +10:00
Peter Hutterer
72c570e096 scanner: pass the Enum to the Entry class
So we can compose the fqdn (and possibly do value checks and whatnot)
2023-03-03 11:27:01 +10:00
Peter Hutterer
1c9ce9b680 Add serial numbers to the protocol
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-03 11:27:01 +10:00
Peter Hutterer
845f990883 protocol: change the context type enum to start at 1
This avoids future bugs for treating this as a boolean field.
2023-03-03 11:27:01 +10:00
Peter Hutterer
30c4b8d528 protocol: a few more minor comments 2023-03-03 11:27:01 +10:00
Peter Hutterer
dd5bc6b6e7 proto: add a bunch of error reasons for debugging 2023-03-03 11:22:09 +10:00
Peter Hutterer
579f0d07d2 Add a brei-proto.h generated header file
This will be needed to have access to the various disconnect reasons in
brei-shared.c.
2023-03-03 11:21:26 +10:00
Peter Hutterer
8a52cbbe10 scanner: detect duplicates in the XML file 2023-03-03 11:21:26 +10:00
Peter Hutterer
5ee9f738a8 proto: document what a "protocol violation" means 2023-03-03 11:21:26 +10:00
Peter Hutterer
e07d4638d5 scanner: drop the Argument.argtype in favour of DBus-type bindings
This was a brei-specifc implementation detail that is not really needed,
we can use the single-character dbus-style bindings.
2023-03-03 11:21:26 +10:00
Peter Hutterer
f500a1cd43 scanner: expand the help description 2023-03-03 11:21:26 +10:00
Peter Hutterer
1e4d273cd4 scanner: add the "camel" jinja filter
For conversion into CamelCase
2023-03-03 11:21:26 +10:00
Peter Hutterer
8979802893 scanner: rename to ei-scanner 2023-03-03 11:21:26 +10:00
Peter Hutterer
027f85e195 proto: switch connection_setup.version to mirror interface_version requests
For most interfaces, the client announcing its supported version is
sufficient - the objects are all created server-side. For some
interfaces (ei_connection_setup and ei_callback right now) the client
needs to know the server-supported version.

So let's switch the current ei_connection_setup.version event (used to
negotiate ei_connection_setup's version) to a generic
`interface_version` event. This way our EIS implementation can
eventually send a version for ei_callback as well.
2023-03-03 11:21:26 +10:00
Peter Hutterer
273eda39ca Move the C proto templates to the src directory
These are very specific to libei/libeis, so let's not leave them
somewhere where they look like official bindings or something.
2023-03-03 11:21:26 +10:00
Peter Hutterer
29cf354de6 scanner: drop the Target class, push to templates
The Target was specific to libei/libeis, it resolved to "ei" or
"eis_client" depending on which component we were building. But that's
specific to our C implementation here, so let's push it into our C
implementation templates.
2023-03-03 11:21:26 +10:00
Peter Hutterer
df99fc923b proto: if the target object no longer exists, don't send events/requests 2023-03-03 11:21:26 +10:00
Peter Hutterer
6ed610e30e Split the ping/pong request into its own interface
Leave the ei_callback as-is and instead add ei_pingpong for the same
thing initiated by the server. The interface is otherwise identical but
for the direction it is supposed to flow.

This reduces the possibility of a client accidentally sending a
request when it is supposed to handle an event or vice versa.
2023-03-03 11:21:26 +10:00
Peter Hutterer
f41cc91599 proto: add a ping/pong request
This is effectively the same as connection.sync, but goes the other way.
This adds the ei_callback.done request.

In libeis this is (currently) enforced immediately after sending the
connection object. Not required there and makes the code a bit messier
but this way we can ensure that any client library handles that part of
the code.
2023-03-03 11:21:26 +10:00
Peter Hutterer
50013b4b3c protocol: fix a typo 2023-03-03 11:21:26 +10:00
Peter Hutterer
ea8df6402a scanner: handle since tags in enum values 2023-03-03 11:21:26 +10:00
Peter Hutterer
8c85b8fc1f protocol: add ei_connection.invalid_object
This event is to notify the client that an object used in a request was
unknown. This allows the client to work around race conditions like
binding to a seat that was removed.

This is currently the server-side only which is probably enough for now.
The only client-side created objects we have are the callbacks.
2023-03-03 11:21:26 +10:00
Peter Hutterer
f6cfe9803c scanner: make the invalid type message a bit easier to identify 2023-03-03 11:21:26 +10:00
Peter Hutterer
34889d4803 scanner: pass the component through as well
For the cases where we have to add "ei" or "eis" in a random place in
the template.
2023-03-03 11:21:26 +10:00
Peter Hutterer
d84ddd51e5 protocol: complete documentation for the protocol XML file 2023-03-03 11:21:26 +10:00
Peter Hutterer
a590537c8a protocol: mark the various destroyed events as destructors 2023-03-03 11:21:26 +10:00
Peter Hutterer
0a8501d882 protocol: mark the disconnected event as destructor 2023-03-03 11:21:26 +10:00
Peter Hutterer
cfbb906358 protocol: rename type to context_type
type is a reserved keyword in many languages, let's not make this harder
to use than necessary
2023-03-03 11:21:26 +10:00
Peter Hutterer
bf77479c6a protocol: rename the interface request to interface_version
More descriptive this way
2023-03-03 11:21:26 +10:00
Peter Hutterer
9e731ddf04 scanner: parse the type="destructor" attribute on requests/events 2023-03-03 11:21:26 +10:00