Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/gl/macos.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// This is required because the objc crate is causing a lot of warnings: https://github.com/SSheldon/rust-objc/issues/125
// Eventually we should migrate to the objc2 crate and remove this.
#![allow(unexpected_cfgs)]

use std::ffi::c_void;
use std::str::FromStr;

Expand Down
4 changes: 4 additions & 0 deletions src/macos/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// This is required because the objc crate is causing a lot of warnings: https://github.com/SSheldon/rust-objc/issues/125
// Eventually we should migrate to the objc2 crate and remove this.
#![allow(unexpected_cfgs)]

mod keyboard;
mod view;
mod window;
Expand Down
8 changes: 6 additions & 2 deletions src/macos/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,12 @@ extern "C" fn become_first_responder(this: &Object, _sel: Sel) -> BOOL {
let state = unsafe { WindowState::from_view(this) };
let is_key_window = unsafe {
let window: id = msg_send![this, window];
let is_key_window: BOOL = msg_send![window, isKeyWindow];
is_key_window == YES
if window != nil {
let is_key_window: BOOL = msg_send![window, isKeyWindow];
is_key_window == YES
} else {
false
}
};
if is_key_window {
state.trigger_deferrable_event(Event::Window(WindowEvent::Focused));
Expand Down