use super::Context;
use crate::Rect;
use winit::{
dpi::{LogicalPosition, LogicalSize},
window::Window,
};
impl Context {
pub fn ime_cursor_area(&self) -> Option<Rect> {
self.ime_area
}
pub fn sync_ime(&mut self, window: &Window) {
let target = self.ime_area.and(self.interaction.focused);
if target != self.ime_target {
if self.ime_target.is_some() {
window.set_ime_allowed(false);
}
if target.is_some() {
window.set_ime_allowed(true);
}
self.ime_target = target;
}
if let Some(rect) = self.ime_area {
window.set_ime_cursor_area(
LogicalPosition::new(f64::from(rect.min.x), f64::from(rect.min.y)),
LogicalSize::new(f64::from(rect.size().x), f64::from(rect.size().y)),
);
}
}
}