mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-28 07:33:14 -04:00
On macOS, fix incorrect IME cursor rect origin
`window.set_ime_cursor_area` requires a position from the top left corner according to the documentation. However, the NSRect's origin is from bottom left. The y coordinate should correctly calculated for the NSRect.
This commit is contained in:
committed by
Kirill Chibisov
parent
a90cd1c9ad
commit
0270516067
@@ -410,9 +410,9 @@ declare_class!(
|
||||
let content_rect = window.contentRectForFrameRect(window.frame());
|
||||
let base_x = content_rect.origin.x as f64;
|
||||
let base_y = (content_rect.origin.y + content_rect.size.height) as f64;
|
||||
let x = base_x + self.state.ime_position.get().x;
|
||||
let y = base_y - self.state.ime_position.get().y;
|
||||
let LogicalSize { width, height } = self.state.ime_size.get();
|
||||
let x = base_x + self.state.ime_position.get().x;
|
||||
let y = base_y - self.state.ime_position.get().y - height;
|
||||
NSRect::new(NSPoint::new(x as _, y as _), NSSize::new(width, height))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user