-
Notifications
You must be signed in to change notification settings - Fork 912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rename CompostionEvent to IMEPreeditEvent #1622
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,7 +271,7 @@ pub enum WindowEvent<'a> { | |
ModifiersChanged(ModifiersState), | ||
|
||
/// An event from IME | ||
IME(IMEEvent), | ||
IME(IME), | ||
|
||
/// The cursor has moved on the window. | ||
CursorMoved { | ||
|
@@ -627,23 +627,25 @@ pub struct KeyboardInput { | |
pub modifiers: ModifiersState, | ||
} | ||
|
||
/// Describes an event from input method. | ||
#[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub enum IMEEvent { | ||
/// The user enables IME | ||
pub enum IME { | ||
/// Notifies when the IME was enabled. | ||
Enabled, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New line here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
|
||
/// The user updates preedit status on IME. | ||
/// Notifies when a new composing text should be set at the cursor position. | ||
/// | ||
/// The value represents a pair of the preedit string and the cursor begin position and end | ||
/// position. When both indices are `None`, the cursor should be hidden. | ||
/// | ||
/// The value represents a pair of the preedit string and the cursor begin position and end position. | ||
/// When the cursor is hidden, both value will be None | ||
/// The cursor position is byte-wise indexed. | ||
Preedit(String, Option<usize>, Option<usize>), | ||
|
||
/// The user completes the current IME session with the value. | ||
/// Notifies when text should be inserted into the editor widget. | ||
Commit(String), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New line here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
|
||
/// The user disables IME | ||
/// Notifies when the IME was disabled. | ||
Disabled, | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ extern "C" fn preedit_draw_callback( | |
.collect() | ||
}; | ||
let mut old_text_tail = client_data.text.split_off(chg_range.end); | ||
client_data.text.split_off(chg_range.start); | ||
let _ = client_data.text.split_off(chg_range.start); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is ignore is intentional right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
client_data.text.append(&mut new_chars); | ||
client_data.text.append(&mut old_text_tail); | ||
let cursor_byte_pos = calc_byte_position(&client_data.text, client_data.cursor_pos); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does X11 have an event to tell you when you actually have IME running or how to you obtain that information? Also does it tell you when disable happens, since if X11 doesn't have those events they should be issued at some points, since users may only handle IME things after you've actually got those, since IME is user initiated, I guess.
Or it's not the case for X11 and it just always works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry. This is WIP commit. I think we can get those status with XIMPreeditStateNotifyCallback, so will implement that and test it