Struct wayland_protocols::wp::text_input::zv1::server::zwp_text_input_v1::ZwpTextInputV1
source · pub struct ZwpTextInputV1 { /* private fields */ }
Expand description
text input
An object used for text input. Adds support for text input and input methods to applications. A text_input object is created from a wl_text_input_manager and corresponds typically to a text entry in an application.
Requests are used to activate/deactivate the text_input object and set state information like surrounding and selected text or the content type. The information about 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 generally UTF-8 encoded, indices and lengths are in bytes.
Serials are used to synchronize the state between the text input and an input method. New serials are sent by the text input in the commit_state request and are used by the input method to indicate the known text input state in events like preedit_string, commit_string, and keysym. The text input can then ignore events from the input method which are based on an outdated state (for example after a reset).
Warning! The protocol described in this file is experimental and backward incompatible changes may be made. Backward compatible changes may be added together with the corresponding interface version bump. Backward incompatible changes are done by bumping the version number in the protocol and interface names and resetting the interface version. Once the protocol is to be declared stable, the ‘z’ prefix and the version number in the protocol and interface names are removed and the interface version number is reset.
See also the Request enum for this interface.
Implementations§
source§impl ZwpTextInputV1
impl ZwpTextInputV1
sourcepub fn enter(&self, surface: &WlSurface)
pub fn enter(&self, surface: &WlSurface)
enter event
Notify the text_input object when it received focus. Typically in response to an activate request.
sourcepub fn leave(&self)
pub fn leave(&self)
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.
sourcepub fn modifiers_map(&self, map: Vec<u8>)
pub fn modifiers_map(&self, map: Vec<u8>)
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.
sourcepub fn input_panel_state(&self, state: u32)
pub fn input_panel_state(&self, state: u32)
state of the input panel
Notify when the visibility state of the input panel changed.
sourcepub fn preedit_string(&self, serial: u32, text: String, commit: String)
pub fn preedit_string(&self, serial: u32, 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 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.
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.
This event is handled as part of a following preedit_string event.
sourcepub fn commit_string(&self, serial: u32, text: String)
pub fn commit_string(&self, serial: u32, 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 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.
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.
sourcepub fn delete_surrounding_text(&self, index: i32, length: u32)
pub fn delete_surrounding_text(&self, index: i32, length: u32)
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.
sourcepub fn keysym(
&self,
serial: u32,
time: u32,
sym: u32,
state: u32,
modifiers: u32,
)
pub fn keysym( &self, serial: u32, 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 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)
sourcepub fn language(&self, serial: u32, language: String)
pub fn language(&self, serial: u32, language: String)
language
Sets the language of the input text. The “language” argument is an RFC-3066 format language tag.
sourcepub fn text_direction(&self, serial: u32, direction: TextDirection)
pub fn text_direction(&self, serial: u32, direction: 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.
Trait Implementations§
source§impl Borrow<ObjectId> for ZwpTextInputV1
impl Borrow<ObjectId> for ZwpTextInputV1
source§impl Clone for ZwpTextInputV1
impl Clone for ZwpTextInputV1
source§fn clone(&self) -> ZwpTextInputV1
fn clone(&self) -> ZwpTextInputV1
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ZwpTextInputV1
impl Debug for ZwpTextInputV1
source§impl Hash for ZwpTextInputV1
impl Hash for ZwpTextInputV1
source§impl PartialEq<Weak<ZwpTextInputV1>> for ZwpTextInputV1
impl PartialEq<Weak<ZwpTextInputV1>> for ZwpTextInputV1
source§impl PartialEq for ZwpTextInputV1
impl PartialEq for ZwpTextInputV1
source§impl Resource for ZwpTextInputV1
impl Resource for ZwpTextInputV1
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 ZwpTextInputV1
Auto Trait Implementations§
impl Freeze for ZwpTextInputV1
impl !RefUnwindSafe for ZwpTextInputV1
impl Send for ZwpTextInputV1
impl Sync for ZwpTextInputV1
impl Unpin for ZwpTextInputV1
impl !UnwindSafe for ZwpTextInputV1
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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.