#[non_exhaustive]pub enum Event {
Enter {
surface: WlSurface,
},
Leave {
surface: WlSurface,
},
PreeditString {
text: Option<String>,
cursor_begin: i32,
cursor_end: i32,
},
CommitString {
text: Option<String>,
},
DeleteSurroundingText {
before_length: u32,
after_length: u32,
},
Done {
serial: u32,
},
Action {
action: WEnum<Action>,
serial: u32,
},
Language {
language: String,
},
PreeditHint {
start: u32,
end: u32,
hint: WEnum<PreeditHint>,
},
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Enter
enter event
Notification that this seat’s text-input focus is on a certain surface.
If client has created multiple text input objects, compositor must send this event to all of them.
When the seat has the keyboard capability the text-input focus follows the keyboard focus. This event sets the current surface for the text-input object.
Leave
leave event
Notification that this seat’s text-input focus is no longer on a certain surface. The client should reset any preedit string previously set.
The leave notification clears the current surface. It is sent before the enter notification for the new focus. After leave event, compositor must ignore requests from any text input instances until next enter event.
When the seat has the keyboard capability the text-input focus follows the keyboard focus.
PreeditString
pre-edit
Notify when a new composing text (pre-edit) should be set at the current cursor position. Any previously set composing text must be removed. Any previously existing selected text must be removed.
The argument text contains the pre-edit string buffer.
The parameters cursor_begin and cursor_end are counted in bytes relative to the beginning of the submitted text buffer. Cursor should be hidden when both are equal to -1.
They could be represented by the client as a line if both values are the same, or as a text highlight otherwise.
Values set with this event are double-buffered. They must be applied and reset to initial on the next zwp_text_input_v3.done event.
The initial value of text is an empty string, and cursor_begin, cursor_end and cursor_hidden are all 0.
CommitString
text commit
Notify when text should be inserted into the editor widget. The text to commit could be either just a single character after a key press or the result of some composing (pre-edit).
Values set with this event are double-buffered. They must be applied and reset to initial on the next zwp_text_input_v3.done event.
The initial value of text is an empty string.
DeleteSurroundingText
delete surrounding text
Notify when the text around the current cursor position should be deleted.
Before_length and after_length are the number of bytes before and after the current cursor index (excluding the selection) to delete.
If a preedit text is present, in effect before_length is counted from the beginning of it, and after_length from its end (see done event sequence).
Values set with this event are double-buffered. They must be applied and reset to initial on the next zwp_text_input_v3.done event.
The initial values of both before_length and after_length are 0.
Fields
Done
apply changes
Instruct the application to apply changes to state requested by the preedit_string, commit_string delete_surrounding_text, and action events.
The state relating to these events is double-buffered, and each one modifies the pending state. This event replaces the current state with the pending state.
The application must proceed by evaluating the changes in the following order:
- Replace existing preedit string with the cursor.
- Delete requested surrounding text.
- Insert commit string with the cursor at its end.
- Calculate surrounding text to send.
- Insert new preedit text in cursor position.
- Place cursor inside preedit text.
- Perform the requested action.
The serial number reflects the last state of the zwp_text_input_v3 object known to the compositor. The value of the serial argument must be equal to the number of commit requests already issued on that object.
When the client receives a done event with a serial different than the number of past commit requests, it must proceed with evaluating and applying the changes as normal, except it should not change the current state of the zwp_text_input_v3 object. All pending state requests (set_surrounding_text, set_content_type and set_cursor_rectangle) on the zwp_text_input_v3 object should be sent and committed after receiving a zwp_text_input_v3.done event with a matching serial.
Action
action performed
An action was performed on this text input.
Values set with this event are double-buffered. They must be applied and reset to initial on the next zwp_text_input_v3.done event.
The initial value of action is none.
Only available since version 2 of the interface
Language
notify of language selection
Notify the application of language used by the input method.
This event will be sent on creation if known and for all subsequent changes.
The language should be specified as an IETF BCP 47 tag. Setting an empty string will reset any known language back to the default unknown state.
Only available since version 2 of the interface
PreeditHint
pre-edit
Notify of contextual hints for the pre-edit string. This event is always sent together with a zwp_text_input_v3.preedit_string event.
The parameters start and end are counted in bytes relative to the beginning of the text buffer submitted through zwp_text_input_v3.preedit_string, and represent the substring in the pre-edit text affected by the hint.
Multiple events may be submitted if the preedit string has different sections. The extent of hints may overlap. The parts of the preedit string that are not covered by any zwp_text_input_v3.preedit_hint event, the text will be considered unhinted. This is also the case if no preedit_hint event is sent.
Clients should provide recognizable visuals to these hints. if they are unable to comply with this requisition, it may be preferable for them keep the preedit_shown content hint disabled.
Values set with this event are double-buffered. They must be applied and reset on the next zwp_text_input_v3.done event.
Only available since version 2 of the interface
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Event
impl !RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl !UnwindSafe for Event
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.