mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-10 05:01:31 +11:00
parent
2486f0f1a1
commit
60e91b187a
|
@ -10,6 +10,7 @@ And please only add new entries to the top of this list, right below the `# Unre
|
|||
|
||||
- Bump MSRV from `1.60` to `1.64`.
|
||||
- On macOS, fixed potential panic when getting refresh rate.
|
||||
- On macOS, fix crash when calling `Window::set_ime_position` from another thread.
|
||||
|
||||
# 0.28.3
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ use std::ops::Deref;
|
|||
|
||||
use dispatch::Queue;
|
||||
use objc2::foundation::{is_main_thread, CGFloat, NSPoint, NSSize, NSString};
|
||||
use objc2::rc::autoreleasepool;
|
||||
use objc2::rc::{autoreleasepool, Id};
|
||||
|
||||
use crate::{
|
||||
dpi::LogicalSize,
|
||||
dpi::{LogicalPosition, LogicalSize},
|
||||
platform_impl::platform::{
|
||||
appkit::{NSScreen, NSWindow, NSWindowLevel, NSWindowStyleMask},
|
||||
ffi,
|
||||
|
@ -201,3 +201,11 @@ pub(crate) fn close_sync(window: &NSWindow) {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn set_ime_position_sync(window: &WinitWindow, logical_spot: LogicalPosition<f64>) {
|
||||
let window = MainThreadSafe(window);
|
||||
run_on_main(move || {
|
||||
// TODO(madsmtm): Remove the need for this
|
||||
unsafe { Id::from_shared(window.view()) }.set_ime_position(logical_spot);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1165,8 +1165,7 @@ impl WinitWindow {
|
|||
pub fn set_ime_position(&self, spot: Position) {
|
||||
let scale_factor = self.scale_factor();
|
||||
let logical_spot = spot.to_logical(scale_factor);
|
||||
// TODO(madsmtm): Remove the need for this
|
||||
unsafe { Id::from_shared(self.view()) }.set_ime_position(logical_spot);
|
||||
util::set_ime_position_sync(self, logical_spot);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in a new issue