BlueGit

ict rusty-teams

feat(calls): call layout of the new Teams

- Header: title and timer left, controls centered with dividers between the groups, Leave at the far right
- Shared content: people strip runs along the top, the share fills the full width below
- The draggable side strip and its saved width are gone
- Deviation: Leave keeps our red button style, only the place follows Teams

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-12 · 2 weeks ago

Hash
9ee83b18da6cbaeeeb5c9ec1cf1b9737a0416a87
Parent
83f2d748
12 files changed +50 −189
crates/app-call-model/src/share_view.rs +0 −39
@@ -5,10 +5,6 @@ pub const ZOOM_MIN: f32 = 1.;
5 5 pub const ZOOM_MAX: f32 = 4.;
6 6 const ZOOM_STEP: f32 = 1.25;
7 7 const WHEEL_ZOOM_PER_PIXEL: f32 = 0.0015;
8 pub const STRIP_MIN_WIDTH: f32 = 160.;
9 pub const STRIP_MAX_WIDTH: f32 = 400.;
10 pub const STRIP_DEFAULT_WIDTH: f32 = 232.;
11 pub const STRIP_WIDTH_META_KEY: &str = "call_strip_width";
12 8 pub const SHARE_MOTION_META_KEY: &str = "call_share_motion";
13 9 pub const SHARE_STANDOUT_META_KEY: &str = "call_share_standout";
14 10
@@ -84,40 +80,14 @@ impl ShareView {
84 80 }
85 81 }
86 82
87 pub fn clamp_strip_width(width: f32) -> f32 {
88 width.clamp(STRIP_MIN_WIDTH, STRIP_MAX_WIDTH)
89 }
90
91 pub fn load_strip_width(store: &store::Store) -> f32 {
92 store
93 .meta(STRIP_WIDTH_META_KEY)
94 .ok()
95 .flatten()
96 .and_then(|text| text.parse().ok())
97 .map_or(STRIP_DEFAULT_WIDTH, clamp_strip_width)
98 }
99
100 83 pub fn load_flag(store: &store::Store, key: &str) -> bool {
101 84 store.meta(key).ok().flatten().as_deref() == Some("1")
102 85 }
103 86
104 #[derive(Debug, Clone, Copy, PartialEq)]
105 pub struct StripDrag {
106 pub start_pointer: f32,
107 pub start_width: f32,
108 }
109
110 impl StripDrag {
111 pub fn width_at(&self, pointer: f32) -> f32 {
112 clamp_strip_width(self.start_width + self.start_pointer - pointer)
113 }
114 }
115
116 87 #[derive(Default)]
117 88 pub struct ShareStage {
118 89 pub view: ShareView,
119 90 pub pan_from: Option<(f32, f32)>,
120 pub strip_drag: Option<StripDrag>,
121 91 pub popped: bool,
122 92 pub bounds: Rc<Cell<(f32, f32, f32, f32)>>,
123 93 }
@@ -199,13 +169,4 @@ mod tests {
199 169 view.zoom_wheel(-60., (400., 225.), STAGE);
200 170 assert!(view.zoom() < zoomed);
201 171 }
202
203 #[test]
204 fn the_strip_width_stays_between_160_and_400_and_follows_the_pointer() {
205 let drag = StripDrag { start_pointer: 900., start_width: 232. };
206 assert_eq!(drag.width_at(880.), 252.);
207 assert_eq!(drag.width_at(0.), STRIP_MAX_WIDTH);
208 assert_eq!(drag.width_at(2000.), STRIP_MIN_WIDTH);
209 assert_eq!(clamp_strip_width(10.), STRIP_MIN_WIDTH);
210 }
211 172 }
@@ -5,10 +5,6 @@ pub const ZOOM_MIN: f32 = 1.;
5pub const ZOOM_MAX: f32 = 4.;
5pub const ZOOM_MAX: f32 = 4.;
6const ZOOM_STEP: f32 = 1.25;
6const ZOOM_STEP: f32 = 1.25;
7const WHEEL_ZOOM_PER_PIXEL: f32 = 0.0015;
7const WHEEL_ZOOM_PER_PIXEL: f32 = 0.0015;
8pub const STRIP_MIN_WIDTH: f32 = 160.;
9pub const STRIP_MAX_WIDTH: f32 = 400.;
10pub const STRIP_DEFAULT_WIDTH: f32 = 232.;
11pub const STRIP_WIDTH_META_KEY: &str = "call_strip_width";
12pub const SHARE_MOTION_META_KEY: &str = "call_share_motion";
8pub const SHARE_MOTION_META_KEY: &str = "call_share_motion";
13pub const SHARE_STANDOUT_META_KEY: &str = "call_share_standout";
9pub const SHARE_STANDOUT_META_KEY: &str = "call_share_standout";
14
10
@@ -84,40 +80,14 @@ impl ShareView {
84 }
80 }
85}
81}
86
82
87pub fn clamp_strip_width(width: f32) -> f32 {
88 width.clamp(STRIP_MIN_WIDTH, STRIP_MAX_WIDTH)
89}
90
91pub fn load_strip_width(store: &store::Store) -> f32 {
92 store
93 .meta(STRIP_WIDTH_META_KEY)
94 .ok()
95 .flatten()
96 .and_then(|text| text.parse().ok())
97 .map_or(STRIP_DEFAULT_WIDTH, clamp_strip_width)
98}
99
100pub fn load_flag(store: &store::Store, key: &str) -> bool {
83pub fn load_flag(store: &store::Store, key: &str) -> bool {
101 store.meta(key).ok().flatten().as_deref() == Some("1")
84 store.meta(key).ok().flatten().as_deref() == Some("1")
102}
85}
103
86
104#[derive(Debug, Clone, Copy, PartialEq)]
105pub struct StripDrag {
106 pub start_pointer: f32,
107 pub start_width: f32,
108}
109
110impl StripDrag {
111 pub fn width_at(&self, pointer: f32) -> f32 {
112 clamp_strip_width(self.start_width + self.start_pointer - pointer)
113 }
114}
115
116#[derive(Default)]
87#[derive(Default)]
117pub struct ShareStage {
88pub struct ShareStage {
118 pub view: ShareView,
89 pub view: ShareView,
119 pub pan_from: Option<(f32, f32)>,
90 pub pan_from: Option<(f32, f32)>,
120 pub strip_drag: Option<StripDrag>,
121 pub popped: bool,
91 pub popped: bool,
122 pub bounds: Rc<Cell<(f32, f32, f32, f32)>>,
92 pub bounds: Rc<Cell<(f32, f32, f32, f32)>>,
123}
93}
@@ -199,13 +169,4 @@ mod tests {
199 view.zoom_wheel(-60., (400., 225.), STAGE);
169 view.zoom_wheel(-60., (400., 225.), STAGE);
200 assert!(view.zoom() < zoomed);
170 assert!(view.zoom() < zoomed);
201 }
171 }
202
203 #[test]
204 fn the_strip_width_stays_between_160_and_400_and_follows_the_pointer() {
205 let drag = StripDrag { start_pointer: 900., start_width: 232. };
206 assert_eq!(drag.width_at(880.), 252.);
207 assert_eq!(drag.width_at(0.), STRIP_MAX_WIDTH);
208 assert_eq!(drag.width_at(2000.), STRIP_MIN_WIDTH);
209 assert_eq!(clamp_strip_width(10.), STRIP_MIN_WIDTH);
210 }
211}
172}
crates/app-call-model/src/stage_layout.rs +0 −38
@@ -11,8 +11,6 @@ pub const SPEAKER_SWITCH_AFTER: Duration = Duration::from_millis(800);
11 11 pub const RECENT_SPEAKER: Duration = Duration::from_secs(3);
12 12 const KEEP_RECENT_ON_TOP: Duration = Duration::from_secs(20);
13 13 const TILE_ASPECT: f32 = 16. / 9.;
14 pub const STRIP_MIN_TILE_HEIGHT: f32 = 90.;
15 const FIT_TOLERANCE: f32 = 0.001;
16 14
17 15 #[derive(Debug, Clone, Copy, PartialEq)]
18 16 pub struct GalleryGrid {
@@ -126,19 +124,6 @@ pub fn filmstrip(
126 124 }
127 125 }
128 126
129 pub fn share_strip(others: usize, own_cells: usize, strip: (f32, f32), gap: f32) -> Filmstrip {
130 let full_height = strip.0 / TILE_ASPECT;
131 let cells = (others + own_cells).max(1);
132 let height_for_all = (strip.1 - gap * (cells - 1) as f32) / cells as f32;
133 let tile_height = height_for_all.clamp(STRIP_MIN_TILE_HEIGHT.min(full_height), full_height).max(0.);
134 let capacity = (((strip.1 + gap) / (tile_height + gap) + FIT_TOLERANCE) as usize).max(1);
135 Filmstrip {
136 tile_width: tile_height * TILE_ASPECT,
137 tile_height,
138 overflow: split_overflow(others, own_cells, capacity),
139 }
140 }
141
142 127 #[derive(Debug, Clone, Default)]
143 128 pub struct VisibleRotation {
144 129 order: Vec<String>,
@@ -427,29 +412,6 @@ mod tests {
427 412 );
428 413 }
429 414
430 #[test]
431 fn a_tall_share_strip_shows_everyone_at_full_width() {
432 let plan = share_strip(3, 1, (232., 800.), 12.);
433 assert_eq!(plan.overflow, Overflow { shown: 3, hidden: 0 });
434 assert!((plan.tile_width - 232.).abs() < 0.01);
435 }
436
437 #[test]
438 fn a_share_strip_shrinks_tiles_so_nine_people_and_me_fit() {
439 let plan = share_strip(9, 1, (232., 1100.), 12.);
440 assert_eq!(plan.overflow, Overflow { shown: 9, hidden: 0 });
441 assert!(plan.tile_height >= STRIP_MIN_TILE_HEIGHT);
442 assert!(10. * plan.tile_height + 9. * 12. <= 1100.01);
443 }
444
445 #[test]
446 fn a_short_share_strip_stops_at_the_minimum_height_and_adds_a_plus_tile() {
447 let plan = share_strip(9, 1, (232., 600.), 12.);
448 assert!((plan.tile_height - STRIP_MIN_TILE_HEIGHT).abs() < 0.01);
449 let capacity = ((600. + 12.) / (STRIP_MIN_TILE_HEIGHT + 12.)) as usize;
450 assert_eq!(plan.overflow, Overflow { shown: capacity - 2, hidden: 9 - (capacity - 2) });
451 }
452
453 415 #[test]
454 416 fn the_filmstrip_holds_six_tiles_then_a_plus_tile() {
455 417 let strip = filmstrip(5, 1, 1600., 12., 240.);
@@ -11,8 +11,6 @@ pub const SPEAKER_SWITCH_AFTER: Duration = Duration::from_millis(800);
11pub const RECENT_SPEAKER: Duration = Duration::from_secs(3);
11pub const RECENT_SPEAKER: Duration = Duration::from_secs(3);
12const KEEP_RECENT_ON_TOP: Duration = Duration::from_secs(20);
12const KEEP_RECENT_ON_TOP: Duration = Duration::from_secs(20);
13const TILE_ASPECT: f32 = 16. / 9.;
13const TILE_ASPECT: f32 = 16. / 9.;
14pub const STRIP_MIN_TILE_HEIGHT: f32 = 90.;
15const FIT_TOLERANCE: f32 = 0.001;
16
14
17#[derive(Debug, Clone, Copy, PartialEq)]
15#[derive(Debug, Clone, Copy, PartialEq)]
18pub struct GalleryGrid {
16pub struct GalleryGrid {
@@ -126,19 +124,6 @@ pub fn filmstrip(
126 }
124 }
127}
125}
128
126
129pub fn share_strip(others: usize, own_cells: usize, strip: (f32, f32), gap: f32) -> Filmstrip {
130 let full_height = strip.0 / TILE_ASPECT;
131 let cells = (others + own_cells).max(1);
132 let height_for_all = (strip.1 - gap * (cells - 1) as f32) / cells as f32;
133 let tile_height = height_for_all.clamp(STRIP_MIN_TILE_HEIGHT.min(full_height), full_height).max(0.);
134 let capacity = (((strip.1 + gap) / (tile_height + gap) + FIT_TOLERANCE) as usize).max(1);
135 Filmstrip {
136 tile_width: tile_height * TILE_ASPECT,
137 tile_height,
138 overflow: split_overflow(others, own_cells, capacity),
139 }
140}
141
142#[derive(Debug, Clone, Default)]
127#[derive(Debug, Clone, Default)]
143pub struct VisibleRotation {
128pub struct VisibleRotation {
144 order: Vec<String>,
129 order: Vec<String>,
@@ -427,29 +412,6 @@ mod tests {
427 );
412 );
428 }
413 }
429
414
430 #[test]
431 fn a_tall_share_strip_shows_everyone_at_full_width() {
432 let plan = share_strip(3, 1, (232., 800.), 12.);
433 assert_eq!(plan.overflow, Overflow { shown: 3, hidden: 0 });
434 assert!((plan.tile_width - 232.).abs() < 0.01);
435 }
436
437 #[test]
438 fn a_share_strip_shrinks_tiles_so_nine_people_and_me_fit() {
439 let plan = share_strip(9, 1, (232., 1100.), 12.);
440 assert_eq!(plan.overflow, Overflow { shown: 9, hidden: 0 });
441 assert!(plan.tile_height >= STRIP_MIN_TILE_HEIGHT);
442 assert!(10. * plan.tile_height + 9. * 12. <= 1100.01);
443 }
444
445 #[test]
446 fn a_short_share_strip_stops_at_the_minimum_height_and_adds_a_plus_tile() {
447 let plan = share_strip(9, 1, (232., 600.), 12.);
448 assert!((plan.tile_height - STRIP_MIN_TILE_HEIGHT).abs() < 0.01);
449 let capacity = ((600. + 12.) / (STRIP_MIN_TILE_HEIGHT + 12.)) as usize;
450 assert_eq!(plan.overflow, Overflow { shown: capacity - 2, hidden: 9 - (capacity - 2) });
451 }
452
453 #[test]
415 #[test]
454 fn the_filmstrip_holds_six_tiles_then_a_plus_tile() {
416 fn the_filmstrip_holds_six_tiles_then_a_plus_tile() {
455 let strip = filmstrip(5, 1, 1600., 12., 240.);
417 let strip = filmstrip(5, 1, 1600., 12., 240.);
crates/app-call-model/src/stage_split.rs +18 −22
@@ -2,7 +2,7 @@ use calling::{TileDetail, VideoWant};
2 2
3 3 use crate::model::{ActiveCall, CallModel, Focus, Tile};
4 4 use crate::stage_layout::{
5 FILMSTRIP_MAX, Filmstrip, filmstrip, gallery_page_range, gallery_pages, share_strip,
5 FILMSTRIP_MAX, Filmstrip, filmstrip, gallery_page_range, gallery_pages,
6 6 };
7 7 use crate::view_settings::CallLayout;
8 8
@@ -71,21 +71,18 @@ pub fn speaker_split(model: &CallModel, stage: (f32, f32)) -> SpeakerSplit<'_> {
71 71 }
72 72
73 73 pub struct StripSplit<'a> {
74 pub width: f32,
75 74 pub others: Vec<&'a Tile>,
76 75 pub plan: Filmstrip,
77 76 }
78 77
79 pub fn strip_split(model: &CallModel, strip_width: f32, stage: (f32, f32)) -> StripSplit<'_> {
80 let available = (stage.0 - 2. * GRID_PADDING, (stage.1 - 2. * GRID_PADDING).max(0.));
81 let width = strip_width.min(((available.0 - TILE_GAP) / 2.).max(0.));
78 pub fn strip_split(model: &CallModel, stage: (f32, f32)) -> StripSplit<'_> {
82 79 let others: Vec<&Tile> = model
83 80 .strip_tiles()
84 81 .into_iter()
85 82 .filter(|tile| !model.hidden_for_no_video(tile))
86 83 .collect();
87 let plan = share_strip(others.len(), model.own_cells(), (width, available.1), STRIP_GAP);
88 StripSplit { width, others, plan }
84 let plan = filmstrip(others.len(), model.own_cells(), stage.0 - 2. * GRID_PADDING, STRIP_GAP, FILMSTRIP_TILE_MAX);
85 StripSplit { others, plan }
89 86 }
90 87
91 88 const LARGE_GALLERY_TILES: usize = 4;
@@ -94,12 +91,12 @@ fn want(tile: &Tile, detail: TileDetail) -> VideoWant {
94 91 VideoWant { mri: tile.mri.clone(), detail }
95 92 }
96 93
97 pub fn video_wants(model: &CallModel, stage: (f32, f32), strip_width: f32) -> Vec<VideoWant> {
94 pub fn video_wants(model: &CallModel, stage: (f32, f32)) -> Vec<VideoWant> {
98 95 if model.has_content() {
99 96 if model.effective_layout() == CallLayout::Content {
100 97 return Vec::new();
101 98 }
102 let split = strip_split(model, strip_width, stage);
99 let split = strip_split(model, stage);
103 100 return split.others[..split.plan.overflow.shown]
104 101 .iter()
105 102 .map(|tile| want(tile, TileDetail::Small))
@@ -126,9 +123,8 @@ mod tests {
126 123
127 124 use calling::{CallUpdate, RosterEntry, TileDetail, VideoWant};
128 125
129 use super::{FILMSTRIP_TILE_MAX, GRID_PADDING, TILE_GAP, video_wants};
126 use super::{FILMSTRIP_TILE_MAX, GRID_PADDING, STRIP_GAP, TILE_GAP, video_wants};
130 127 use crate::model::CallModel;
131 use crate::share_view::STRIP_DEFAULT_WIDTH;
132 128 use crate::stage_layout::{filmstrip, first_page_size};
133 129 use crate::view_settings::CallLayout;
134 130
@@ -167,7 +163,7 @@ mod tests {
167 163
168 164 #[test]
169 165 fn a_small_gallery_asks_for_large_pictures() {
170 let wants = video_wants(&crowd(3), STAGE, STRIP_DEFAULT_WIDTH);
166 let wants = video_wants(&crowd(3), STAGE);
171 167 assert_eq!(wants.len(), 3);
172 168 assert!(details(&wants).iter().all(|detail| *detail == TileDetail::Stage));
173 169 }
@@ -175,7 +171,7 @@ mod tests {
175 171 #[test]
176 172 fn a_big_gallery_asks_for_small_pictures_and_skips_the_other_pages() {
177 173 let model = crowd(14);
178 let wants = video_wants(&model, STAGE, STRIP_DEFAULT_WIDTH);
174 let wants = video_wants(&model, STAGE);
179 175 assert_eq!(wants.len(), first_page_size(14, 1));
180 176 assert!(details(&wants).iter().all(|detail| *detail == TileDetail::Small));
181 177 let hidden: Vec<&str> = model.layout_tiles()[wants.len()..].iter().map(|tile| tile.mri.as_str()).collect();
@@ -186,7 +182,7 @@ mod tests {
186 182 fn people_hidden_for_having_no_video_get_no_picture_request() {
187 183 let mut model = meeting(vec![person(0, true), person(1, false), person(2, false)]);
188 184 model.view.hide_no_video = true;
189 let wants = video_wants(&model, STAGE, STRIP_DEFAULT_WIDTH);
185 let wants = video_wants(&model, STAGE);
190 186 assert_eq!(wants.iter().map(|want| want.mri.as_str()).collect::<Vec<_>>(), vec!["8:orgid:p0"]);
191 187 }
192 188
@@ -196,7 +192,7 @@ mod tests {
196 192 model.view.choose(CallLayout::Speaker);
197 193 model.refresh_layout(Instant::now());
198 194 let focus = model.speaker_focus().expect("a stage person").mri;
199 let wants = video_wants(&model, STAGE, STRIP_DEFAULT_WIDTH);
195 let wants = video_wants(&model, STAGE);
200 196 assert_eq!(wants[0], VideoWant { mri: focus.clone(), detail: TileDetail::Stage });
201 197 assert_eq!(wants.len(), 5);
202 198 assert!(wants[1..].iter().all(|want| want.detail == TileDetail::Small && want.mri != focus));
@@ -207,7 +203,7 @@ mod tests {
207 203 let mut model = crowd(12);
208 204 model.view.choose(CallLayout::Speaker);
209 205 model.refresh_layout(Instant::now());
210 let wants = video_wants(&model, (500., 800.), STRIP_DEFAULT_WIDTH);
206 let wants = video_wants(&model, (500., 800.));
211 207 let fitting = filmstrip(11, 1, 500. - 2. * GRID_PADDING, TILE_GAP, FILMSTRIP_TILE_MAX).overflow.shown;
212 208 assert!(fitting < 11);
213 209 assert_eq!(wants.len(), 1 + fitting);
@@ -217,19 +213,19 @@ mod tests {
217 213 fn next_to_shared_content_everybody_in_the_strip_is_small_and_content_focus_wants_nobody() {
218 214 let mut model = crowd(3);
219 215 model.apply(CallUpdate::ScreenShare(Some("8:orgid:p1".into())));
220 let wants = video_wants(&model, STAGE, STRIP_DEFAULT_WIDTH);
216 let wants = video_wants(&model, STAGE);
221 217 assert_eq!(wants.len(), 3);
222 218 assert!(details(&wants).iter().all(|detail| *detail == TileDetail::Small));
223 219 model.view.choose(CallLayout::Content);
224 assert!(video_wants(&model, STAGE, STRIP_DEFAULT_WIDTH).is_empty());
220 assert!(video_wants(&model, STAGE).is_empty());
225 221 }
226 222
227 223 #[test]
228 fn a_full_share_strip_wants_video_for_every_shown_tile_and_none_behind_the_plus_tile() {
224 fn the_share_strip_on_top_wants_video_for_every_shown_tile_and_none_behind_the_plus_tile() {
229 225 let mut model = crowd(9);
230 226 model.apply(CallUpdate::ScreenShare(Some("8:orgid:p1".into())));
231 assert_eq!(video_wants(&model, (1400., 1100.), STRIP_DEFAULT_WIDTH).len(), 9);
232 let short = video_wants(&model, (1400., 600.), STRIP_DEFAULT_WIDTH);
233 assert!(short.len() >= 3 && short.len() < 9, "{} wants", short.len());
227 let fitting = filmstrip(9, 1, 1400. - 2. * GRID_PADDING, STRIP_GAP, FILMSTRIP_TILE_MAX).overflow.shown;
228 assert!(fitting < 9);
229 assert_eq!(video_wants(&model, (1400., 800.)).len(), fitting);
234 230 }
235 231 }
@@ -2,7 +2,7 @@ use calling::{TileDetail, VideoWant};
2
2
3use crate::model::{ActiveCall, CallModel, Focus, Tile};
3use crate::model::{ActiveCall, CallModel, Focus, Tile};
4use crate::stage_layout::{
4use crate::stage_layout::{
5 FILMSTRIP_MAX, Filmstrip, filmstrip, gallery_page_range, gallery_pages, share_strip,
5 FILMSTRIP_MAX, Filmstrip, filmstrip, gallery_page_range, gallery_pages,
6};
6};
7use crate::view_settings::CallLayout;
7use crate::view_settings::CallLayout;
8
8
@@ -71,21 +71,18 @@ pub fn speaker_split(model: &CallModel, stage: (f32, f32)) -> SpeakerSplit<'_> {
71}
71}
72
72
73pub struct StripSplit<'a> {
73pub struct StripSplit<'a> {
74 pub width: f32,
75 pub others: Vec<&'a Tile>,
74 pub others: Vec<&'a Tile>,
76 pub plan: Filmstrip,
75 pub plan: Filmstrip,
77}
76}
78
77
79pub fn strip_split(model: &CallModel, strip_width: f32, stage: (f32, f32)) -> StripSplit<'_> {
78pub fn strip_split(model: &CallModel, stage: (f32, f32)) -> StripSplit<'_> {
80 let available = (stage.0 - 2. * GRID_PADDING, (stage.1 - 2. * GRID_PADDING).max(0.));
81 let width = strip_width.min(((available.0 - TILE_GAP) / 2.).max(0.));
82 let others: Vec<&Tile> = model
79 let others: Vec<&Tile> = model
83 .strip_tiles()
80 .strip_tiles()
84 .into_iter()
81 .into_iter()
85 .filter(|tile| !model.hidden_for_no_video(tile))
82 .filter(|tile| !model.hidden_for_no_video(tile))
86 .collect();
83 .collect();
87 let plan = share_strip(others.len(), model.own_cells(), (width, available.1), STRIP_GAP);
84 let plan = filmstrip(others.len(), model.own_cells(), stage.0 - 2. * GRID_PADDING, STRIP_GAP, FILMSTRIP_TILE_MAX);
88 StripSplit { width, others, plan }
85 StripSplit { others, plan }
89}
86}
90
87
91const LARGE_GALLERY_TILES: usize = 4;
88const LARGE_GALLERY_TILES: usize = 4;
@@ -94,12 +91,12 @@ fn want(tile: &Tile, detail: TileDetail) -> VideoWant {
94 VideoWant { mri: tile.mri.clone(), detail }
91 VideoWant { mri: tile.mri.clone(), detail }
95}
92}
96
93
97pub fn video_wants(model: &CallModel, stage: (f32, f32), strip_width: f32) -> Vec<VideoWant> {
94pub fn video_wants(model: &CallModel, stage: (f32, f32)) -> Vec<VideoWant> {
98 if model.has_content() {
95 if model.has_content() {
99 if model.effective_layout() == CallLayout::Content {
96 if model.effective_layout() == CallLayout::Content {
100 return Vec::new();
97 return Vec::new();
101 }
98 }
102 let split = strip_split(model, strip_width, stage);
99 let split = strip_split(model, stage);
103 return split.others[..split.plan.overflow.shown]
100 return split.others[..split.plan.overflow.shown]
104 .iter()
101 .iter()
105 .map(|tile| want(tile, TileDetail::Small))
102 .map(|tile| want(tile, TileDetail::Small))
@@ -126,9 +123,8 @@ mod tests {
126
123
127 use calling::{CallUpdate, RosterEntry, TileDetail, VideoWant};
124 use calling::{CallUpdate, RosterEntry, TileDetail, VideoWant};
128
125
129 use super::{FILMSTRIP_TILE_MAX, GRID_PADDING, TILE_GAP, video_wants};
126 use super::{FILMSTRIP_TILE_MAX, GRID_PADDING, STRIP_GAP, TILE_GAP, video_wants};
130 use crate::model::CallModel;
127 use crate::model::CallModel;
131 use crate::share_view::STRIP_DEFAULT_WIDTH;
132 use crate::stage_layout::{filmstrip, first_page_size};
128 use crate::stage_layout::{filmstrip, first_page_size};
133 use crate::view_settings::CallLayout;
129 use crate::view_settings::CallLayout;
134
130
@@ -167,7 +163,7 @@ mod tests {
167
163
168 #[test]
164 #[test]
169 fn a_small_gallery_asks_for_large_pictures() {
165 fn a_small_gallery_asks_for_large_pictures() {
170 let wants = video_wants(&crowd(3), STAGE, STRIP_DEFAULT_WIDTH);
166 let wants = video_wants(&crowd(3), STAGE);
171 assert_eq!(wants.len(), 3);
167 assert_eq!(wants.len(), 3);
172 assert!(details(&wants).iter().all(|detail| *detail == TileDetail::Stage));
168 assert!(details(&wants).iter().all(|detail| *detail == TileDetail::Stage));
173 }
169 }
@@ -175,7 +171,7 @@ mod tests {
175 #[test]
171 #[test]
176 fn a_big_gallery_asks_for_small_pictures_and_skips_the_other_pages() {
172 fn a_big_gallery_asks_for_small_pictures_and_skips_the_other_pages() {
177 let model = crowd(14);
173 let model = crowd(14);
178 let wants = video_wants(&model, STAGE, STRIP_DEFAULT_WIDTH);
174 let wants = video_wants(&model, STAGE);
179 assert_eq!(wants.len(), first_page_size(14, 1));
175 assert_eq!(wants.len(), first_page_size(14, 1));
180 assert!(details(&wants).iter().all(|detail| *detail == TileDetail::Small));
176 assert!(details(&wants).iter().all(|detail| *detail == TileDetail::Small));
181 let hidden: Vec<&str> = model.layout_tiles()[wants.len()..].iter().map(|tile| tile.mri.as_str()).collect();
177 let hidden: Vec<&str> = model.layout_tiles()[wants.len()..].iter().map(|tile| tile.mri.as_str()).collect();
@@ -186,7 +182,7 @@ mod tests {
186 fn people_hidden_for_having_no_video_get_no_picture_request() {
182 fn people_hidden_for_having_no_video_get_no_picture_request() {
187 let mut model = meeting(vec![person(0, true), person(1, false), person(2, false)]);
183 let mut model = meeting(vec![person(0, true), person(1, false), person(2, false)]);
188 model.view.hide_no_video = true;
184 model.view.hide_no_video = true;
189 let wants = video_wants(&model, STAGE, STRIP_DEFAULT_WIDTH);
185 let wants = video_wants(&model, STAGE);
190 assert_eq!(wants.iter().map(|want| want.mri.as_str()).collect::<Vec<_>>(), vec!["8:orgid:p0"]);
186 assert_eq!(wants.iter().map(|want| want.mri.as_str()).collect::<Vec<_>>(), vec!["8:orgid:p0"]);
191 }
187 }
192
188
@@ -196,7 +192,7 @@ mod tests {
196 model.view.choose(CallLayout::Speaker);
192 model.view.choose(CallLayout::Speaker);
197 model.refresh_layout(Instant::now());
193 model.refresh_layout(Instant::now());
198 let focus = model.speaker_focus().expect("a stage person").mri;
194 let focus = model.speaker_focus().expect("a stage person").mri;
199 let wants = video_wants(&model, STAGE, STRIP_DEFAULT_WIDTH);
195 let wants = video_wants(&model, STAGE);
200 assert_eq!(wants[0], VideoWant { mri: focus.clone(), detail: TileDetail::Stage });
196 assert_eq!(wants[0], VideoWant { mri: focus.clone(), detail: TileDetail::Stage });
201 assert_eq!(wants.len(), 5);
197 assert_eq!(wants.len(), 5);
202 assert!(wants[1..].iter().all(|want| want.detail == TileDetail::Small && want.mri != focus));
198 assert!(wants[1..].iter().all(|want| want.detail == TileDetail::Small && want.mri != focus));
@@ -207,7 +203,7 @@ mod tests {
207 let mut model = crowd(12);
203 let mut model = crowd(12);
208 model.view.choose(CallLayout::Speaker);
204 model.view.choose(CallLayout::Speaker);
209 model.refresh_layout(Instant::now());
205 model.refresh_layout(Instant::now());
210 let wants = video_wants(&model, (500., 800.), STRIP_DEFAULT_WIDTH);
206 let wants = video_wants(&model, (500., 800.));
211 let fitting = filmstrip(11, 1, 500. - 2. * GRID_PADDING, TILE_GAP, FILMSTRIP_TILE_MAX).overflow.shown;
207 let fitting = filmstrip(11, 1, 500. - 2. * GRID_PADDING, TILE_GAP, FILMSTRIP_TILE_MAX).overflow.shown;
212 assert!(fitting < 11);
208 assert!(fitting < 11);
213 assert_eq!(wants.len(), 1 + fitting);
209 assert_eq!(wants.len(), 1 + fitting);
@@ -217,19 +213,19 @@ mod tests {
217 fn next_to_shared_content_everybody_in_the_strip_is_small_and_content_focus_wants_nobody() {
213 fn next_to_shared_content_everybody_in_the_strip_is_small_and_content_focus_wants_nobody() {
218 let mut model = crowd(3);
214 let mut model = crowd(3);
219 model.apply(CallUpdate::ScreenShare(Some("8:orgid:p1".into())));
215 model.apply(CallUpdate::ScreenShare(Some("8:orgid:p1".into())));
220 let wants = video_wants(&model, STAGE, STRIP_DEFAULT_WIDTH);
216 let wants = video_wants(&model, STAGE);
221 assert_eq!(wants.len(), 3);
217 assert_eq!(wants.len(), 3);
222 assert!(details(&wants).iter().all(|detail| *detail == TileDetail::Small));
218 assert!(details(&wants).iter().all(|detail| *detail == TileDetail::Small));
223 model.view.choose(CallLayout::Content);
219 model.view.choose(CallLayout::Content);
224 assert!(video_wants(&model, STAGE, STRIP_DEFAULT_WIDTH).is_empty());
220 assert!(video_wants(&model, STAGE).is_empty());
225 }
221 }
226
222
227 #[test]
223 #[test]
228 fn a_full_share_strip_wants_video_for_every_shown_tile_and_none_behind_the_plus_tile() {
224 fn the_share_strip_on_top_wants_video_for_every_shown_tile_and_none_behind_the_plus_tile() {
229 let mut model = crowd(9);
225 let mut model = crowd(9);
230 model.apply(CallUpdate::ScreenShare(Some("8:orgid:p1".into())));
226 model.apply(CallUpdate::ScreenShare(Some("8:orgid:p1".into())));
231 assert_eq!(video_wants(&model, (1400., 1100.), STRIP_DEFAULT_WIDTH).len(), 9);
227 let fitting = filmstrip(9, 1, 1400. - 2. * GRID_PADDING, STRIP_GAP, FILMSTRIP_TILE_MAX).overflow.shown;
232 let short = video_wants(&model, (1400., 600.), STRIP_DEFAULT_WIDTH);
228 assert!(fitting < 9);
233 assert!(short.len() >= 3 && short.len() < 9, "{} wants", short.len());
229 assert_eq!(video_wants(&model, (1400., 800.)).len(), fitting);
234 }
230 }
235}
231}
crates/app-state/src/app_state.rs +0 −3
@@ -194,7 +194,6 @@ pub struct AppState {
194 194 pub call_share_motion: bool,
195 195 pub call_share_standout: bool,
196 196 pub call_report_enabled: bool,
197 pub call_strip_width: f32,
198 197 pub call_view: crate::call::ViewSettings,
199 198 pub call_background: crate::call::BackgroundPick,
200 199 pub call_camera: calling::DeviceChoice,
@@ -355,7 +354,6 @@ impl AppState {
355 354 call_share_motion: false,
356 355 call_share_standout: false,
357 356 call_report_enabled: true,
358 call_strip_width: crate::call::STRIP_DEFAULT_WIDTH,
359 357 call_view: crate::call::ViewSettings::default(),
360 358 call_background: crate::call::BackgroundPick::None,
361 359 call_camera: calling::DeviceChoice::SystemDefault,
@@ -391,7 +389,6 @@ impl AppState {
391 389 state.call_share_motion = crate::call::load_flag(&state.store, crate::call::SHARE_MOTION_META_KEY);
392 390 state.call_share_standout = crate::call::load_flag(&state.store, crate::call::SHARE_STANDOUT_META_KEY);
393 391 state.call_report_enabled = crate::call::load_report_enabled(&state.store);
394 state.call_strip_width = crate::call::load_strip_width(&state.store);
395 392 state.call_view = crate::call::ViewSettings::load(&state.store);
396 393 state.call_background = crate::call::load_background(&state.store);
397 394 state.call_camera = crate::call::load_camera(&state.store);
@@ -194,7 +194,6 @@ pub struct AppState {
194 pub call_share_motion: bool,
194 pub call_share_motion: bool,
195 pub call_share_standout: bool,
195 pub call_share_standout: bool,
196 pub call_report_enabled: bool,
196 pub call_report_enabled: bool,
197 pub call_strip_width: f32,
198 pub call_view: crate::call::ViewSettings,
197 pub call_view: crate::call::ViewSettings,
199 pub call_background: crate::call::BackgroundPick,
198 pub call_background: crate::call::BackgroundPick,
200 pub call_camera: calling::DeviceChoice,
199 pub call_camera: calling::DeviceChoice,
@@ -355,7 +354,6 @@ impl AppState {
355 call_share_motion: false,
354 call_share_motion: false,
356 call_share_standout: false,
355 call_share_standout: false,
357 call_report_enabled: true,
356 call_report_enabled: true,
358 call_strip_width: crate::call::STRIP_DEFAULT_WIDTH,
359 call_view: crate::call::ViewSettings::default(),
357 call_view: crate::call::ViewSettings::default(),
360 call_background: crate::call::BackgroundPick::None,
358 call_background: crate::call::BackgroundPick::None,
361 call_camera: calling::DeviceChoice::SystemDefault,
359 call_camera: calling::DeviceChoice::SystemDefault,
@@ -391,7 +389,6 @@ impl AppState {
391 state.call_share_motion = crate::call::load_flag(&state.store, crate::call::SHARE_MOTION_META_KEY);
389 state.call_share_motion = crate::call::load_flag(&state.store, crate::call::SHARE_MOTION_META_KEY);
392 state.call_share_standout = crate::call::load_flag(&state.store, crate::call::SHARE_STANDOUT_META_KEY);
390 state.call_share_standout = crate::call::load_flag(&state.store, crate::call::SHARE_STANDOUT_META_KEY);
393 state.call_report_enabled = crate::call::load_report_enabled(&state.store);
391 state.call_report_enabled = crate::call::load_report_enabled(&state.store);
394 state.call_strip_width = crate::call::load_strip_width(&state.store);
395 state.call_view = crate::call::ViewSettings::load(&state.store);
392 state.call_view = crate::call::ViewSettings::load(&state.store);
396 state.call_background = crate::call::load_background(&state.store);
393 state.call_background = crate::call::load_background(&state.store);
397 state.call_camera = crate::call::load_camera(&state.store);
394 state.call_camera = crate::call::load_camera(&state.store);
crates/app-state/src/call/mod.rs +1 −1
@@ -57,7 +57,7 @@ pub use prejoin::{AudioChoice, JoinOptions, PendingJoin, load_join_options};
57 57 pub use people::{PeopleSections, PersonRow, people_sections};
58 58 pub use share_actions::ZoomStep;
59 59 pub use speed_dial::SpeedDialEntry;
60 pub use share_view::{SHARE_MOTION_META_KEY, SHARE_STANDOUT_META_KEY, STRIP_DEFAULT_WIDTH, ShareStage, load_flag, load_strip_width};
60 pub use share_view::{SHARE_MOTION_META_KEY, SHARE_STANDOUT_META_KEY, ShareStage, load_flag};
61 61 pub use preview::{CameraPreview, preview_backgrounds};
62 62 pub use reminder::{MeetingToasts, ReminderPhase, subtitle as meeting_subtitle};
63 63 pub use ring::{MissedCall, RingEntry, Rings};
@@ -57,7 +57,7 @@ pub use prejoin::{AudioChoice, JoinOptions, PendingJoin, load_join_options};
57pub use people::{PeopleSections, PersonRow, people_sections};
57pub use people::{PeopleSections, PersonRow, people_sections};
58pub use share_actions::ZoomStep;
58pub use share_actions::ZoomStep;
59pub use speed_dial::SpeedDialEntry;
59pub use speed_dial::SpeedDialEntry;
60pub use share_view::{SHARE_MOTION_META_KEY, SHARE_STANDOUT_META_KEY, STRIP_DEFAULT_WIDTH, ShareStage, load_flag, load_strip_width};
60pub use share_view::{SHARE_MOTION_META_KEY, SHARE_STANDOUT_META_KEY, ShareStage, load_flag};
61pub use preview::{CameraPreview, preview_backgrounds};
61pub use preview::{CameraPreview, preview_backgrounds};
62pub use reminder::{MeetingToasts, ReminderPhase, subtitle as meeting_subtitle};
62pub use reminder::{MeetingToasts, ReminderPhase, subtitle as meeting_subtitle};
63pub use ring::{MissedCall, RingEntry, Rings};
63pub use ring::{MissedCall, RingEntry, Rings};
crates/app-state/src/call/share_actions.rs +1 −26
@@ -1,9 +1,7 @@
1 1 use calling::CallCommand;
2 2 use gpui_kit::*;
3 3
4 use super::share_view::{
5 SHARE_MOTION_META_KEY, SHARE_STANDOUT_META_KEY, STRIP_WIDTH_META_KEY, StripDrag, clamp_strip_width,
6 };
4 use super::share_view::{SHARE_MOTION_META_KEY, SHARE_STANDOUT_META_KEY};
7 5 use crate::app_state::{AppEvent, AppState};
8 6
9 7 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -63,29 +61,6 @@ impl AppState {
63 61 self.change_share_stage(cx, |stage| stage.pan_from = None);
64 62 }
65 63
66 pub fn begin_strip_drag(&mut self, pointer_x: f32, cx: &mut Context<Self>) {
67 let start_width = self.call_strip_width;
68 self.change_share_stage(cx, |stage| stage.strip_drag = Some(StripDrag { start_pointer: pointer_x, start_width }));
69 }
70
71 pub fn drag_strip_to(&mut self, pointer_x: f32, cx: &mut Context<Self>) {
72 let Some(drag) = self.call.as_ref().and_then(|call| call.share_stage.strip_drag) else {
73 return;
74 };
75 self.call_strip_width = drag.width_at(pointer_x);
76 cx.notify();
77 }
78
79 pub fn end_strip_drag(&mut self, cx: &mut Context<Self>) {
80 if self.call.as_ref().is_none_or(|call| call.share_stage.strip_drag.is_none()) {
81 return;
82 }
83 let width = clamp_strip_width(self.call_strip_width);
84 self.call_strip_width = width;
85 let _ = self.store.set_meta(STRIP_WIDTH_META_KEY, &width.to_string());
86 self.change_share_stage(cx, |stage| stage.strip_drag = None);
87 }
88
89 64 pub fn pop_out_stage(&mut self, cx: &mut Context<Self>) {
90 65 self.change_share_stage(cx, |stage| stage.popped = true);
91 66 }
@@ -1,9 +1,7 @@
1use calling::CallCommand;
1use calling::CallCommand;
2use gpui_kit::*;
2use gpui_kit::*;
3
3
4use super::share_view::{
4use super::share_view::{SHARE_MOTION_META_KEY, SHARE_STANDOUT_META_KEY};
5 SHARE_MOTION_META_KEY, SHARE_STANDOUT_META_KEY, STRIP_WIDTH_META_KEY, StripDrag, clamp_strip_width,
6};
7use crate::app_state::{AppEvent, AppState};
5use crate::app_state::{AppEvent, AppState};
8
6
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -63,29 +61,6 @@ impl AppState {
63 self.change_share_stage(cx, |stage| stage.pan_from = None);
61 self.change_share_stage(cx, |stage| stage.pan_from = None);
64 }
62 }
65
63
66 pub fn begin_strip_drag(&mut self, pointer_x: f32, cx: &mut Context<Self>) {
67 let start_width = self.call_strip_width;
68 self.change_share_stage(cx, |stage| stage.strip_drag = Some(StripDrag { start_pointer: pointer_x, start_width }));
69 }
70
71 pub fn drag_strip_to(&mut self, pointer_x: f32, cx: &mut Context<Self>) {
72 let Some(drag) = self.call.as_ref().and_then(|call| call.share_stage.strip_drag) else {
73 return;
74 };
75 self.call_strip_width = drag.width_at(pointer_x);
76 cx.notify();
77 }
78
79 pub fn end_strip_drag(&mut self, cx: &mut Context<Self>) {
80 if self.call.as_ref().is_none_or(|call| call.share_stage.strip_drag.is_none()) {
81 return;
82 }
83 let width = clamp_strip_width(self.call_strip_width);
84 self.call_strip_width = width;
85 let _ = self.store.set_meta(STRIP_WIDTH_META_KEY, &width.to_string());
86 self.change_share_stage(cx, |stage| stage.strip_drag = None);
87 }
88
89 pub fn pop_out_stage(&mut self, cx: &mut Context<Self>) {
64 pub fn pop_out_stage(&mut self, cx: &mut Context<Self>) {
90 self.change_share_stage(cx, |stage| stage.popped = true);
65 self.change_share_stage(cx, |stage| stage.popped = true);
91 }
66 }
crates/app-state/src/call/view_actions.rs +1 −2
@@ -97,11 +97,10 @@ impl AppState {
97 97 }
98 98
99 99 fn sync_video_wants(&mut self) {
100 let strip_width = self.call_strip_width;
101 100 let Some(call) = self.call.as_mut() else {
102 101 return;
103 102 };
104 let wants = video_wants(&call.model, measured_stage(call), strip_width);
103 let wants = video_wants(&call.model, measured_stage(call));
105 104 if wants != call.sent_wants {
106 105 let _ = call.commands.send(CallCommand::SetVideoWants(wants.clone()));
107 106 call.sent_wants = wants;
@@ -97,11 +97,10 @@ impl AppState {
97 }
97 }
98
98
99 fn sync_video_wants(&mut self) {
99 fn sync_video_wants(&mut self) {
100 let strip_width = self.call_strip_width;
101 let Some(call) = self.call.as_mut() else {
100 let Some(call) = self.call.as_mut() else {
102 return;
101 return;
103 };
102 };
104 let wants = video_wants(&call.model, measured_stage(call), strip_width);
103 let wants = video_wants(&call.model, measured_stage(call));
105 if wants != call.sent_wants {
104 if wants != call.sent_wants {
106 let _ = call.commands.send(CallCommand::SetVideoWants(wants.clone()));
105 let _ = call.commands.send(CallCommand::SetVideoWants(wants.clone()));
107 call.sent_wants = wants;
106 call.sent_wants = wants;
crates/app/src/layout_guard.rs +1 −2
@@ -263,7 +263,7 @@ mod frames {
263 263 "shell/islands/main/call-stage",
264 264 "shell/islands/main/call-header/controls",
265 265 "shell/islands/main/call-header/controls/mic",
266 "shell/islands/main/call-header/controls/leave",
266 "shell/islands/main/call-header/leave",
267 267 ];
268 268 const AGENTS_LIST: &str = "shell/islands/sidebar/agents";
269 269 const CALENDAR: &str = "shell/islands/calendar";
@@ -300,7 +300,6 @@ mod frames {
300 300 const SHARE_GUARDED: &[&str] = &[
301 301 "shell/islands/main/call-stage/share-content",
302 302 "shell/islands/main/call-stage/share-content/zoom-chip",
303 "shell/islands/main/call-stage/share-divider",
304 303 "shell/islands/main/call-stage/share-strip",
305 304 ];
306 305 const OVERLAY_PANELS: &[&str] = &[CALL_TRANSCRIPT, PEOPLE_PANEL];
@@ -263,7 +263,7 @@ mod frames {
263 "shell/islands/main/call-stage",
263 "shell/islands/main/call-stage",
264 "shell/islands/main/call-header/controls",
264 "shell/islands/main/call-header/controls",
265 "shell/islands/main/call-header/controls/mic",
265 "shell/islands/main/call-header/controls/mic",
266 "shell/islands/main/call-header/controls/leave",
266 "shell/islands/main/call-header/leave",
267 ];
267 ];
268 const AGENTS_LIST: &str = "shell/islands/sidebar/agents";
268 const AGENTS_LIST: &str = "shell/islands/sidebar/agents";
269 const CALENDAR: &str = "shell/islands/calendar";
269 const CALENDAR: &str = "shell/islands/calendar";
@@ -300,7 +300,6 @@ mod frames {
300 const SHARE_GUARDED: &[&str] = &[
300 const SHARE_GUARDED: &[&str] = &[
301 "shell/islands/main/call-stage/share-content",
301 "shell/islands/main/call-stage/share-content",
302 "shell/islands/main/call-stage/share-content/zoom-chip",
302 "shell/islands/main/call-stage/share-content/zoom-chip",
303 "shell/islands/main/call-stage/share-divider",
304 "shell/islands/main/call-stage/share-strip",
303 "shell/islands/main/call-stage/share-strip",
305 ];
304 ];
306 const OVERLAY_PANELS: &[&str] = &[CALL_TRANSCRIPT, PEOPLE_PANEL];
305 const OVERLAY_PANELS: &[&str] = &[CALL_TRANSCRIPT, PEOPLE_PANEL];
crates/app/src/views/call_control_fold.rs +2 −2
@@ -4,7 +4,7 @@ use gpui_kit::component::Icon;
4 4 use gpui_kit::component::menu::{PopupMenu, PopupMenuItem};
5 5 use gpui_kit::*;
6 6
7 use super::call_toolbar::{GROUP_GAP, SPLIT_CHEVRON_WIDTH, TOOL_GAP, TOOL_WIDTH};
7 use super::call_toolbar::{GROUP_DIVIDER_WIDTH, GROUP_GAP, SPLIT_CHEVRON_WIDTH, TOOL_GAP, TOOL_WIDTH};
8 8 use super::call_view::reaction_glyph;
9 9 use super::call_view_menu::view_items;
10 10 use crate::app_state::AppState;
@@ -51,7 +51,7 @@ pub fn fixed_controls_width(has_camera_menu: bool, has_more: bool, has_leave_men
51 51 } else {
52 52 0.
53 53 };
54 devices_width + more_width + leave_width + 3. * GROUP_GAP
54 devices_width + more_width + leave_width + 5. * GROUP_GAP + 2. * GROUP_DIVIDER_WIDTH
55 55 }
56 56
57 57 pub fn in_more_menu(folded: Vec<Foldable>) -> Vec<Foldable> {
@@ -4,7 +4,7 @@ use gpui_kit::component::Icon;
4use gpui_kit::component::menu::{PopupMenu, PopupMenuItem};
4use gpui_kit::component::menu::{PopupMenu, PopupMenuItem};
5use gpui_kit::*;
5use gpui_kit::*;
6
6
7use super::call_toolbar::{GROUP_GAP, SPLIT_CHEVRON_WIDTH, TOOL_GAP, TOOL_WIDTH};
7use super::call_toolbar::{GROUP_DIVIDER_WIDTH, GROUP_GAP, SPLIT_CHEVRON_WIDTH, TOOL_GAP, TOOL_WIDTH};
8use super::call_view::reaction_glyph;
8use super::call_view::reaction_glyph;
9use super::call_view_menu::view_items;
9use super::call_view_menu::view_items;
10use crate::app_state::AppState;
10use crate::app_state::AppState;
@@ -51,7 +51,7 @@ pub fn fixed_controls_width(has_camera_menu: bool, has_more: bool, has_leave_men
51 } else {
51 } else {
52 0.
52 0.
53 };
53 };
54 devices_width + more_width + leave_width + 3. * GROUP_GAP
54 devices_width + more_width + leave_width + 5. * GROUP_GAP + 2. * GROUP_DIVIDER_WIDTH
55}
55}
56
56
57pub fn in_more_menu(folded: Vec<Foldable>) -> Vec<Foldable> {
57pub fn in_more_menu(folded: Vec<Foldable>) -> Vec<Foldable> {
crates/app/src/views/call_layouts.rs +9 −49
@@ -26,8 +26,6 @@ use crate::theme;
26 26
27 27 const MEASURE_TOLERANCE: f32 = 0.5;
28 28 const OVERLAY_INSET: f32 = 16.;
29 const DIVIDER_LINE: f32 = 4.;
30 const DIVIDER_LENGTH: f32 = 48.;
31 29 const CHIP_TOP: f32 = 12.;
32 30 const TILE_RADIUS: f32 = 12.;
33 31 const HIDDEN_LIST_WIDTH: f32 = 260.;
@@ -514,7 +512,7 @@ fn people_strip(
514 512 now: Instant,
515 513 stage: (f32, f32),
516 514 ) -> Stateful<Div> {
517 let StripSplit { width, others, plan } = strip_split(model, state.call_strip_width, stage);
515 let StripSplit { others, plan } = strip_split(model, stage);
518 516 let size = TileSize::sixteen_by_nine(plan.tile_width);
519 517 let shown = &others[..plan.overflow.shown];
520 518 let mut cells: Vec<AnyElement> = shown
@@ -528,40 +526,16 @@ fn people_strip(
528 526 if plan.overflow.hidden > 0 {
529 527 cells.push(overflow_tile(app, state, size, &others[plan.overflow.shown..]));
530 528 }
531 v_flex()
529 h_flex()
532 530 .id("call-strip")
533 531 .debug_selector(|| "shell/islands/main/call-stage/share-strip".into())
534 532 .flex_none()
535 .w(px(width))
536 .items_center()
533 .w_full()
534 .justify_center()
537 535 .gap(px(STRIP_GAP))
538 536 .children(cells)
539 537 }
540 538
541 fn strip_divider(app: &Entity<AppState>, dragging: bool) -> Stateful<Div> {
542 let app = app.clone();
543 h_flex()
544 .id("call-strip-divider")
545 .debug_selector(|| "shell/islands/main/call-stage/share-divider".into())
546 .flex_none()
547 .w(px(TILE_GAP))
548 .h_full()
549 .items_center()
550 .justify_center()
551 .cursor_col_resize()
552 .child(
553 div()
554 .w(px(DIVIDER_LINE))
555 .h(px(DIVIDER_LENGTH))
556 .rounded_full()
557 .bg(if dragging { theme::accent() } else { theme::border() }),
558 )
559 .on_mouse_down(MouseButton::Left, move |event, _, cx| {
560 let pointer_x = f32::from(event.position.x);
561 app.update(cx, |state, cx| state.begin_strip_drag(pointer_x, cx));
562 })
563 }
564
565 539 fn share_body(
566 540 app: &Entity<AppState>,
567 541 state: &AppState,
@@ -571,30 +545,16 @@ fn share_body(
571 545 layout: CallLayout,
572 546 stage: (f32, f32),
573 547 ) -> AnyElement {
574 let move_app = app.clone();
575 let up_app = app.clone();
576 let up_out_app = app.clone();
577 let dragging = state.call.as_ref().is_some_and(|call| call.share_stage.strip_drag.is_some());
578 h_flex()
548 v_flex()
579 549 .id("call-share-body")
580 550 .absolute()
581 551 .inset_0()
582 552 .p(px(GRID_PADDING))
583 .items_center()
584 .on_mouse_move(move |event, _, cx| {
585 let pointer_x = f32::from(event.position.x);
586 move_app.update(cx, |state, cx| state.drag_strip_to(pointer_x, cx));
587 })
588 .on_mouse_up(MouseButton::Left, move |_, _, cx| {
589 up_app.update(cx, |state, cx| state.end_strip_drag(cx));
590 })
591 .on_mouse_up_out(MouseButton::Left, move |_, _, cx| {
592 up_out_app.update(cx, |state, cx| state.end_strip_drag(cx));
593 })
594 .child(share)
595 .when(layout != CallLayout::Content, |row| {
596 row.child(strip_divider(app, dragging)).child(people_strip(app, state, model, now, stage))
553 .gap(px(STRIP_GAP))
554 .when(layout != CallLayout::Content, |column| {
555 column.child(people_strip(app, state, model, now, stage))
597 556 })
557 .child(h_flex().flex_1().min_h_0().w_full().child(share))
598 558 .into_any_element()
599 559 }
600 560
@@ -26,8 +26,6 @@ use crate::theme;
26
26
27const MEASURE_TOLERANCE: f32 = 0.5;
27const MEASURE_TOLERANCE: f32 = 0.5;
28const OVERLAY_INSET: f32 = 16.;
28const OVERLAY_INSET: f32 = 16.;
29const DIVIDER_LINE: f32 = 4.;
30const DIVIDER_LENGTH: f32 = 48.;
31const CHIP_TOP: f32 = 12.;
29const CHIP_TOP: f32 = 12.;
32const TILE_RADIUS: f32 = 12.;
30const TILE_RADIUS: f32 = 12.;
33const HIDDEN_LIST_WIDTH: f32 = 260.;
31const HIDDEN_LIST_WIDTH: f32 = 260.;
@@ -514,7 +512,7 @@ fn people_strip(
514 now: Instant,
512 now: Instant,
515 stage: (f32, f32),
513 stage: (f32, f32),
516) -> Stateful<Div> {
514) -> Stateful<Div> {
517 let StripSplit { width, others, plan } = strip_split(model, state.call_strip_width, stage);
515 let StripSplit { others, plan } = strip_split(model, stage);
518 let size = TileSize::sixteen_by_nine(plan.tile_width);
516 let size = TileSize::sixteen_by_nine(plan.tile_width);
519 let shown = &others[..plan.overflow.shown];
517 let shown = &others[..plan.overflow.shown];
520 let mut cells: Vec<AnyElement> = shown
518 let mut cells: Vec<AnyElement> = shown
@@ -528,40 +526,16 @@ fn people_strip(
528 if plan.overflow.hidden > 0 {
526 if plan.overflow.hidden > 0 {
529 cells.push(overflow_tile(app, state, size, &others[plan.overflow.shown..]));
527 cells.push(overflow_tile(app, state, size, &others[plan.overflow.shown..]));
530 }
528 }
531 v_flex()
529 h_flex()
532 .id("call-strip")
530 .id("call-strip")
533 .debug_selector(|| "shell/islands/main/call-stage/share-strip".into())
531 .debug_selector(|| "shell/islands/main/call-stage/share-strip".into())
534 .flex_none()
532 .flex_none()
535 .w(px(width))
533 .w_full()
536 .items_center()
534 .justify_center()
537 .gap(px(STRIP_GAP))
535 .gap(px(STRIP_GAP))
538 .children(cells)
536 .children(cells)
539}
537}
540
538
541fn strip_divider(app: &Entity<AppState>, dragging: bool) -> Stateful<Div> {
542 let app = app.clone();
543 h_flex()
544 .id("call-strip-divider")
545 .debug_selector(|| "shell/islands/main/call-stage/share-divider".into())
546 .flex_none()
547 .w(px(TILE_GAP))
548 .h_full()
549 .items_center()
550 .justify_center()
551 .cursor_col_resize()
552 .child(
553 div()
554 .w(px(DIVIDER_LINE))
555 .h(px(DIVIDER_LENGTH))
556 .rounded_full()
557 .bg(if dragging { theme::accent() } else { theme::border() }),
558 )
559 .on_mouse_down(MouseButton::Left, move |event, _, cx| {
560 let pointer_x = f32::from(event.position.x);
561 app.update(cx, |state, cx| state.begin_strip_drag(pointer_x, cx));
562 })
563}
564
565fn share_body(
539fn share_body(
566 app: &Entity<AppState>,
540 app: &Entity<AppState>,
567 state: &AppState,
541 state: &AppState,
@@ -571,30 +545,16 @@ fn share_body(
571 layout: CallLayout,
545 layout: CallLayout,
572 stage: (f32, f32),
546 stage: (f32, f32),
573) -> AnyElement {
547) -> AnyElement {
574 let move_app = app.clone();
548 v_flex()
575 let up_app = app.clone();
576 let up_out_app = app.clone();
577 let dragging = state.call.as_ref().is_some_and(|call| call.share_stage.strip_drag.is_some());
578 h_flex()
579 .id("call-share-body")
549 .id("call-share-body")
580 .absolute()
550 .absolute()
581 .inset_0()
551 .inset_0()
582 .p(px(GRID_PADDING))
552 .p(px(GRID_PADDING))
583 .items_center()
553 .gap(px(STRIP_GAP))
584 .on_mouse_move(move |event, _, cx| {
554 .when(layout != CallLayout::Content, |column| {
585 let pointer_x = f32::from(event.position.x);
555 column.child(people_strip(app, state, model, now, stage))
586 move_app.update(cx, |state, cx| state.drag_strip_to(pointer_x, cx));
587 })
588 .on_mouse_up(MouseButton::Left, move |_, _, cx| {
589 up_app.update(cx, |state, cx| state.end_strip_drag(cx));
590 })
591 .on_mouse_up_out(MouseButton::Left, move |_, _, cx| {
592 up_out_app.update(cx, |state, cx| state.end_strip_drag(cx));
593 })
594 .child(share)
595 .when(layout != CallLayout::Content, |row| {
596 row.child(strip_divider(app, dragging)).child(people_strip(app, state, model, now, stage))
597 })
556 })
557 .child(h_flex().flex_1().min_h_0().w_full().child(share))
598 .into_any_element()
558 .into_any_element()
599}
559}
600
560
crates/app/src/views/call_toolbar.rs +9 −0
@@ -12,6 +12,7 @@ pub(super) const TOOL_GAP: f32 = 2.;
12 12 pub(super) const GROUP_GAP: f32 = 12.;
13 13 pub(super) const SPLIT_CHEVRON_WIDTH: f32 = 20.;
14 14 pub(super) const LEAVE_HEIGHT: f32 = 32.;
15 pub(super) const GROUP_DIVIDER_WIDTH: f32 = 1.;
15 16 const TOOL_ICON: f32 = 20.;
16 17 const TOOL_LABEL: f32 = 11.;
17 18 const TOOL_RADIUS: f32 = 6.;
@@ -79,3 +80,11 @@ pub(super) fn split_chevron(button_id: &'static str, face_id: &'static str) -> B
79 80 .child(icon(IconName::ChevronDown, CHEVRON_ICON, theme::text())),
80 81 )
81 82 }
83
84 pub(super) fn group_divider() -> Div {
85 div()
86 .flex_none()
87 .w(px(GROUP_DIVIDER_WIDTH))
88 .h(px(TOOL_HEIGHT - 16.))
89 .bg(theme::border())
90 }
@@ -12,6 +12,7 @@ pub(super) const TOOL_GAP: f32 = 2.;
12pub(super) const GROUP_GAP: f32 = 12.;
12pub(super) const GROUP_GAP: f32 = 12.;
13pub(super) const SPLIT_CHEVRON_WIDTH: f32 = 20.;
13pub(super) const SPLIT_CHEVRON_WIDTH: f32 = 20.;
14pub(super) const LEAVE_HEIGHT: f32 = 32.;
14pub(super) const LEAVE_HEIGHT: f32 = 32.;
15pub(super) const GROUP_DIVIDER_WIDTH: f32 = 1.;
15const TOOL_ICON: f32 = 20.;
16const TOOL_ICON: f32 = 20.;
16const TOOL_LABEL: f32 = 11.;
17const TOOL_LABEL: f32 = 11.;
17const TOOL_RADIUS: f32 = 6.;
18const TOOL_RADIUS: f32 = 6.;
@@ -79,3 +80,11 @@ pub(super) fn split_chevron(button_id: &'static str, face_id: &'static str) -> B
79 .child(icon(IconName::ChevronDown, CHEVRON_ICON, theme::text())),
80 .child(icon(IconName::ChevronDown, CHEVRON_ICON, theme::text())),
80 )
81 )
81}
82}
83
84pub(super) fn group_divider() -> Div {
85 div()
86 .flex_none()
87 .w(px(GROUP_DIVIDER_WIDTH))
88 .h(px(TOOL_HEIGHT - 16.))
89 .bg(theme::border())
90}
crates/app/src/views/call_view.rs +8 −5
@@ -18,7 +18,7 @@ use gpui_kit::*;
18 18 use super::avatar::person_avatar;
19 19 use super::call_control_fold::{Foldable, FoldedControls, fixed_controls_width, folded_for_width, in_more_menu};
20 20 use super::call_toolbar::{
21 GROUP_GAP, LEAVE_HEIGHT, SPLIT_CHEVRON_WIDTH, TOOL_GAP, tool_face, tool_trigger, split_chevron,
21 GROUP_GAP, LEAVE_HEIGHT, group_divider, SPLIT_CHEVRON_WIDTH, TOOL_GAP, tool_face, tool_trigger, split_chevron,
22 22 };
23 23 use super::call_extras::{
24 24 CameraMenu, consent_overlay, consult_banner, hold_panel, recording_chip, return_button,
@@ -907,7 +907,7 @@ fn shows_pop_out(call: &ActiveCall) -> bool {
907 907 fn leave_group(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
908 908 let leave = leave_button(app, model, "call-leave", false)
909 909 .rounded(px(LEAVE_RADIUS))
910 .debug_selector(|| "shell/islands/main/call-header/controls/leave".into());
910 .debug_selector(|| "shell/islands/main/call-header/leave".into());
911 911 if !has_leave_menu(model) {
912 912 return leave.into_any_element();
913 913 }
@@ -1310,8 +1310,10 @@ pub fn render_call_view(
1310 1310 .flex_basis(px(0.))
1311 1311 .min_w_0()
1312 1312 .justify_end()
1313 .gap(px(GROUP_GAP))
1313 1314 .items_center()
1314 .children(return_button(app, model));
1315 .children(return_button(app, model))
1316 .child(leave_group(app, model));
1315 1317
1316 1318 let hold = hold_panel(app, model);
1317 1319 let share_stage = share_stage_element(app, state, call);
@@ -1369,9 +1371,10 @@ pub fn render_call_view(
1369 1371 .gap(px(GROUP_GAP))
1370 1372 .items_center()
1371 1373 .child(devices)
1374 .child(group_divider())
1372 1375 .child(panels_and_reactions)
1373 .child(stage_and_more)
1374 .child(leave_group(app, model));
1376 .child(group_divider())
1377 .child(stage_and_more);
1375 1378 let header = header.child(title_group).child(controls).child(end_group);
1376 1379
1377 1380 let top = v_flex()
@@ -18,7 +18,7 @@ use gpui_kit::*;
18use super::avatar::person_avatar;
18use super::avatar::person_avatar;
19use super::call_control_fold::{Foldable, FoldedControls, fixed_controls_width, folded_for_width, in_more_menu};
19use super::call_control_fold::{Foldable, FoldedControls, fixed_controls_width, folded_for_width, in_more_menu};
20use super::call_toolbar::{
20use super::call_toolbar::{
21 GROUP_GAP, LEAVE_HEIGHT, SPLIT_CHEVRON_WIDTH, TOOL_GAP, tool_face, tool_trigger, split_chevron,
21 GROUP_GAP, LEAVE_HEIGHT, group_divider, SPLIT_CHEVRON_WIDTH, TOOL_GAP, tool_face, tool_trigger, split_chevron,
22};
22};
23use super::call_extras::{
23use super::call_extras::{
24 CameraMenu, consent_overlay, consult_banner, hold_panel, recording_chip, return_button,
24 CameraMenu, consent_overlay, consult_banner, hold_panel, recording_chip, return_button,
@@ -907,7 +907,7 @@ fn shows_pop_out(call: &ActiveCall) -> bool {
907fn leave_group(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
907fn leave_group(app: &Entity<AppState>, model: &CallModel) -> AnyElement {
908 let leave = leave_button(app, model, "call-leave", false)
908 let leave = leave_button(app, model, "call-leave", false)
909 .rounded(px(LEAVE_RADIUS))
909 .rounded(px(LEAVE_RADIUS))
910 .debug_selector(|| "shell/islands/main/call-header/controls/leave".into());
910 .debug_selector(|| "shell/islands/main/call-header/leave".into());
911 if !has_leave_menu(model) {
911 if !has_leave_menu(model) {
912 return leave.into_any_element();
912 return leave.into_any_element();
913 }
913 }
@@ -1310,8 +1310,10 @@ pub fn render_call_view(
1310 .flex_basis(px(0.))
1310 .flex_basis(px(0.))
1311 .min_w_0()
1311 .min_w_0()
1312 .justify_end()
1312 .justify_end()
1313 .gap(px(GROUP_GAP))
1313 .items_center()
1314 .items_center()
1314 .children(return_button(app, model));
1315 .children(return_button(app, model))
1316 .child(leave_group(app, model));
1315
1317
1316 let hold = hold_panel(app, model);
1318 let hold = hold_panel(app, model);
1317 let share_stage = share_stage_element(app, state, call);
1319 let share_stage = share_stage_element(app, state, call);
@@ -1369,9 +1371,10 @@ pub fn render_call_view(
1369 .gap(px(GROUP_GAP))
1371 .gap(px(GROUP_GAP))
1370 .items_center()
1372 .items_center()
1371 .child(devices)
1373 .child(devices)
1374 .child(group_divider())
1372 .child(panels_and_reactions)
1375 .child(panels_and_reactions)
1373 .child(stage_and_more)
1376 .child(group_divider())
1374 .child(leave_group(app, model));
1377 .child(stage_and_more);
1375 let header = header.child(title_group).child(controls).child(end_group);
1378 let header = header.child(title_group).child(controls).child(end_group);
1376
1379
1377 let top = v_flex()
1380 let top = v_flex()