mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Move IME candidate window following text cursor (#258)
* egui_web: enable IME support on web. * Move candidate window following text cursor. * Preclude too frequent agent movement. * IME candidate window move on native app.
This commit is contained in:
@@ -303,7 +303,11 @@ fn set_cursor_icon(display: &glium::backend::glutin::Display, cursor_icon: egui:
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_output(output: egui::Output, clipboard: Option<&mut ClipboardContext>) {
|
||||
pub fn handle_output(
|
||||
output: egui::Output,
|
||||
clipboard: Option<&mut ClipboardContext>,
|
||||
display: &glium::Display,
|
||||
) {
|
||||
if let Some(open) = output.open_url {
|
||||
if let Err(err) = webbrowser::open(&open.url) {
|
||||
eprintln!("Failed to open url: {}", err);
|
||||
@@ -317,6 +321,13 @@ pub fn handle_output(output: egui::Output, clipboard: Option<&mut ClipboardConte
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(egui::Pos2 { x, y }) = output.text_cursor {
|
||||
display
|
||||
.gl_window()
|
||||
.window()
|
||||
.set_ime_position(glium::glutin::dpi::LogicalPosition { x, y })
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init_clipboard() -> Option<ClipboardContext> {
|
||||
|
||||
Reference in New Issue
Block a user