mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-03 07:10:05 -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
@@ -11,6 +11,8 @@ Unreleased` header.
|
|||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- On macOS, fix incorrect IME cursor rect origin.
|
||||||
|
|
||||||
# 0.29.10
|
# 0.29.10
|
||||||
|
|
||||||
- On Web, account for canvas being focused already before event loop starts.
|
- On Web, account for canvas being focused already before event loop starts.
|
||||||
|
|||||||
@@ -410,9 +410,9 @@ declare_class!(
|
|||||||
let content_rect = window.contentRectForFrameRect(window.frame());
|
let content_rect = window.contentRectForFrameRect(window.frame());
|
||||||
let base_x = content_rect.origin.x as f64;
|
let base_x = content_rect.origin.x as f64;
|
||||||
let base_y = (content_rect.origin.y + content_rect.size.height) 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 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))
|
NSRect::new(NSPoint::new(x as _, y as _), NSSize::new(width, height))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user