From 1c2f906e4837ce897f8d3569942c47981e4efc86 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Mon, 27 Nov 2023 19:37:04 +0100 Subject: [PATCH] Position incoming call notification on right hand side. Co-authored-by: Conrad --- crates/collab_ui2/src/collab_ui.rs | 14 ++++++++++---- .../notifications/incoming_call_notification.rs | 1 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/collab_ui2/src/collab_ui.rs b/crates/collab_ui2/src/collab_ui.rs index 679a6a135b..57a33c6790 100644 --- a/crates/collab_ui2/src/collab_ui.rs +++ b/crates/collab_ui2/src/collab_ui.rs @@ -12,7 +12,7 @@ use std::{rc::Rc, sync::Arc}; pub use collab_panel::CollabPanel; pub use collab_titlebar_item::CollabTitlebarItem; use gpui::{ - AppContext, GlobalPixels, Pixels, PlatformDisplay, Size, WindowBounds, WindowKind, + point, AppContext, GlobalPixels, Pixels, PlatformDisplay, Size, WindowBounds, WindowKind, WindowOptions, }; pub use panel_settings::{ @@ -102,13 +102,19 @@ fn notification_window_options( screen: Rc, window_size: Size, ) -> WindowOptions { - let _notification_padding = Pixels::from(16.); + let notification_margin_width = GlobalPixels::from(16.); + let notification_margin_height = GlobalPixels::from(-0.) - GlobalPixels::from(48.); let screen_bounds = screen.bounds(); - let _size: Size = window_size.into(); + let size: Size = window_size.into(); + // todo!() use content bounds instead of screen.bounds and get rid of magics in point's 2nd argument. let bounds = gpui::Bounds:: { - origin: screen_bounds.origin, + origin: screen_bounds.upper_right() + - point( + size.width + notification_margin_width, + notification_margin_height, + ), size: window_size.into(), }; WindowOptions { diff --git a/crates/collab_ui2/src/notifications/incoming_call_notification.rs b/crates/collab_ui2/src/notifications/incoming_call_notification.rs index 24db39683d..0519b6fc4a 100644 --- a/crates/collab_ui2/src/notifications/incoming_call_notification.rs +++ b/crates/collab_ui2/src/notifications/incoming_call_notification.rs @@ -34,7 +34,6 @@ pub fn init(app_state: &Arc, cx: &mut AppContext) { for window in unique_screens { let options = notification_window_options(window, window_size); - dbg!(&options); let window = cx .open_window(options, |cx| { cx.build_view(|_| {