pub struct ZwpTextInputV3 { /* private fields */ }
Expand description

text input

The zwp_text_input_v3 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 preedit_string and commit_string events.

Text is valid UTF-8 encoded, indices and lengths are in bytes. Indices must not point to middle bytes inside a code point: they must either point to the first byte of a code point or to the end of the buffer. Lengths must be measured between two valid indices.

Focus moving throughout surfaces will result in the emission of zwp_text_input_v3.enter and zwp_text_input_v3.leave events. The focused surface must commit zwp_text_input_v3.enable and zwp_text_input_v3.disable requests as the keyboard focus moves across editable and non-editable elements of the UI. Those two requests are not expected to be paired with each other, the compositor must be able to handle consecutive series of the same request.

State is sent by the state requests (set_surrounding_text, set_content_type and set_cursor_rectangle) and a commit request. After an enter event or disable request all state information is invalidated and needs to be resent by the client.

See also the Request enum for this interface.

Implementations§

source§

impl ZwpTextInputV3

source

pub fn enter(&self, surface: &WlSurface)

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.

source

pub fn leave(&self, surface: &WlSurface)

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.

source

pub fn preedit_string( &self, text: Option<String>, cursor_begin: i32, cursor_end: i32 )

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.

source

pub fn commit_string(&self, text: Option<String>)

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.

source

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.

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.

source

pub fn done(&self, serial: u32)

apply changes

Instruct the application to apply changes to state requested by the preedit_string, commit_string and delete_surrounding_text 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:

  1. Replace existing preedit string with the cursor.
  2. Delete requested surrounding text.
  3. Insert commit string with the cursor at its end.
  4. Calculate surrounding text to send.
  5. Insert new preedit text in cursor position.
  6. Place cursor inside preedit text.

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.

Trait Implementations§

source§

impl Borrow<ObjectId> for ZwpTextInputV3

source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
source§

impl Clone for ZwpTextInputV3

source§

fn clone(&self) -> ZwpTextInputV3

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ZwpTextInputV3

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for ZwpTextInputV3

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<Weak<ZwpTextInputV3>> for ZwpTextInputV3

source§

fn eq(&self, other: &Weak<ZwpTextInputV3>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for ZwpTextInputV3

source§

fn eq(&self, other: &ZwpTextInputV3) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Resource for ZwpTextInputV3

§

type Request = Request

The request enum for this interface
§

type Event<'event> = Event<'event>

The event enum for this interface
source§

fn interface() -> &'static Interface

The interface description
source§

fn id(&self) -> ObjectId

The ID of this object
source§

fn version(&self) -> u32

The version of this object
source§

fn data<U: 'static>(&self) -> Option<&U>

Access the user-data associated with this object
source§

fn object_data(&self) -> Option<&Arc<dyn Any + Send + Sync>>

Access the raw data associated with this object. Read more
source§

fn handle(&self) -> &WeakHandle

Access the backend handle associated with this object
source§

fn from_id(conn: &DisplayHandle, id: ObjectId) -> Result<Self, InvalidId>

Create an object resource from its ID Read more
source§

fn send_event(&self, evt: Self::Event<'_>) -> Result<(), InvalidId>

Send an event to this object
source§

fn parse_request( conn: &DisplayHandle, msg: Message<ObjectId, OwnedFd> ) -> Result<(Self, Self::Request), DispatchError>

Parse a event for this object Read more
source§

fn write_event<'a>( &self, conn: &DisplayHandle, msg: Self::Event<'a> ) -> Result<Message<ObjectId, BorrowedFd<'a>>, InvalidId>

Serialize an event for this object Read more
source§

fn client(&self) -> Option<Client>

The client owning this object Read more
source§

fn is_alive(&self) -> bool

Checks if the Wayland object associated with this proxy is still alive
source§

fn post_error(&self, code: impl Into<u32>, error: impl Into<String>)

Trigger a protocol error on this object Read more
source§

fn downgrade(&self) -> Weak<Self>

Creates a weak handle to this object Read more
source§

impl Eq for ZwpTextInputV3

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.