macos: Fix compile on aarch64

This commit is contained in:
Mikko Lehtonen 2020-11-02 23:06:00 +02:00 committed by GitHub
parent be850e483a
commit 3a077ff211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 7 deletions

View file

@ -8,6 +8,7 @@
- On Unix, fix cross-compiling to wasm32 without enabling X11 or Wayland. - On Unix, fix cross-compiling to wasm32 without enabling X11 or Wayland.
- On Windows, fix use after free crash during window destruction. - On Windows, fix use after free crash during window destruction.
- On Web, fix `WindowEvent::ReceivedCharacter` never being sent on key input. - On Web, fix `WindowEvent::ReceivedCharacter` never being sent on key input.
- On macOS, fix compilation when targeting aarch64
# 0.23.0 (2020-10-02) # 0.23.0 (2020-10-02)

View file

@ -10,6 +10,7 @@ use cocoa::{
}; };
use dispatch::Queue; use dispatch::Queue;
use objc::rc::autoreleasepool; use objc::rc::autoreleasepool;
use objc::runtime::NO;
use crate::{ use crate::{
dpi::LogicalSize, dpi::LogicalSize,
@ -167,7 +168,7 @@ pub unsafe fn set_maximized_async(
} else { } else {
shared_state_lock.saved_standard_frame() shared_state_lock.saved_standard_frame()
}; };
ns_window.setFrame_display_(new_rect, 0); ns_window.setFrame_display_(new_rect, NO);
} }
trace!("Unlocked shared state in `set_maximized`"); trace!("Unlocked shared state in `set_maximized`");

View file

@ -388,7 +388,7 @@ extern "C" fn has_marked_text(this: &Object, _sel: Sel) -> BOOL {
trace!("Triggered `hasMarkedText`"); trace!("Triggered `hasMarkedText`");
let marked_text: id = *this.get_ivar("markedText"); let marked_text: id = *this.get_ivar("markedText");
trace!("Completed `hasMarkedText`"); trace!("Completed `hasMarkedText`");
(marked_text.length() > 0) as i8 (marked_text.length() > 0) as BOOL
} }
} }

View file

@ -653,7 +653,7 @@ impl UnownedWindow {
self.set_style_mask_async(curr_mask); self.set_style_mask_async(curr_mask);
} }
is_zoomed != 0 is_zoomed != NO
} }
fn saved_style(&self, shared_state: &mut SharedState) -> NSWindowStyleMask { fn saved_style(&self, shared_state: &mut SharedState) -> NSWindowStyleMask {
@ -1168,14 +1168,14 @@ unsafe fn set_min_inner_size<V: NSWindow + Copy>(window: V, mut min_size: Logica
// If necessary, resize the window to match constraint // If necessary, resize the window to match constraint
if current_rect.size.width < min_size.width { if current_rect.size.width < min_size.width {
current_rect.size.width = min_size.width; current_rect.size.width = min_size.width;
window.setFrame_display_(current_rect, 0) window.setFrame_display_(current_rect, NO)
} }
if current_rect.size.height < min_size.height { if current_rect.size.height < min_size.height {
// The origin point of a rectangle is at its bottom left in Cocoa. // The origin point of a rectangle is at its bottom left in Cocoa.
// To ensure the window's top-left point remains the same: // To ensure the window's top-left point remains the same:
current_rect.origin.y += current_rect.size.height - min_size.height; current_rect.origin.y += current_rect.size.height - min_size.height;
current_rect.size.height = min_size.height; current_rect.size.height = min_size.height;
window.setFrame_display_(current_rect, 0) window.setFrame_display_(current_rect, NO)
} }
} }
@ -1192,13 +1192,13 @@ unsafe fn set_max_inner_size<V: NSWindow + Copy>(window: V, mut max_size: Logica
// If necessary, resize the window to match constraint // If necessary, resize the window to match constraint
if current_rect.size.width > max_size.width { if current_rect.size.width > max_size.width {
current_rect.size.width = max_size.width; current_rect.size.width = max_size.width;
window.setFrame_display_(current_rect, 0) window.setFrame_display_(current_rect, NO)
} }
if current_rect.size.height > max_size.height { if current_rect.size.height > max_size.height {
// The origin point of a rectangle is at its bottom left in Cocoa. // The origin point of a rectangle is at its bottom left in Cocoa.
// To ensure the window's top-left point remains the same: // To ensure the window's top-left point remains the same:
current_rect.origin.y += current_rect.size.height - max_size.height; current_rect.origin.y += current_rect.size.height - max_size.height;
current_rect.size.height = max_size.height; current_rect.size.height = max_size.height;
window.setFrame_display_(current_rect, 0) window.setFrame_display_(current_rect, NO)
} }
} }