#[non_exhaustive]pub enum Event<'a> {
Show 13 variants
Enter {
surface: WlSurface,
},
Leave,
ModifiersMap {
map: Vec<u8>,
},
InputPanelState {
state: u32,
},
PreeditString {
serial: u32,
text: String,
commit: String,
},
PreeditStyling {
index: u32,
length: u32,
style: WEnum<PreeditStyle>,
},
PreeditCursor {
index: i32,
},
CommitString {
serial: u32,
text: String,
},
CursorPosition {
index: i32,
anchor: i32,
},
DeleteSurroundingText {
index: i32,
length: u32,
},
Keysym {
serial: u32,
time: u32,
sym: u32,
state: u32,
modifiers: u32,
},
Language {
serial: u32,
language: String,
},
TextDirection {
serial: u32,
direction: WEnum<TextDirection>,
},
}
unstable
and server
only.Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Enter
enter event
Notify the text_input object when it received focus. Typically in response to an activate request.
Leave
leave event
Notify the text_input object when it lost focus. Either in response to a deactivate request or when the assigned surface lost focus or was destroyed.
ModifiersMap
modifiers map
Transfer an array of 0-terminated modifier names. The position in the array is the index of the modifier as used in the modifiers bitmask in the keysym event.
InputPanelState
state of the input panel
Notify when the visibility state of the input panel changed.
PreeditString
pre-edit
Notify when a new composing text (pre-edit) should be set around the current cursor position. Any previously set composing text should be removed.
The commit text can be used to replace the preedit text on reset (for example on unfocus).
The text input should also handle all preedit_style and preedit_cursor events occurring directly before preedit_string.
PreeditStyling
pre-edit styling
Sets styling information on composing text. The style is applied for length bytes from index relative to the beginning of the composing text (as byte offset). Multiple styles can be applied to a composing text by sending multiple preedit_styling events.
This event is handled as part of a following preedit_string event.
PreeditCursor
pre-edit cursor
Sets the cursor position inside the composing text (as byte offset) relative to the start of the composing text. When index is a negative number no cursor is shown.
This event is handled as part of a following preedit_string event.
CommitString
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). It could also be an empty text when some text should be removed (see delete_surrounding_text) or when the input cursor should be moved (see cursor_position).
Any previously set composing text should be removed.
CursorPosition
set cursor to new position
Notify when the cursor or anchor position should be modified.
This event should be handled as part of a following commit_string event.
DeleteSurroundingText
delete surrounding text
Notify when the text around the current cursor position should be deleted.
Index is relative to the current cursor (in bytes). Length is the length of deleted text (in bytes).
This event should be handled as part of a following commit_string event.
Keysym
keysym
Notify when a key event was sent. Key events should not be used for normal text input operations, which should be done with commit_string, delete_surrounding_text, etc. The key event follows the wl_keyboard key event convention. Sym is an XKB keysym, state a wl_keyboard key_state. Modifiers are a mask for effective modifiers (where the modifier indices are set by the modifiers_map event)
Fields
Language
language
Sets the language of the input text. The “language” argument is an RFC-3066 format language tag.
TextDirection
text direction
Sets the text direction of input text.
It is mainly needed for showing an input cursor on the correct side of the editor when there is no input done yet and making sure neutral direction text is laid out properly.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Event<'a>
impl<'a> !RefUnwindSafe for Event<'a>
impl<'a> Send for Event<'a>
impl<'a> Sync for Event<'a>
impl<'a> Unpin for Event<'a>
impl<'a> !UnwindSafe for Event<'a>
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§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
.source§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
.source§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.source§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.