text input: Reset hints when text input gone

This ensures that when the keyboard is force brought up next time, the user is not stuck with an overlay they can't switch.

As a downside, there's a blink of default hint before the keyboard hides.
This commit is contained in:
Dorota Czaplejewicz
2020-12-15 12:49:44 +00:00
parent b72c6b53e4
commit 914c5d4940

View File

@ -151,14 +151,19 @@ pub mod c {
if active_changed {
(imservice.active_callback)(imservice.current.active);
if imservice.current.active {
unsafe {
eekboard_context_service_set_hint_purpose(
imservice.state_manager,
imservice.current.content_hint.bits(),
imservice.current.content_purpose.clone() as u32,
);
}
let (hint, purpose) = if imservice.current.active {(
imservice.current.content_hint,
imservice.current.content_purpose.clone(),
)} else {(
ContentHint::NONE,
ContentPurpose::Normal,
)};
unsafe {
eekboard_context_service_set_hint_purpose(
imservice.state_manager,
hint.bits(),
purpose as u32,
);
}
}
}