Struct ZwpInputMethodV2

Source
pub struct ZwpInputMethodV2 { /* private fields */ }
Expand description

input method

An input method object allows for clients to compose text.

The objects connects the client to a text input in an application, and lets the client to serve as an input method for a seat.

The zwp_input_method_v2 object can occupy two distinct states: active and inactive. In the active state, the object is associated to and communicates with a text input. In the inactive state, there is no associated text input, and the only communication is with the compositor. Initially, the input method is in the inactive state.

Requests issued in the inactive state must be accepted by the compositor. Because of the serial mechanism, and the state reset on activate event, they will not have any effect on the state of the next text input.

There must be no more than one input method object per seat.

See also the Event enum for this interface.

Implementations§

Source§

impl ZwpInputMethodV2

Source

pub fn commit_string(&self, text: String)

commit string

Send the commit string text for insertion to the application.

Inserts a string at current cursor position (see commit event sequence). The string to commit could be either just a single character after a key press or the result of some composing.

The argument text is a buffer containing the string to insert. There is a maximum length of wayland messages, so text can not be longer than 4000 bytes.

Values set with this event are double-buffered. They must be applied and reset to initial on the next zwp_text_input_v3.commit request.

The initial value of text is an empty string.

Source

pub fn set_preedit_string( &self, text: String, cursor_begin: i32, cursor_end: i32, )

pre-edit string

Send the pre-edit string text to the application text input.

Place a new composing text (pre-edit) at the current cursor position. Any previously set composing text must be removed. Any previously existing selected text must be removed. The cursor is moved to a new position within the preedit string.

The argument text is a buffer containing the preedit string. There is a maximum length of wayland messages, so text can not be longer than 4000 bytes.

The arguments cursor_begin and cursor_end are counted in bytes relative to the beginning of the submitted string buffer. Cursor should be hidden by the text input when both are equal to -1.

cursor_begin indicates the beginning of the cursor. cursor_end indicates the end of the cursor. It may be equal or different than cursor_begin.

Values set with this event are double-buffered. They must be applied on the next zwp_input_method_v2.commit event.

The initial value of text is an empty string. The initial value of cursor_begin, and cursor_end are both 0.

Source

pub fn delete_surrounding_text(&self, before_length: u32, after_length: u32)

delete text

Remove the surrounding text.

before_length and after_length are the number of bytes before and after the current cursor index (excluding the preedit text) to delete.

If any preedit text is present, it is replaced with the cursor for the purpose of this event. In effect before_length is counted from the beginning of preedit text, and after_length from its end (see commit event sequence).

Values set with this event are double-buffered. They must be applied and reset to initial on the next zwp_input_method_v2.commit request.

The initial values of both before_length and after_length are 0.

Source

pub fn commit(&self, serial: u32)

apply state

Apply state changes from commit_string, set_preedit_string and delete_surrounding_text requests.

The state relating to these events is double-buffered, and each one modifies the pending state. This request replaces the current state with the pending state.

The connected text input is expected to 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_input_method_v2 object known to the client. The value of the serial argument must be equal to the number of done events already issued by that object. When the compositor receives a commit request with a serial different than the number of past done events, it must proceed as normal, except it should not change the current state of the zwp_input_method_v2 object.

Source

pub fn get_input_popup_surface<U, D>( &self, surface: &WlSurface, qh: &QueueHandle<D>, udata: U, ) -> ZwpInputPopupSurfaceV2
where U: Send + Sync + 'static, D: Dispatch<ZwpInputPopupSurfaceV2, U> + 'static,

create popup surface

Creates a new zwp_input_popup_surface_v2 object wrapping a given surface.

The surface gets assigned the “input_popup” role. If the surface already has an assigned role, the compositor must issue a protocol error.

Source

pub fn grab_keyboard<U, D>( &self, qh: &QueueHandle<D>, udata: U, ) -> ZwpInputMethodKeyboardGrabV2
where U: Send + Sync + 'static, D: Dispatch<ZwpInputMethodKeyboardGrabV2, U> + 'static,

grab hardware keyboard

Allow an input method to receive hardware keyboard input and process key events to generate text events (with pre-edit) over the wire. This allows input methods which compose multiple key events for inputting text like it is done for CJK languages.

The compositor should send all keyboard events on the seat to the grab holder via the returned wl_keyboard object. Nevertheless, the compositor may decide not to forward any particular event. The compositor must not further process any event after it has been forwarded to the grab holder.

Releasing the resulting wl_keyboard object releases the grab.

Source

pub fn destroy(&self)

destroy the text input

Destroys the zwp_text_input_v2 object and any associated child objects, i.e. zwp_input_popup_surface_v2 and zwp_input_method_keyboard_grab_v2.

Trait Implementations§

Source§

impl Borrow<ObjectId> for ZwpInputMethodV2

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Clone for ZwpInputMethodV2

Source§

fn clone(&self) -> ZwpInputMethodV2

Returns a duplicate 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 ZwpInputMethodV2

Source§

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

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

impl<D, U> Dispatch<ZwpInputMethodV2, U, D> for InputMethod

Source§

fn event( data: &mut D, input_method: &ZwpInputMethodV2, event: Event, udata: &U, conn: &Connection, qh: &QueueHandle<D>, )

Called when an event from the server is processed Read more
Source§

fn event_created_child( opcode: u16, _qhandle: &QueueHandle<State>, ) -> Arc<dyn ObjectData>

Method used to initialize the user-data of objects created by events Read more
Source§

impl Hash for ZwpInputMethodV2

Source§

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

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<ZwpInputMethodV2>> for ZwpInputMethodV2

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for ZwpInputMethodV2

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Proxy for ZwpInputMethodV2

Source§

type Request<'request> = Request<'request>

The request enum for this interface
Source§

type 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>(&self) -> Option<&U>
where U: Send + Sync + 'static,

Access the user-data associated with this object
Source§

fn object_data(&self) -> Option<&Arc<dyn ObjectData>>

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

fn backend(&self) -> &WeakBackend

Access the backend associated with this object
Source§

fn send_request( &self, req: <ZwpInputMethodV2 as Proxy>::Request<'_>, ) -> Result<(), InvalidId>

Send a request for this object. Read more
Source§

fn send_constructor<I>( &self, req: <ZwpInputMethodV2 as Proxy>::Request<'_>, data: Arc<dyn ObjectData>, ) -> Result<I, InvalidId>
where I: Proxy,

Send a request for this object that creates another object. Read more
Source§

fn from_id( conn: &Connection, id: ObjectId, ) -> Result<ZwpInputMethodV2, InvalidId>

Create an object proxy from its ID Read more
Source§

fn inert(backend: WeakBackend) -> ZwpInputMethodV2

Create an inert object proxy Read more
Source§

fn parse_event( conn: &Connection, msg: Message<ObjectId, OwnedFd>, ) -> Result<(ZwpInputMethodV2, <ZwpInputMethodV2 as Proxy>::Event), DispatchError>

Parse a event for this object Read more
Source§

fn write_request<'a>( &self, conn: &Connection, msg: <ZwpInputMethodV2 as Proxy>::Request<'a>, ) -> Result<(Message<ObjectId, BorrowedFd<'a>>, Option<(&'static Interface, u32)>), InvalidId>

Serialize a request for this object Read more
Source§

fn is_alive(&self) -> bool

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

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

Creates a weak handle to this object Read more
Source§

impl Eq for ZwpInputMethodV2

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
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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

Source§

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

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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,

Source§

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

Source§

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

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more