basic ime support
This commit is contained in:
2
iris
2
iris
Submodule iris updated: c7b255be4f...7e257fd042
@@ -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(),
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user