From d275474b23ead21d50b688ed89252aac56e035ba Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 2 Nov 2022 14:17:16 +0100 Subject: [PATCH] Don't focus incoming call and project shared notification windows --- crates/collab_ui/src/incoming_call_notification.rs | 1 + crates/collab_ui/src/project_shared_notification.rs | 1 + crates/gpui/src/platform.rs | 2 ++ crates/gpui/src/platform/mac/window.rs | 6 +++++- crates/zed/src/zed.rs | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/collab_ui/src/incoming_call_notification.rs b/crates/collab_ui/src/incoming_call_notification.rs index 32b97274b3..e5c4b27d7e 100644 --- a/crates/collab_ui/src/incoming_call_notification.rs +++ b/crates/collab_ui/src/incoming_call_notification.rs @@ -41,6 +41,7 @@ pub fn init(cx: &mut MutableAppContext) { )), titlebar: None, center: false, + focus: false, kind: WindowKind::PopUp, is_movable: false, screen: Some(screen), diff --git a/crates/collab_ui/src/project_shared_notification.rs b/crates/collab_ui/src/project_shared_notification.rs index e814ae2720..0815d9c8d8 100644 --- a/crates/collab_ui/src/project_shared_notification.rs +++ b/crates/collab_ui/src/project_shared_notification.rs @@ -40,6 +40,7 @@ pub fn init(cx: &mut MutableAppContext) { )), titlebar: None, center: false, + focus: false, kind: WindowKind::PopUp, is_movable: false, screen: Some(screen), diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index d2aee035ff..2920835c49 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -152,6 +152,7 @@ pub struct WindowOptions<'a> { pub bounds: WindowBounds, pub titlebar: Option>, pub center: bool, + pub focus: bool, pub kind: WindowKind, pub is_movable: bool, pub screen: Option>, @@ -296,6 +297,7 @@ impl<'a> Default for WindowOptions<'a> { traffic_light_position: Default::default(), }), center: false, + focus: true, kind: WindowKind::Normal, is_movable: true, screen: None, diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index 55340a1727..57c5c3711d 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -514,7 +514,11 @@ impl Window { ); } } - native_window.makeKeyAndOrderFront_(nil); + if options.focus { + native_window.makeKeyAndOrderFront_(nil); + } else { + native_window.orderFront_(nil); + } window.0.borrow().move_traffic_light(); pool.drain(); diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index f54114891c..2709e267c6 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -354,6 +354,7 @@ pub fn build_window_options() -> WindowOptions<'static> { traffic_light_position: Some(vec2f(8., 8.)), }), center: false, + focus: true, kind: WindowKind::Normal, is_movable: true, screen: None,