Commit graph

73 commits

Author SHA1 Message Date
Peter Hutterer
76652350cc Add a mapping_id to the regions
This allows a caller to match up a region with other data, e.g. in the
remote desktop case the same mapping_id can be assigned to the pipewire
stream that represents that output.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-08-30 09:18:26 +10:00
Peter Hutterer
f081e8e79f proto: add a version argument to ei_connection.sync
This is the only request that creates a new object but doesn't specify
the version for that object, courtesy of copy/paste from the wayland
protocol. In libei/libeis this a bit was hidden away so it didn't get
noticed - but it was already buggy: libei would always hardcode to
version 1 but libeis would take whichever ei_callback version was agreed
upon during handshake. This version could be higher than 1.

This is a protocol break but we're still pre-1.0, there are very few
people that will be affected by this and it's better than having to
carry this bug around for years.

Fixes #35
2023-05-26 07:01:19 +00:00
Ian Douglas Scott
349ec5b790 doc/protcol: Change references of ei_device.keymap to ei_keyboard 2023-05-20 02:28:48 +00:00
Peter Hutterer
9d2568e55b proto: fix a typo 2023-05-16 15:47:49 +10:00
Peter Hutterer
e0a6c75cb4 protocol: widen the callback_data arg for ping/sync to 64bit
The only invocations we have right now of these callbacks ignore the
argument or force it to zero. But in the future we may have an interface
that requires a callback and that interface may need to store a
timestamp or object ID in this argument - so let's make sure we have
enough space for that.
2023-05-16 15:09:47 +10:00
Peter Hutterer
32c03fab35 proto: document the callback-data for pingpong/callback better 2023-05-16 15:06:49 +10:00
Peter Hutterer
a902d5dbd8 protocol: replace the capabilities enum with an interface list
Previously we had ei_seat.capabilities and ei_device.capabilities,
both referring to the same enum. The seat caps were used to bind,
the device caps were used to announce capabilities.

The device caps were already mostly superfluous as the information
they carried was implicitly available by the set of interfaces
the device announced - if the device has a keyboard interface
it must also have the keyboard capability.

So let's drop the separate enum and make the capabilities
the set of supported interfaces. In the device we can drop the
event directly and just send the interface list. In the seat
we have a capability event that sends each *possible* interface
with a custom-assigned mask. The client can then use that mask
to bind to the capability as before.

For example:
   <- ei_seat.capability(0x1, "ei_pointer")
   <- ei_seat.capability(0x4, "ei_keyboard")
   <- ei_seat.capability(0x8, "ei_touchscreen")
   <- ei_seat.done()
   -> ei_seat.bind(0x4 | 0x8)  # bind to keyboard and touchscreen
   <- ei_seat.device()
   -> ei_device.interface("ei_keyboard")
   -> ei_device.interface("ei_touchscreen")
   <- ei_device.done()

In the generated bindings we simply use the interface index
to generate the masks, but the protocol at least states that
the mask may not be constant.

Because the button/scroll interfaces are not exposed by the C API, some
of the handling is a bit awkward since we need to use both depending
whether we have pointer/pointer_absolute selected.

Fixes #28

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-02 05:53:25 +00:00
Peter Hutterer
bf88b34918 Split the ei_pointer interface up into its components
Split the ei_pointer protocol interface into ei_pointer,
ei_pointer_absolute, ei_scroll and ei_button.

This gets rid of the slightly awkward pointer vs pointer absolute
handling. Those were two different capabilities but tied to the same
interface.

Plus it paves the way for devices that are keyboards with scroll
buttons, etc.
2023-05-02 05:53:25 +00:00
Peter Hutterer
5b1b5aec1a proto: replace pointer/keyboard/touchscreen with a generic "interface" event
Since these events are merely notifications of a single object, we can make
this more generic. This allows us to introduce future capabilities without
having to bump the seat.
2023-04-06 13:57:18 +10:00
Peter Hutterer
8954d96227 Remove empty trailing newlines from all files 2023-03-13 08:52:08 +10:00
Peter Hutterer
5258a559eb doc/proto: remove the embedded docs from the proto, use static pages instead 2023-03-08 11:09:58 +10:00
Peter Hutterer
56004836b9 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.
2023-03-08 09:01:03 +10:00
Peter Hutterer
f4f6dabbe2 proto: fix references to ei_handshake.interface_version 2023-03-07 18:58:58 +10:00
Peter Hutterer
3b30c38a39 protocol: more protocol documentation 2023-03-07 15:26:36 +10:00
Peter Hutterer
442ce1edb8 proto: give a rough protocol overview as part of the docs 2023-03-07 11:33:35 +10:00
Peter Hutterer
4a3efa913a proto: more documentation improvements 2023-03-07 11:33:31 +10:00
Peter Hutterer
ebd7d102cd proto: clarify that the ei_seat capabilities depend on ei_device
Regardless of the ei_seat version, ei_seat.bind will support all
capablities of the negotiated ei_device interface. This means we don't need
to bump ei_seat just to add a new capability to ei_device.
2023-03-06 14:57:18 +10:00
Peter Hutterer
ea3ada1a80 proto: make the documentation an extractable set of XML tags
Instead of hiding this in a XML comment, let's make it a proper set of
tags so we can extract it and use it in generated documentation.
2023-03-03 11:38:40 +10:00
Peter Hutterer
70e2a9fbc2 protocol: fix two cross-references 2023-03-03 11:27:01 +10:00
Peter Hutterer
086f96a702 proto: split up message length and opcode again
Now that we have 64 bit integers on the wire and 64 bit object IDs,
we're already different to the Wayland protocol. So we might as well get
the full length and split message length and opcode again to make header
parsing and composing simpler.

This effectively reverts commit bf45a7182cb2f4c13f11e141fc846244d3ac6212.
2023-03-03 11:27:01 +10:00
Peter Hutterer
ba51f434a6 proto: switch object ids to 64 bits 2023-03-03 11:27:01 +10:00
Peter Hutterer
c832ce3ddc protocol: split the handshake version negotiation from the other interfaces
Previously, we'd send one interface_version event for "ei_handshake"
immediately but all others after the client requests handshake.finish.
This was too confusing to document and not clear how it would work, so
let's make this simpler by splitting it up.

There is now a handshake_version event from the server, sent immediately
on connection that denotes the maximum version number for the interface.
And a handshake_version request from the client which must be the first
one by the client.
2023-03-03 11:27:01 +10:00
Peter Hutterer
5d7f6ab188 protocol: more clarifications 2023-03-03 11:27:01 +10:00
Peter Hutterer
35f5fa102c proto: rename ei_connection_setup to ei_handshake
This is a better name for the initial handshake and easier to
distinguish from the ei_connection this way too.

Suggested by Jonas Ådahl.
2023-03-03 11:27:01 +10:00
Peter Hutterer
38dc5dc72f proto: shift the capabilities down by one
These were previously (1 << cap) for convenience but that results in the
capability mask on the wire starting at 2 - which is a bit awkward.

Lets shift them down by one so we start the mask at 1.
2023-03-03 11:27:01 +10:00
Peter Hutterer
ae8faa9fbb proto: improve the documentation
After some feedback from Jonas Ådahl and Julan Orth.
2023-03-03 11:27:01 +10:00
Peter Hutterer
11fb722e63 proto: fix wrong references to ei_callback in the pingpong interface 2023-03-03 11:27:01 +10:00
Peter Hutterer
47467bfe0e proto: rename connection_setup.done to .finish
Avoids ambiguity with the .done events from e.g. the seat or the device.
2023-03-03 11:27:01 +10:00
Peter Hutterer
0897722493 proto: drop the seat caps and cross-reference device caps instead 2023-03-03 11:27:01 +10:00
Jonas Ådahl
eecf69af48 protocol: Make timestamps a single 64 bit argument
With 64 bit integers on the wire, we don't need to split timestamps in
milliseconds and microsecond parts.
2023-03-03 11:27:01 +10:00
Jonas Ådahl
03c0ab73dd protocol: Add support for 64 bit integers on the wire
This is useful for e.g. not having to split timestamps.
2023-03-03 11:27:01 +10:00
Jonas Ådahl
cad5bc81bb protocol: Make integer explicitly sized
This means 'int' is explicitly 'int32' and 'uint' is explicitly
'uint32' in the protocol XML files.
2023-03-03 11:27:01 +10:00
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
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
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
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
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
5ee9f738a8 proto: document what a "protocol violation" means 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
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
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