Add high-level ei_text keysym and utf8 events - #27
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libei 1.6.0 (#12) added the
ei_textinterface and its generated bindings, but left the high-level converters aspanic!()stubs on both sides. This implements them, following the existing keyboard/button/touchscreen patterns.Client side (
event.rs):ei_text.keysymandei_text.utf8now produceTextKeysymandTextUtf8events resolved to their device.ei_text.destroyedupdates the serial and drops the interface, matching the cleanup done for the other destructible interfaces.Server side (
request.rs):ei_text.keysymandei_text.utf8produce the corresponding requests. utf8 strings are validated against the protocol bounds (non-empty, at most 254 bytes), returning a newInvalidTextLengtherror otherwise.ei_text.releaseremoves the interface and sendsdestroyedwith the next serial.It also adds
eis::Texttodestroy_interface, which otherwise hitsunreachable!()when a device carrying a Text interface is removed.This adds variants to the public
EiEvent,EisRequest, andRequestErrorenums, so it is API-breaking, intended for the libei 1.6.0 breaking release. Independent of #21; based on master.