Skip to content

Commit

Permalink
macos: Fix compile on aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
scoopr committed Nov 2, 2020
1 parent be850e4 commit 3a077ff
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- On Unix, fix cross-compiling to wasm32 without enabling X11 or Wayland.
- On Windows, fix use after free crash during window destruction.
- On Web, fix `WindowEvent::ReceivedCharacter` never being sent on key input.
- On macOS, fix compilation when targeting aarch64

# 0.23.0 (2020-10-02)

Expand Down
3 changes: 2 additions & 1 deletion src/platform_impl/macos/util/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use cocoa::{
};
use dispatch::Queue;
use objc::rc::autoreleasepool;
use objc::runtime::NO;

use crate::{
dpi::LogicalSize,
Expand Down Expand Up @@ -167,7 +168,7 @@ pub unsafe fn set_maximized_async(
} else {
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`");
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/macos/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ extern "C" fn has_marked_text(this: &Object, _sel: Sel) -> BOOL {
trace!("Triggered `hasMarkedText`");
let marked_text: id = *this.get_ivar("markedText");
trace!("Completed `hasMarkedText`");
(marked_text.length() > 0) as i8
(marked_text.length() > 0) as BOOL
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/platform_impl/macos/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ impl UnownedWindow {
self.set_style_mask_async(curr_mask);
}

is_zoomed != 0
is_zoomed != NO
}

fn saved_style(&self, shared_state: &mut SharedState) -> NSWindowStyleMask {
Expand Down Expand Up @@ -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 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 {
// The origin point of a rectangle is at its bottom left in Cocoa.
// To ensure the window's top-left point remains the same:
current_rect.origin.y += 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)
}
}

Expand All @@ -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 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 {
// The origin point of a rectangle is at its bottom left in Cocoa.
// To ensure the window's top-left point remains the same:
current_rect.origin.y += 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)
}
}

0 comments on commit 3a077ff

Please sign in to comment.