-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose TextEvent and input method state
This also adds `InputEvent::TextEvent` for notifying applications of IME state changes as well as explicit getter/setter APIs for tracking IME selection + compose region state. (only supported with GameActivity) Fixes: #18
- Loading branch information
Showing
7 changed files
with
189 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// This struct holds a span within a region of text from `start` (inclusive) to | ||
/// `end` (exclusive). | ||
/// | ||
/// An empty span or cursor position is specified with `Some(start) == Some(end)`. | ||
/// | ||
/// An undefined span is specified with start = end = `None`. | ||
#[derive(Debug, Clone, Copy)] | ||
pub struct TextSpan { | ||
/// The start of the span (inclusive) | ||
pub start: Option<usize>, | ||
|
||
/// The end of the span (exclusive) | ||
pub end: Option<usize>, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct TextInputState { | ||
pub text: String, | ||
/// A selection defined on the text. | ||
pub selection: TextSpan, | ||
/// A composing region defined on the text. | ||
pub compose_region: TextSpan, | ||
} | ||
|
||
pub use crate::activity_impl::input::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters