pub struct ZwpTextInputV2 { /* private fields */ }
Expand description
text input
The zwp_text_input_v2 interface represents text input and input methods associated with a seat. It provides enter/leave events to follow the text input focus for a seat.
Requests are used to enable/disable the text-input object and set state information like surrounding and selected text or the content type. The information about the entered text is sent to the text-input object via the pre-edit and commit events. Using this interface removes the need for applications to directly process hardware key events and compose text out of them.
Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices have to always point to the first byte of an UTF-8 encoded code point. Lengths are not allowed to contain just a part of an UTF-8 encoded code point.
State is sent by the state requests (set_surrounding_text, set_content_type, set_cursor_rectangle and set_preferred_language) and an update_state request. After an enter or an input_method_change event all state information is invalidated and needs to be resent from the client. A reset or entering a new widget on client side also invalidates all current state information.
See also the Request enum for this interface.
Implementations§
Source§impl ZwpTextInputV2
impl ZwpTextInputV2
Sourcepub fn enter(&self, serial: u32, surface: &WlSurface)
pub fn enter(&self, serial: u32, surface: &WlSurface)
enter event
Notification that this seat’s text-input focus is on a certain surface.
When the seat has the keyboard capability the text-input focus follows the keyboard focus.
Sourcepub fn leave(&self, serial: u32, surface: &WlSurface)
pub fn leave(&self, serial: u32, surface: &WlSurface)
leave event
Notification that this seat’s text-input focus is no longer on a certain surface.
The leave notification is sent before the enter notification for the new focus.
When the seat has the keyboard capability the text-input focus follows the keyboard focus.
Sourcepub fn input_panel_state(
&self,
state: InputPanelVisibility,
x: i32,
y: i32,
width: i32,
height: i32,
)
pub fn input_panel_state( &self, state: InputPanelVisibility, x: i32, y: i32, width: i32, height: i32, )
state of the input panel
Notification that the visibility of the input panel (virtual keyboard) changed.
The rectangle x, y, width, height defines the area overlapped by the input panel (virtual keyboard) on the surface having the text focus in surface local coordinates.
That can be used to make sure widgets are visible and not covered by a virtual keyboard.
Sourcepub fn preedit_string(&self, text: String, commit: String)
pub fn preedit_string(&self, text: String, commit: String)
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 composing text in some cases (for example when losing focus).
The text input should also handle all preedit_style and preedit_cursor events occurring directly before preedit_string.
Sourcepub fn preedit_styling(&self, index: u32, length: u32, style: PreeditStyle)
pub fn preedit_styling(&self, index: u32, length: u32, style: PreeditStyle)
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.
Sourcepub fn preedit_cursor(&self, index: i32)
pub fn preedit_cursor(&self, index: i32)
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.
When no preedit_cursor event is sent the cursor will be at the end of the composing text by default.
This event is handled as part of a following preedit_string event.
Sourcepub fn commit_string(&self, text: String)
pub fn commit_string(&self, text: String)
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 be also 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.
Sourcepub fn cursor_position(&self, index: i32, anchor: i32)
pub fn cursor_position(&self, index: i32, anchor: i32)
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.
The text between anchor and index should be selected.
Sourcepub fn delete_surrounding_text(&self, before_length: u32, after_length: u32)
pub fn delete_surrounding_text(&self, before_length: u32, after_length: u32)
delete surrounding text
Notify when the text around the current cursor position should be deleted. BeforeLength and afterLength is the length (in bytes) of text before and after the current cursor position (excluding the selection) to delete.
This event should be handled as part of a following commit_string or preedit_string event.
Sourcepub fn modifiers_map(&self, map: Vec<u8>)
pub fn modifiers_map(&self, map: Vec<u8>)
modifiers map
Transfer an array of 0-terminated modifiers names. The position in the array is the index of the modifier as used in the modifiers bitmask in the keysym event.
Sourcepub fn keysym(&self, time: u32, sym: u32, state: u32, modifiers: u32)
pub fn keysym(&self, time: u32, sym: u32, state: u32, modifiers: u32)
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 a 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)
Sourcepub fn language(&self, language: String)
pub fn language(&self, language: String)
language
Sets the language of the input text. The “language” argument is a RFC-3066 format language tag.
Sourcepub fn text_direction(&self, direction: TextDirection)
pub fn text_direction(&self, direction: TextDirection)
text direction
Sets the text direction of input text.
It is mainly needed for showing input cursor on correct side of the editor when there is no input yet done and making sure neutral direction text is laid out properly.
Sourcepub fn configure_surrounding_text(&self, before_cursor: i32, after_cursor: i32)
pub fn configure_surrounding_text(&self, before_cursor: i32, after_cursor: i32)
configure amount of surrounding text to be sent
Configure what amount of surrounding text is expected by the input method. The surrounding text will be sent in the set_surrounding_text request on the following state information updates.
Sourcepub fn input_method_changed(&self, serial: u32, flags: u32)
pub fn input_method_changed(&self, serial: u32, flags: u32)
Notifies about a changed input method
The input method changed on compositor side, which invalidates all current state information. New state information should be sent from the client via state requests (set_surrounding_text, set_content_hint, …) and update_state.
Trait Implementations§
Source§impl Borrow<ObjectId> for ZwpTextInputV2
impl Borrow<ObjectId> for ZwpTextInputV2
Source§impl Clone for ZwpTextInputV2
impl Clone for ZwpTextInputV2
Source§fn clone(&self) -> ZwpTextInputV2
fn clone(&self) -> ZwpTextInputV2
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ZwpTextInputV2
impl Debug for ZwpTextInputV2
Source§impl Hash for ZwpTextInputV2
impl Hash for ZwpTextInputV2
Source§impl PartialEq<Weak<ZwpTextInputV2>> for ZwpTextInputV2
impl PartialEq<Weak<ZwpTextInputV2>> for ZwpTextInputV2
Source§impl PartialEq for ZwpTextInputV2
impl PartialEq for ZwpTextInputV2
Source§impl Resource for ZwpTextInputV2
impl Resource for ZwpTextInputV2
Source§fn object_data(&self) -> Option<&Arc<dyn Any + Send + Sync>>
fn object_data(&self) -> Option<&Arc<dyn Any + Send + Sync>>
Source§fn handle(&self) -> &WeakHandle
fn handle(&self) -> &WeakHandle
Source§fn from_id(conn: &DisplayHandle, id: ObjectId) -> Result<Self, InvalidId>
fn from_id(conn: &DisplayHandle, id: ObjectId) -> Result<Self, InvalidId>
Source§fn send_event(&self, evt: Self::Event<'_>) -> Result<(), InvalidId>
fn send_event(&self, evt: Self::Event<'_>) -> Result<(), InvalidId>
Source§fn parse_request(
conn: &DisplayHandle,
msg: Message<ObjectId, OwnedFd>,
) -> Result<(Self, Self::Request), DispatchError>
fn parse_request( conn: &DisplayHandle, msg: Message<ObjectId, OwnedFd>, ) -> Result<(Self, Self::Request), DispatchError>
Source§fn write_event<'a>(
&self,
conn: &DisplayHandle,
msg: Self::Event<'a>,
) -> Result<Message<ObjectId, BorrowedFd<'a>>, InvalidId>
fn write_event<'a>( &self, conn: &DisplayHandle, msg: Self::Event<'a>, ) -> Result<Message<ObjectId, BorrowedFd<'a>>, InvalidId>
Source§fn is_alive(&self) -> bool
fn is_alive(&self) -> bool
impl Eq for ZwpTextInputV2
Auto Trait Implementations§
impl Freeze for ZwpTextInputV2
impl !RefUnwindSafe for ZwpTextInputV2
impl Send for ZwpTextInputV2
impl Sync for ZwpTextInputV2
impl Unpin for ZwpTextInputV2
impl !UnwindSafe for ZwpTextInputV2
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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.