Only send ImeMoved signal for focused text input (#684)

This commit is contained in:
Olivier FAURE 2024-10-17 14:06:28 +02:00 committed by GitHub
parent f4848ce937
commit cdda9b542d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -38,7 +38,7 @@ fn compose_widget(
}
// TODO - Add unit tests for this.
if moved {
if moved && state.item.accepts_text_input && global_state.is_focused(state.item.id) {
let ime_area = state.item.get_ime_area();
global_state.emit_signal(RenderRootSignal::new_ime_moved_signal(ime_area));
}

View File

@ -582,6 +582,10 @@ impl RenderRootState {
pub(crate) fn focus_changed(&self) -> bool {
self.focused_widget != self.next_focused_widget
}
pub(crate) fn is_focused(&self, id: WidgetId) -> bool {
self.focused_widget == Some(id)
}
}
impl RenderRootSignal {