pub struct ZwpInputMethodV2(/* private fields */);

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( &self, surface: &WlSurface, ) -> Main<ZwpInputPopupSurfaceV2>

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(&self) -> Main<ZwpInputMethodKeyboardGrabV2>

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.

This is a destructor, you cannot send requests to this object any longer once this method is called.

Trait Implementations§

Source§

impl AsRef<Proxy<ZwpInputMethodV2>> for ZwpInputMethodV2

Source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
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

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

impl From<Proxy<ZwpInputMethodV2>> for ZwpInputMethodV2

Source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
Source§

impl From<ZwpInputMethodV2> for Proxy<ZwpInputMethodV2>

Source§

fn from(value: ZwpInputMethodV2) -> Self

Converts to this type from the input type.
Source§

impl Interface for ZwpInputMethodV2

Source§

const NAME: &'static str = "zwp_input_method_v2"

Name of this interface
Source§

const VERSION: u32 = 1u32

Maximum supported version of this interface Read more
Source§

type Request = Request

Set of requests associated to this interface Read more
Source§

type Event = Event

Set of events associated to this interface Read more
Source§

fn c_interface() -> *const wl_interface

Pointer to the C representation of this interface
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 Eq for ZwpInputMethodV2

Source§

impl StructuralPartialEq 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, 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.