pub struct XxInputMethodV1 { /* private fields */ }server only.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 xx_input_method_v1 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 Request enum for this interface.
Implementations§
Source§impl XxInputMethodV1
impl XxInputMethodV1
Sourcepub fn activate(&self)
pub fn activate(&self)
input method has been requested
Notification that a text input focused on this seat requested the input method to be activated.
This event serves the purpose of providing the compositor with an active input method.
This event resets all state associated with previous enable, disable, surrounding_text, text_change_cause, and content_type events, as well as the state associated with set_preedit_string, commit_string, and delete_surrounding_text requests, and destroys any existing input_popup_surface objects. In addition, it marks the xx_input_method_v1 object as active.
The surrounding_text, and content_type events must follow before the next done event if the text input supports the respective functionality.
State set with this event is double-buffered. It will get applied on the next xx_input_method_v1.done event, and stay valid until changed.
Sourcepub fn deactivate(&self)
pub fn deactivate(&self)
deactivate event
Notification that no focused text input currently needs an active input method on this seat.
This event marks the xx_input_method_v1 object as inactive. The compositor must destroy all existing xx_input_popup_surface_v2 objects.
State set with this event is double-buffered. It will get applied on the next xx_input_method_v1.done event, and stay valid until changed.
Sourcepub fn surrounding_text(&self, text: String, cursor: u32, anchor: u32)
pub fn surrounding_text(&self, text: String, cursor: u32, anchor: u32)
surrounding text event
Updates the surrounding plain text around the cursor, excluding the preedit text.
If any preedit text is present, it is replaced with the cursor for the purpose of this event.
The argument text is a buffer containing the preedit string, and must include the cursor position, and the complete selection. It should contain additional characters before and after these. There is a maximum length of wayland messages, so text can not be longer than 4000 bytes.
cursor is the byte offset of the cursor within the text buffer.
anchor is the byte offset of the selection anchor within the text buffer. If there is no selected text, anchor must be the same as cursor.
If this event does not arrive before the first done event, the input method may assume that the text input does not support this functionality and ignore following surrounding_text events.
Values set with this event are double-buffered. They will get applied and set to initial values on the next xx_input_method_v1.done event.
The initial state for affected fields is empty, meaning that the text input does not support sending surrounding text. If the empty values get applied, subsequent attempts to change them may have no effect.
Sourcepub fn text_change_cause(&self, cause: ChangeCause)
pub fn text_change_cause(&self, cause: ChangeCause)
indicates the cause of surrounding text change
Tells the input method why the text surrounding the cursor changed.
Whenever the client detects an external change in text, cursor, or anchor position, it must issue this request to the compositor. This request is intended to give the input method a chance to update the preedit text in an appropriate way, e.g. by removing it when the user starts typing with a keyboard.
cause describes the source of the change.
The value set with this event is double-buffered. It will get applied and set to its initial value on the next xx_input_method_v1.done event.
The initial value of cause is input_method.
Sourcepub fn content_type(&self, hint: ContentHint, purpose: ContentPurpose)
pub fn content_type(&self, hint: ContentHint, purpose: ContentPurpose)
content purpose and hint
Indicates the content type and hint for the current xx_input_method_v1 instance.
Values set with this event are double-buffered. They will get applied on the next xx_input_method_v1.done event.
The initial value for hint is none, and the initial value for purpose is normal.
Sourcepub fn done(&self)
pub fn done(&self)
apply state
Atomically applies state changes recently sent to the client.
The done event establishes and updates the state of the client, and must be issued after any changes to apply them.
Text input state (content purpose, content hint, surrounding text, and change cause) is conceptually double-buffered within an input method context.
Events modify the pending state, as opposed to the current state in use by the input method. A done event atomically applies all pending state, replacing the current state. After done, the new pending state is as documented for each related request.
Events must be applied in the order of arrival.
Neither current nor pending state are modified unless noted otherwise.
input method unavailable
The input method ceased to be available.
The compositor must issue this event as the only event on the object if there was another input_method object associated with the same seat at the time of its creation.
The compositor must issue this request when the object is no longer useable, e.g. due to seat removal.
The input method context becomes inert and should be destroyed after deactivation is handled. Any further requests and events except for the destroy request must be ignored.
Trait Implementations§
Source§impl Borrow<ObjectId> for XxInputMethodV1
impl Borrow<ObjectId> for XxInputMethodV1
Source§impl Clone for XxInputMethodV1
impl Clone for XxInputMethodV1
Source§fn clone(&self) -> XxInputMethodV1
fn clone(&self) -> XxInputMethodV1
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for XxInputMethodV1
impl Debug for XxInputMethodV1
Source§impl Hash for XxInputMethodV1
impl Hash for XxInputMethodV1
Source§impl PartialEq<Weak<XxInputMethodV1>> for XxInputMethodV1
impl PartialEq<Weak<XxInputMethodV1>> for XxInputMethodV1
Source§impl PartialEq for XxInputMethodV1
impl PartialEq for XxInputMethodV1
Source§impl Resource for XxInputMethodV1
impl Resource for XxInputMethodV1
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 XxInputMethodV1
Auto Trait Implementations§
impl Freeze for XxInputMethodV1
impl !RefUnwindSafe for XxInputMethodV1
impl Send for XxInputMethodV1
impl Sync for XxInputMethodV1
impl Unpin for XxInputMethodV1
impl !UnwindSafe for XxInputMethodV1
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§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.