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

2
iris

Submodule iris updated: c7b255be4f...7e257fd042

View File

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

View File

@@ -3,7 +3,10 @@ use arboard::Clipboard;
use input::Input; use input::Input;
use iris::prelude::*; use iris::prelude::*;
use render::Renderer; use render::Renderer;
use winit::{event::WindowEvent, event_loop::ActiveEventLoop}; use winit::{
event::{Ime, WindowEvent},
event_loop::ActiveEventLoop,
};
use crate::{ use crate::{
client::ui::{Edited, Submit, main_view, msg_widget}, 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() { if self.ui.needs_redraw() {