basic ime support

This commit is contained in:
2025-11-17 21:49:01 -05:00
parent 930a140791
commit 420a9938ea
3 changed files with 16 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ impl ApplicationHandler<ClientEvent> for App {
let window = event_loop
.create_window(Window::default_attributes())
.unwrap();
window.set_ime_allowed(true);
let client = Client::new(AppHandle {
proxy: self.proxy.clone(),
window: window.into(),

View File

@@ -3,7 +3,10 @@ use arboard::Clipboard;
use input::Input;
use iris::prelude::*;
use render::Renderer;
use winit::{event::WindowEvent, event_loop::ActiveEventLoop};
use winit::{
event::{Ime, WindowEvent},
event_loop::ActiveEventLoop,
};
use crate::{
client::ui::{Edited, Submit, main_view, msg_widget},
@@ -142,6 +145,16 @@ impl Client {
}
}
}
WindowEvent::Ime(ime) => match ime {
Ime::Enabled | Ime::Disabled => (),
Ime::Preedit(_, _) => (),
Ime::Commit(content) => {
if let Some(sel) = &self.focus {
let mut text = self.ui.text(sel);
text.insert(&content);
}
}
},
_ => (),
}
if self.ui.needs_redraw() {