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:
parent
66ff52b012
commit
05444628e6
17 changed files with 72 additions and 43 deletions
|
|
@ -741,13 +741,14 @@ impl WindowState {
|
|||
}
|
||||
|
||||
/// Set the IME position.
|
||||
pub fn set_ime_position(&self, position: LogicalPosition<u32>) {
|
||||
pub fn set_ime_cursor_area(&self, position: LogicalPosition<u32>, size: LogicalSize<u32>) {
|
||||
// XXX This won't fly unless user will have a way to request IME window per seat, since
|
||||
// the ime windows will be overlapping, but winit doesn't expose API to specify for
|
||||
// which seat we're setting IME position.
|
||||
let (x, y) = (position.x as i32, position.y as i32);
|
||||
let (width, height) = (size.width as i32, size.height as i32);
|
||||
for text_input in self.text_inputs.iter() {
|
||||
text_input.set_cursor_rectangle(x, y, 0, 0);
|
||||
text_input.set_cursor_rectangle(x, y, width, height);
|
||||
text_input.commit();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue