From 3da167aad9dad8ec2e3b3af52175a74a5ef07b99 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 14 Jul 2021 13:08:25 -0400 Subject: [PATCH] fix(macos): `set_focus` should be triggered even if the window isn't visible (#128) --- .changes/macos-set-focus.md | 5 +++++ src/platform_impl/macos/window.rs | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changes/macos-set-focus.md diff --git a/.changes/macos-set-focus.md b/.changes/macos-set-focus.md new file mode 100644 index 000000000..5ecda049b --- /dev/null +++ b/.changes/macos-set-focus.md @@ -0,0 +1,5 @@ +--- +"tao": minor +--- + +On macOS, make sure the `set_focus` is triggered even if the window is not visible. diff --git a/src/platform_impl/macos/window.rs b/src/platform_impl/macos/window.rs index 76de5912a..100a42f97 100644 --- a/src/platform_impl/macos/window.rs +++ b/src/platform_impl/macos/window.rs @@ -462,9 +462,7 @@ impl UnownedWindow { pub fn set_focus(&self) { unsafe { let is_minimized: BOOL = msg_send![*self.ns_window, isMiniaturized]; - let is_visible: BOOL = msg_send![*self.ns_window, isVisible]; - - if is_minimized == NO && is_visible == YES { + if is_minimized == NO { util::set_focus(*self.ns_window); } }