Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions android-activity/src/game_activity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use ndk::configuration::Configuration;
use ndk::native_window::NativeWindow;

use crate::error::InternalResult;
use crate::input::{device_key_character_map, Axis, KeyCharacterMap, TextInputAction};
use crate::util::{
abort_on_panic, forward_stdio_to_logcat, init_android_main_thread, log_panic,
try_get_path_from_ptr,
Expand All @@ -35,7 +34,10 @@ use crate::{
mod ffi;

pub mod input;
use crate::input::{TextInputState, TextSpan};
use crate::input::{
device_key_character_map, Axis, ImeOptions, InputType, KeyCharacterMap, TextInputAction,
TextInputState, TextSpan,
};
use input::{InputEvent, KeyEvent, MotionEvent};

// The only time it's safe to update the android_app->savedState pointer is
Expand Down Expand Up @@ -212,6 +214,25 @@ impl NativeAppGlue {
self.text_input_state()
}

pub fn set_ime_editor_info(
&self,
input_type: InputType,
action: TextInputAction,
options: ImeOptions,
) {
unsafe {
let activity = (*self.as_ptr()).activity;
let action_id: i32 = action.into();

ffi::GameActivity_setImeEditorInfo(
activity,
input_type.bits(),
action_id as _,
options.bits(),
);
}
}

// TODO: move into a trait
pub fn set_text_input_state(&self, state: TextInputState) {
unsafe {
Expand Down Expand Up @@ -561,6 +582,16 @@ impl AndroidAppInner {
self.native_app.set_text_input_state(state);
}

pub fn set_ime_editor_info(
&self,
input_type: InputType,
action: TextInputAction,
options: ImeOptions,
) {
self.native_app
.set_ime_editor_info(input_type, action, options);
}

pub(crate) fn device_key_character_map(
&self,
device_id: i32,
Expand Down
Loading