Skip to content

Commit

Permalink
Add more docs about Enabled/Disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
kchibisov committed Apr 19, 2022
1 parent 48e9b2d commit 3ed902a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ pub enum WindowEvent<'a> {

/// An event from input method.
///
/// **Note :** You have to explicitly enable this event using [`Window::set_ime_allowed`].
///
/// Platform-specific behavior:
/// - **iOS / Android / Web :** Unsupported.
Ime(Ime),
Expand Down Expand Up @@ -672,11 +674,14 @@ pub struct KeyboardInput {
/// Ime::Commit("啊不")
/// ```
///
/// **Note: You have to explicitly enable this event using [`Window::set_ime_allowed`].**
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum Ime {
/// Notifies when the IME was enabled.
///
/// After getting this event you could receive [`Preedit`](Self::Preedit) and
/// [`Commit`](Self::Commit) events. You should also start performing IME related requests
/// like [`Window::set_ime_position`].
Enabled,

/// Notifies when a new composing text should be set at the cursor position.
Expand All @@ -688,9 +693,16 @@ pub enum Ime {
Preedit(String, Option<usize>, Option<usize>),

/// Notifies when text should be inserted into the editor widget.
///
/// Any pending [`Preedit`](Self::Preedit) must be cleared.
Commit(String),

/// Notifies when the IME was disabled.
///
/// After receiving this event you won't get any more [`Preedit`](Self::Preedit) or
/// [`Commit`](Self::Commit) events until the next [`Enabled`](Self::Enabled) event. You can
/// also stop issuing IME related requests like [`Window::set_ime_position`] and clear pending
/// preedit text.
Disabled,
}

Expand Down

0 comments on commit 3ed902a

Please sign in to comment.