Fix macOS 32bit (#2327)

This commit is contained in:
Mads Marquart 2022-06-11 03:43:51 +02:00 committed by GitHub
parent 40abb526cc
commit 6474891f1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View file

@ -7,7 +7,7 @@ use std::ops::{BitAnd, Deref};
use std::os::raw::c_uchar;
use cocoa::{
appkit::{NSApp, NSWindowStyleMask},
appkit::{CGFloat, NSApp, NSWindowStyleMask},
base::{id, nil},
foundation::{NSPoint, NSRect, NSString, NSUInteger},
};
@ -113,7 +113,7 @@ impl Drop for TraceGuard {
// 1. translate the bottom-left window corner into the top-left window corner
// 2. translate the coordinate from a bottom-left origin coordinate system to a top-left one
pub fn bottom_left_to_top_left(rect: NSRect) -> f64 {
CGDisplay::main().pixels_high() as f64 - (rect.origin.y + rect.size.height)
CGDisplay::main().pixels_high() as f64 - (rect.origin.y + rect.size.height) as f64
}
/// Converts from winit screen-coordinates to macOS screen-coordinates.
@ -121,8 +121,8 @@ pub fn bottom_left_to_top_left(rect: NSRect) -> f64 {
/// macOS: bottom-left is (0, 0) and y increasing upwards
pub fn window_position(position: LogicalPosition<f64>) -> NSPoint {
NSPoint::new(
position.x,
CGDisplay::main().pixels_high() as f64 - position.y,
position.x as CGFloat,
CGDisplay::main().pixels_high() as CGFloat - position.y as CGFloat,
)
}