WIP
This commit is contained in:
parent
426aeb7c5e
commit
27a80a1c94
4 changed files with 27 additions and 25 deletions
|
@ -52,6 +52,8 @@ use std::{
|
|||
time::Duration,
|
||||
};
|
||||
|
||||
use super::geometry::Vector2FExt;
|
||||
|
||||
const WINDOW_STATE_IVAR: &str = "windowState";
|
||||
|
||||
static mut WINDOW_CLASS: *const Class = ptr::null();
|
||||
|
@ -564,11 +566,13 @@ impl Window {
|
|||
unsafe {
|
||||
let app = NSApplication::sharedApplication(nil);
|
||||
|
||||
let point = NSPoint::new(screen_position.x() as f64, screen_position.y() as f64);
|
||||
let window_number: NSInteger = msg_send![class!(NSWindow), windowNumberAtPoint:point belowWindowWithWindowNumber:0 as NSInteger];
|
||||
let point = screen_position.to_ns_point();
|
||||
let window_number: NSInteger = msg_send![class!(NSWindow), windowNumberAtPoint:point belowWindowWithWindowNumber:0];
|
||||
|
||||
// For some reason this API doesn't work when our two windows are on top of each other
|
||||
let top_most_window: id = msg_send![app, windowWithWindowNumber: window_number];
|
||||
dbg!(top_most_window);
|
||||
|
||||
// dbg!(top_most_window);
|
||||
let is_panel: BOOL = msg_send![top_most_window, isKindOfClass: PANEL_CLASS];
|
||||
let is_window: BOOL = msg_send![top_most_window, isKindOfClass: WINDOW_CLASS];
|
||||
if is_panel | is_window {
|
||||
|
@ -779,7 +783,7 @@ impl platform::Window for Window {
|
|||
fn screen_position(&self, view_position: &Vector2F) -> Vector2F {
|
||||
let self_borrow = self.0.borrow_mut();
|
||||
unsafe {
|
||||
let point = NSPoint::new(view_position.x() as f64, view_position.y() as f64);
|
||||
let point = view_position.to_ns_point();
|
||||
let screen_point: NSPoint =
|
||||
msg_send![self_borrow.native_window, convertPointToScreen: point];
|
||||
vec2f(screen_point.x as f32, screen_point.y as f32)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue