Provide a way to set cursor area for IME cursor

Rename `Window::set_ime_position` to `Window::set_ime_cursor_area`
adding a way to create cursor exclusive zone.

Fixes #2886.
This commit is contained in:
Kirill Chibisov 2023-06-22 19:12:14 +00:00 committed by GitHub
parent 66ff52b012
commit 05444628e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 72 additions and 43 deletions

View file

@ -3,7 +3,7 @@
use log::LevelFilter;
use simple_logger::SimpleLogger;
use winit::{
dpi::PhysicalPosition,
dpi::{PhysicalPosition, PhysicalSize},
event::{ElementState, Event, Ime, WindowEvent},
event_loop::{ControlFlow, EventLoop},
keyboard::{Key, KeyCode},
@ -66,7 +66,7 @@ fn main() {
);
ime_pos = cursor_position;
if may_show_ime {
window.set_ime_position(ime_pos);
window.set_ime_cursor_area(ime_pos, PhysicalSize::new(10, 10));
}
}
Event::WindowEvent {
@ -76,7 +76,7 @@ fn main() {
println!("{event:?}");
may_show_ime = event != Ime::Disabled;
if may_show_ime {
window.set_ime_position(ime_pos);
window.set_ime_cursor_area(ime_pos, PhysicalSize::new(10, 10));
}
}
Event::WindowEvent {