From 87d12b92185b7525eb107101ff8c43fd97299599 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Tue, 21 May 2024 11:42:15 -0400 Subject: [PATCH] mac: is_foreground_window --- druid-shell/src/backend/mac/window.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/druid-shell/src/backend/mac/window.rs b/druid-shell/src/backend/mac/window.rs index 2707cfd91..86d6772ed 100644 --- a/druid-shell/src/backend/mac/window.rs +++ b/druid-shell/src/backend/mac/window.rs @@ -1363,7 +1363,11 @@ impl WindowHandle { } pub fn is_foreground_window(&self) -> bool { - true + unsafe { + let application: id = msg_send![class![NSRunningApplication], currentApplication]; + let is_active: BOOL = msg_send![application, isActive]; + is_active != NO + } } pub fn get_window_state(&self) -> WindowState {