Skip to content

Add high-level ei_text keysym and utf8 events - #27

Merged
ids1024 merged 1 commit into
ids1024:masterfrom
lamco-admin:text-events
Jun 15, 2026
Merged

Add high-level ei_text keysym and utf8 events#27
ids1024 merged 1 commit into
ids1024:masterfrom
lamco-admin:text-events

Conversation

@glamberson

Copy link
Copy Markdown
Contributor

libei 1.6.0 (#12) added the ei_text interface and its generated bindings, but left the high-level converters as panic!() stubs on both sides. This implements them, following the existing keyboard/button/touchscreen patterns.

Client side (event.rs): ei_text.keysym and ei_text.utf8 now produce TextKeysym and TextUtf8 events resolved to their device. ei_text.destroyed updates the serial and drops the interface, matching the cleanup done for the other destructible interfaces.

Server side (request.rs): ei_text.keysym and ei_text.utf8 produce the corresponding requests. utf8 strings are validated against the protocol bounds (non-empty, at most 254 bytes), returning a new InvalidTextLength error otherwise. ei_text.release removes the interface and sends destroyed with the next serial.

It also adds eis::Text to destroy_interface, which otherwise hits unreachable!() when a device carrying a Text interface is removed.

This adds variants to the public EiEvent, EisRequest, and RequestError enums, so it is API-breaking, intended for the libei 1.6.0 breaking release. Independent of #21; based on master.

The ei_text interface (added in libei 1.6.0) had its high-level
converters stubbed out with panics on both the receiver and sender
sides. Replace those stubs with real high-level events and requests,
following the existing keyboard, button, and touchscreen patterns.

Client side (event.rs): ei_text.keysym and ei_text.utf8 now produce
TextKeysym and TextUtf8 events resolved to their device. ei_text.destroyed
updates the serial and drops the interface, matching the cleanup done for
the other destructible interfaces.

Server side (request.rs): ei_text.keysym and ei_text.utf8 produce
TextKeysym and TextUtf8 requests. utf8 strings are validated against the
protocol bounds (non-empty, at most 254 bytes), returning the new
InvalidTextLength error otherwise. ei_text.release removes the interface
and sends destroyed with the next serial.

@ids1024 ids1024 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. When I got back to finishing #12 I forgot this was just written as a panic!, and only make the changes needed to get libei unit tests working (it could probably use a test for ei_text).

Everything here looks good. Thanks!

@ids1024
ids1024 merged commit 2c9bef2 into ids1024:master Jun 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants