Add IME callback for embedders.

This commit is contained in:
Josh Matthews 2019-01-22 13:36:07 -05:00
parent 9358b6a2fb
commit 256011a652
3 changed files with 11 additions and 0 deletions

View file

@ -81,6 +81,8 @@ pub trait HostTrait {
fn on_animating_changed(&self, animating: bool);
/// Servo finished shutting down.
fn on_shutdown_complete(&self);
/// A text input is focused.
fn on_ime_state_changed(&self, show: bool);
}
pub struct ServoGlue {

View file

@ -40,6 +40,7 @@ pub struct CHostCallbacks {
pub on_history_changed: extern "C" fn(can_go_back: bool, can_go_forward: bool),
pub on_animating_changed: extern "C" fn(animating: bool),
pub on_shutdown_complete: extern "C" fn(),
pub on_ime_state_changed: extern "C" fn(show: bool),
}
/// Servo options
@ -330,4 +331,9 @@ impl HostTrait for HostCallbacks {
debug!("on_shutdown_complete");
(self.0.on_shutdown_complete)();
}
fn on_ime_state_changed(&self, show: bool) {
debug!("on_ime_state_changed");
(self.0.on_ime_state_changed)(show);
}
}

View file

@ -454,6 +454,9 @@ impl HostTrait for HostCallbacks {
)
.unwrap();
}
fn on_ime_state_changed(&self, _show: bool) {
}
}
fn initialize_android_glue(env: &JNIEnv, activity: JObject) {