feat(call): stacked gallery while sharing, main window out of capture
- Screen share minimizes the main window like Teams (5 % overlap with the shared monitor) and restores it when sharing stops - Minimized while sharing: narrow stacked gallery (192 wide, up to 4 tiles, divider with +N, own tile, mic/camera/leave) instead of the single mini tile - "Show only active speaker" / "Show more people" switch between gallery and mini tile - Main window excluded from capture during a screen share, included again after - Window share keeps the main window as it is (Daniel-approved deviation, GUARDRAILS.md "Call windows") - Pure decision logic in share_overlay (share kind x minimized -> overlay, exclusion set, gallery layout) with tests - Demo scenes gallery-share and window-share Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -24,6 +24,7 @@ Rules for every change, by people and by agents. If a rule here and a habit else
24
24
| Local bugs | Fix Teams bugs that are purely local (rendering, scroll, focus). Anything touching server data or other people stays as Teams does it. |
25
25
| Performance | Faster, less memory, offline reading from the cache. |
26
26
| Platform | OS-native toasts, tray, title bar and sounds. |
27
| Call windows | Daniel-approved (2026-10-17): a call stays in the main window with the sidebar, Teams opens its own meeting window. A window share leaves the main window as it is (side by side), Teams minimizes it. Only our own window behaviour, nothing others see changes. |
27
28
| Own features | MCP, agents, session inbox: allowed when nobody else can tell. Nothing sent automatically, no own message formats. |
28
29
| Own settings | Settings Teams does not know stay in the local DB, never in Teams account properties. |
29
30
@@ -24,6 +24,7 @@ Rules for every change, by people and by agents. If a rule here and a habit else24
| Local bugs | Fix Teams bugs that are purely local (rendering, scroll, focus). Anything touching server data or other people stays as Teams does it. |24
| Local bugs | Fix Teams bugs that are purely local (rendering, scroll, focus). Anything touching server data or other people stays as Teams does it. |25
| Performance | Faster, less memory, offline reading from the cache. |25
| Performance | Faster, less memory, offline reading from the cache. |26
| Platform | OS-native toasts, tray, title bar and sounds. |26
| Platform | OS-native toasts, tray, title bar and sounds. |27
| Call windows | Daniel-approved (2026-10-17): a call stays in the main window with the sidebar, Teams opens its own meeting window. A window share leaves the main window as it is (side by side), Teams minimizes it. Only our own window behaviour, nothing others see changes. |27
| Own features | MCP, agents, session inbox: allowed when nobody else can tell. Nothing sent automatically, no own message formats. |28
| Own features | MCP, agents, session inbox: allowed when nobody else can tell. Nothing sent automatically, no own message formats. |28
| Own settings | Settings Teams does not know stay in the local DB, never in Teams account properties. |29
| Own settings | Settings Teams does not know stay in the local DB, never in Teams account properties. |29
30
@@ -34,6 +34,8 @@ pub fn show_window_inactive(_handle: NativeHandle) {}
34
34
35
35
pub fn exclude_from_capture(_handle: NativeHandle) {}
36
36
37
pub fn include_in_capture(_handle: NativeHandle) {}
38
37
39
#[cfg(target_os = "linux")]
38
40
pub fn make_window_click_through(window: &Window) {
39
41
super::x11_input::make_input_transparent(window);
@@ -34,6 +34,8 @@ pub fn show_window_inactive(_handle: NativeHandle) {}34
34
35
pub fn exclude_from_capture(_handle: NativeHandle) {}35
pub fn exclude_from_capture(_handle: NativeHandle) {}36
36
37
pub fn include_in_capture(_handle: NativeHandle) {}38
37
#[cfg(target_os = "linux")]39
#[cfg(target_os = "linux")]38
pub fn make_window_click_through(window: &Window) {40
pub fn make_window_click_through(window: &Window) {39
super::x11_input::make_input_transparent(window);41
super::x11_input::make_input_transparent(window);@@ -34,7 +34,7 @@ use windows::Win32::UI::WindowsAndMessaging::{
34
34
SW_SHOWNOACTIVATE, SWP_FRAMECHANGED, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOOWNERZORDER, SWP_NOSIZE,
35
35
SWP_NOZORDER, SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS, SendMessageW, SetForegroundWindow,
36
36
SetLayeredWindowAttributes, SetWindowDisplayAffinity, SetWindowLongPtrW, SetWindowPos,
37
ShowWindow, SystemParametersInfoW, WDA_EXCLUDEFROMCAPTURE, WM_SETICON, WS_CAPTION,
37
ShowWindow, SystemParametersInfoW, WDA_EXCLUDEFROMCAPTURE, WDA_NONE, WM_SETICON, WS_CAPTION,
38
38
WS_EX_LAYERED, WS_EX_NOACTIVATE, WS_EX_TOPMOST, WS_EX_TRANSPARENT, WS_POPUP, WS_THICKFRAME,
39
39
};
40
40
use windows::core::{BOOL, PCWSTR, w};
@@ -272,6 +272,12 @@ pub fn exclude_from_capture(handle: NativeHandle) {
272
272
}
273
273
}
274
274
275
pub fn include_in_capture(handle: NativeHandle) {
276
unsafe {
277
let _ = SetWindowDisplayAffinity(hwnd(handle), WDA_NONE);
278
}
279
}
280
275
281
pub fn make_window_click_through(window: &Window) {
276
282
if let Some(handle) = native_handle(window) {
277
283
make_click_through(handle);
@@ -34,7 +34,7 @@ use windows::Win32::UI::WindowsAndMessaging::{34
SW_SHOWNOACTIVATE, SWP_FRAMECHANGED, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOOWNERZORDER, SWP_NOSIZE,34
SW_SHOWNOACTIVATE, SWP_FRAMECHANGED, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOOWNERZORDER, SWP_NOSIZE,35
SWP_NOZORDER, SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS, SendMessageW, SetForegroundWindow,35
SWP_NOZORDER, SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS, SendMessageW, SetForegroundWindow,36
SetLayeredWindowAttributes, SetWindowDisplayAffinity, SetWindowLongPtrW, SetWindowPos,36
SetLayeredWindowAttributes, SetWindowDisplayAffinity, SetWindowLongPtrW, SetWindowPos,37
ShowWindow, SystemParametersInfoW, WDA_EXCLUDEFROMCAPTURE, WM_SETICON, WS_CAPTION,37
ShowWindow, SystemParametersInfoW, WDA_EXCLUDEFROMCAPTURE, WDA_NONE, WM_SETICON, WS_CAPTION,38
WS_EX_LAYERED, WS_EX_NOACTIVATE, WS_EX_TOPMOST, WS_EX_TRANSPARENT, WS_POPUP, WS_THICKFRAME,38
WS_EX_LAYERED, WS_EX_NOACTIVATE, WS_EX_TOPMOST, WS_EX_TRANSPARENT, WS_POPUP, WS_THICKFRAME,39
};39
};40
use windows::core::{BOOL, PCWSTR, w};40
use windows::core::{BOOL, PCWSTR, w};@@ -272,6 +272,12 @@ pub fn exclude_from_capture(handle: NativeHandle) {272
}272
}273
}273
}274
274
275
pub fn include_in_capture(handle: NativeHandle) {276
unsafe {277
let _ = SetWindowDisplayAffinity(hwnd(handle), WDA_NONE);278
}279
}280
275
pub fn make_window_click_through(window: &Window) {281
pub fn make_window_click_through(window: &Window) {276
if let Some(handle) = native_handle(window) {282
if let Some(handle) = native_handle(window) {277
make_click_through(handle);283
make_click_through(handle);@@ -104,6 +104,8 @@ pub enum DemoScene {
104
104
Mini,
105
105
MiniOff,
106
106
MiniShare,
107
GalleryShare,
108
WindowShare,
107
109
Blocked,
108
110
Removed,
109
111
Dropped,
@@ -126,6 +128,8 @@ impl DemoScene {
126
128
"mini" => DemoScene::Mini,
127
129
"mini-off" => DemoScene::MiniOff,
128
130
"mini-share" => DemoScene::MiniShare,
131
"gallery-share" => DemoScene::GalleryShare,
132
"window-share" => DemoScene::WindowShare,
129
133
"blocked" => DemoScene::Blocked,
130
134
"removed" => DemoScene::Removed,
131
135
"dropped" => DemoScene::Dropped,
@@ -163,7 +167,9 @@ impl DemoScene {
163
167
pub fn guests(self) -> Option<usize> {
164
168
match self {
165
169
DemoScene::Gallery => Some(DEMO_GALLERY_GUESTS),
166
DemoScene::Sharing => Some(DEMO_SHARING_GUESTS),
170
DemoScene::Sharing | DemoScene::GalleryShare | DemoScene::WindowShare => {
171
Some(DEMO_SHARING_GUESTS)
172
}
167
173
_ => None,
168
174
}
169
175
}
@@ -186,6 +192,7 @@ impl DemoScene {
186
192
187
193
pub const DEMO_GALLERY_GUESTS: usize = 12;
188
194
const DEMO_SHARING_GUESTS: usize = 9;
195
const DEMO_SHARED_WINDOW: &str = "Standup board";
189
196
const BREAKOUT_AT_TICKS: u32 = 20;
190
197
const WHITEBOARD_AT_TICKS: u32 = 5;
191
198
const DEMO_BOARD_URL: &str = "https://app.whiteboard.microsoft.com/me/whiteboards/demo";
@@ -269,7 +276,7 @@ fn demo_share_sources() -> Vec<ShareSource> {
269
276
title: String::new(),
270
277
},
271
278
window(2, "Release notes - Docs"),
272
window(3, "Standup board"),
279
window(3, DEMO_SHARED_WINDOW),
273
280
window(4, "Terminal"),
274
281
]
275
282
}
@@ -451,9 +458,12 @@ fn start_scene(control: &CallControl, scene: DemoScene) {
451
458
DemoScene::Hold => control.send(CallUpdate::Hold(HoldState::Local)),
452
459
DemoScene::Held => control.send(CallUpdate::Hold(HoldState::Remote)),
453
460
DemoScene::Network => control.send(CallUpdate::Health(poor_network_health())),
454
DemoScene::MiniShare => {
461
DemoScene::MiniShare | DemoScene::GalleryShare => {
455
462
control.send(CallUpdate::LocalShare(Some("Entire screen".to_owned())))
456
463
}
464
DemoScene::WindowShare => {
465
control.send(CallUpdate::LocalShare(Some(DEMO_SHARED_WINDOW.to_owned())))
466
}
457
467
DemoScene::Call
458
468
| DemoScene::Mini
459
469
| DemoScene::MiniOff
@@ -104,6 +104,8 @@ pub enum DemoScene {104
Mini,104
Mini,105
MiniOff,105
MiniOff,106
MiniShare,106
MiniShare,107
GalleryShare,108
WindowShare,107
Blocked,109
Blocked,108
Removed,110
Removed,109
Dropped,111
Dropped,@@ -126,6 +128,8 @@ impl DemoScene {126
"mini" => DemoScene::Mini,128
"mini" => DemoScene::Mini,127
"mini-off" => DemoScene::MiniOff,129
"mini-off" => DemoScene::MiniOff,128
"mini-share" => DemoScene::MiniShare,130
"mini-share" => DemoScene::MiniShare,131
"gallery-share" => DemoScene::GalleryShare,132
"window-share" => DemoScene::WindowShare,129
"blocked" => DemoScene::Blocked,133
"blocked" => DemoScene::Blocked,130
"removed" => DemoScene::Removed,134
"removed" => DemoScene::Removed,131
"dropped" => DemoScene::Dropped,135
"dropped" => DemoScene::Dropped,@@ -163,7 +167,9 @@ impl DemoScene {163
pub fn guests(self) -> Option<usize> {167
pub fn guests(self) -> Option<usize> {164
match self {168
match self {165
DemoScene::Gallery => Some(DEMO_GALLERY_GUESTS),169
DemoScene::Gallery => Some(DEMO_GALLERY_GUESTS),166
DemoScene::Sharing => Some(DEMO_SHARING_GUESTS),170
DemoScene::Sharing | DemoScene::GalleryShare | DemoScene::WindowShare => {171
Some(DEMO_SHARING_GUESTS)172
}167
_ => None,173
_ => None,168
}174
}169
}175
}@@ -186,6 +192,7 @@ impl DemoScene {186
192
187
pub const DEMO_GALLERY_GUESTS: usize = 12;193
pub const DEMO_GALLERY_GUESTS: usize = 12;188
const DEMO_SHARING_GUESTS: usize = 9;194
const DEMO_SHARING_GUESTS: usize = 9;195
const DEMO_SHARED_WINDOW: &str = "Standup board";189
const BREAKOUT_AT_TICKS: u32 = 20;196
const BREAKOUT_AT_TICKS: u32 = 20;190
const WHITEBOARD_AT_TICKS: u32 = 5;197
const WHITEBOARD_AT_TICKS: u32 = 5;191
const DEMO_BOARD_URL: &str = "https://app.whiteboard.microsoft.com/me/whiteboards/demo";198
const DEMO_BOARD_URL: &str = "https://app.whiteboard.microsoft.com/me/whiteboards/demo";@@ -269,7 +276,7 @@ fn demo_share_sources() -> Vec<ShareSource> {269
title: String::new(),276
title: String::new(),270
},277
},271
window(2, "Release notes - Docs"),278
window(2, "Release notes - Docs"),272
window(3, "Standup board"),279
window(3, DEMO_SHARED_WINDOW),273
window(4, "Terminal"),280
window(4, "Terminal"),274
]281
]275
}282
}@@ -451,9 +458,12 @@ fn start_scene(control: &CallControl, scene: DemoScene) {451
DemoScene::Hold => control.send(CallUpdate::Hold(HoldState::Local)),458
DemoScene::Hold => control.send(CallUpdate::Hold(HoldState::Local)),452
DemoScene::Held => control.send(CallUpdate::Hold(HoldState::Remote)),459
DemoScene::Held => control.send(CallUpdate::Hold(HoldState::Remote)),453
DemoScene::Network => control.send(CallUpdate::Health(poor_network_health())),460
DemoScene::Network => control.send(CallUpdate::Health(poor_network_health())),454
DemoScene::MiniShare => {461
DemoScene::MiniShare | DemoScene::GalleryShare => {455
control.send(CallUpdate::LocalShare(Some("Entire screen".to_owned())))462
control.send(CallUpdate::LocalShare(Some("Entire screen".to_owned())))456
}463
}464
DemoScene::WindowShare => {465
control.send(CallUpdate::LocalShare(Some(DEMO_SHARED_WINDOW.to_owned())))466
}457
DemoScene::Call467
DemoScene::Call458
| DemoScene::Mini468
| DemoScene::Mini459
| DemoScene::MiniOff469
| DemoScene::MiniOff@@ -14,6 +14,7 @@ pub mod prejoin;
14
14
pub mod record_load;
15
15
pub mod reminder;
16
16
pub mod share_actions;
17
pub mod share_overlay;
17
18
pub mod schedule;
18
19
pub mod target;
19
20
pub mod view_actions;
@@ -14,6 +14,7 @@ pub mod prejoin;14
pub mod record_load;14
pub mod record_load;15
pub mod reminder;15
pub mod reminder;16
pub mod share_actions;16
pub mod share_actions;17
pub mod share_overlay;17
pub mod schedule;18
pub mod schedule;18
pub mod target;19
pub mod target;19
pub mod view_actions;20
pub mod view_actions;@@ -117,10 +117,6 @@ pub fn mini_work_area(
117
117
.unwrap_or(main)
118
118
}
119
119
120
pub fn mini_wanted(call_active: bool, main_minimized: bool) -> bool {
121
call_active && main_minimized
122
}
123
124
120
pub fn parse_position(text: &str) -> Option<(i32, i32)> {
125
121
let (left, top) = text.split_once(',')?;
126
122
Some((left.trim().parse().ok()?, top.trim().parse().ok()?))
@@ -276,13 +272,6 @@ mod tests {
276
272
assert_eq!((rect.width(), rect.height()), (640, 360));
277
273
}
278
274
279
#[test]
280
fn mini_shows_only_in_a_call_with_the_main_window_minimized() {
281
assert!(mini_wanted(true, true));
282
assert!(!mini_wanted(true, false));
283
assert!(!mini_wanted(false, true));
284
}
285
286
275
#[test]
287
276
fn position_round_trips() {
288
277
assert_eq!(
@@ -117,10 +117,6 @@ pub fn mini_work_area(117
.unwrap_or(main)117
.unwrap_or(main)118
}118
}119
119
120
pub fn mini_wanted(call_active: bool, main_minimized: bool) -> bool {121
call_active && main_minimized122
}123
124
pub fn parse_position(text: &str) -> Option<(i32, i32)> {120
pub fn parse_position(text: &str) -> Option<(i32, i32)> {125
let (left, top) = text.split_once(',')?;121
let (left, top) = text.split_once(',')?;126
Some((left.trim().parse().ok()?, top.trim().parse().ok()?))122
Some((left.trim().parse().ok()?, top.trim().parse().ok()?))@@ -276,13 +272,6 @@ mod tests {276
assert_eq!((rect.width(), rect.height()), (640, 360));272
assert_eq!((rect.width(), rect.height()), (640, 360));277
}273
}278
274
279
#[test]280
fn mini_shows_only_in_a_call_with_the_main_window_minimized() {281
assert!(mini_wanted(true, true));282
assert!(!mini_wanted(true, false));283
assert!(!mini_wanted(false, true));284
}285
286
#[test]275
#[test]287
fn position_round_trips() {276
fn position_round_trips() {288
assert_eq!(277
assert_eq!(@@ -7,12 +7,18 @@ use gpui_kit::*;
7
7
use super::model::format_elapsed;
8
8
use super::overlay_layout::{
9
9
BorderVisibility, MINI_POSITION_KEY, bar_collapsed, bar_rect, border_rects, border_thickness,
10
border_visibility, format_position, mini_rect, mini_wanted, mini_work_area, parse_position,
10
border_visibility, format_position, mini_rect, mini_work_area, parse_position,
11
};
12
use super::share_overlay::{
13
GALLERY_POSITION_KEY, GalleryLayout, LocalShare, Monitor, Surface, excluded_from_capture,
14
gallery_available_height, gallery_candidates, gallery_layout, gallery_rect,
15
minimize_on_share_start, overlay_plan,
11
16
};
12
17
use crate::app_state::AppState;
13
18
use crate::notify::platform::{self, NativeHandle, ScreenRect, ShareGeometry, WorkArea};
14
19
use crate::views::call_mini_window::MiniWindowView;
15
20
use crate::views::call_pop_out::{POP_OUT_SIZE, POP_OUT_TITLE, SharePopOutView};
21
use crate::views::call_share_gallery::ShareGalleryView;
16
22
use crate::views::share_bar::{ShareBarView, ShareBorderView};
17
23
18
24
const TICK: Duration = Duration::from_millis(100);
@@ -24,6 +30,7 @@ const BORDER_SIDES: usize = 4;
24
30
enum Role {
25
31
Bar,
26
32
Mini,
33
Gallery,
27
34
Border(usize),
28
35
}
29
36
@@ -76,6 +83,7 @@ struct ShareSession {
76
83
started: Instant,
77
84
source: Option<ShareSource>,
78
85
geometry: Option<ShareGeometry>,
86
minimize_checked: bool,
79
87
}
80
88
81
89
pub struct CallWindows {
@@ -95,6 +103,12 @@ pub struct CallWindows {
95
103
shown_second: u64,
96
104
mini_saved: Option<(i32, i32)>,
97
105
mini_seen: Option<(i32, i32)>,
106
gallery_saved: Option<(i32, i32)>,
107
gallery_seen: Option<(i32, i32)>,
108
gallery_layout: GalleryLayout,
109
speaker_only: bool,
110
main_excluded: bool,
111
minimized_for_share: bool,
98
112
ticks: u32,
99
113
}
100
114
@@ -125,12 +139,12 @@ fn overlay_options(role: Role, rect: ScreenRect, scale: f32) -> WindowOptions {
125
139
focus: false,
126
140
show: true,
127
141
kind: WindowKind::PopUp,
128
is_movable: role == Role::Mini,
142
is_movable: matches!(role, Role::Mini | Role::Gallery),
129
143
is_resizable: false,
130
144
is_minimizable: false,
131
145
window_background: match role {
132
146
Role::Border(_) => WindowBackgroundAppearance::Opaque,
133
Role::Bar | Role::Mini => WindowBackgroundAppearance::Transparent,
147
Role::Bar | Role::Mini | Role::Gallery => WindowBackgroundAppearance::Transparent,
134
148
},
135
149
..Default::default()
136
150
}
@@ -138,13 +152,16 @@ fn overlay_options(role: Role, rect: ScreenRect, scale: f32) -> WindowOptions {
138
152
139
153
impl CallWindows {
140
154
pub fn new(app: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
141
let mini_saved = app
142
.read(cx)
143
.store
144
.meta(MINI_POSITION_KEY)
145
.ok()
146
.flatten()
147
.and_then(|text| parse_position(&text));
155
let saved_position = |key: &str, cx: &App| {
156
app.read(cx)
157
.store
158
.meta(key)
159
.ok()
160
.flatten()
161
.and_then(|text| parse_position(&text))
162
};
163
let mini_saved = saved_position(MINI_POSITION_KEY, cx);
164
let gallery_saved = saved_position(GALLERY_POSITION_KEY, cx);
148
165
let windows = CallWindows {
149
166
app,
150
167
main_window: window.window_handle(),
@@ -162,6 +179,12 @@ impl CallWindows {
162
179
shown_second: 0,
163
180
mini_saved,
164
181
mini_seen: None,
182
gallery_saved,
183
gallery_seen: None,
184
gallery_layout: gallery_layout(0, true, f32::MAX),
185
speaker_only: false,
186
main_excluded: false,
187
minimized_for_share: false,
165
188
ticks: 0,
166
189
};
167
190
cx.spawn(async move |this, cx| {
@@ -190,6 +213,19 @@ impl CallWindows {
190
213
self.bar_collapsed
191
214
}
192
215
216
pub fn gallery_layout(&self) -> GalleryLayout {
217
self.gallery_layout
218
}
219
220
pub fn sharing(&self) -> bool {
221
self.share.is_some()
222
}
223
224
pub fn toggle_speaker_only(&mut self, cx: &mut Context<Self>) {
225
self.speaker_only = !self.speaker_only;
226
cx.notify();
227
}
228
193
229
pub fn share_text(&self) -> String {
194
230
let Some(session) = &self.share else {
195
231
return String::new();
@@ -233,6 +269,7 @@ impl CallWindows {
233
269
&& self.share.is_none()
234
270
&& self.windows.is_empty()
235
271
&& self.opening.is_empty()
272
&& !self.main_excluded
236
273
}
237
274
238
275
fn tick(&mut self, cx: &mut Context<Self>) -> Duration {
@@ -243,10 +280,12 @@ impl CallWindows {
243
280
let slow = self.ticks % SLOW_TICK_EVERY == 0;
244
281
self.refresh_main_window();
245
282
self.sync_share(slow, cx);
283
self.sync_capture_exclusion();
246
284
self.sync_pop_out(cx);
247
self.sync_mini(cx);
285
self.sync_monitor(cx);
248
286
if slow {
249
self.track_mini_position(cx);
287
self.track_position(Role::Mini, cx);
288
self.track_position(Role::Gallery, cx);
250
289
}
251
290
TICK
252
291
}
@@ -255,7 +294,11 @@ impl CallWindows {
255
294
let Some(native) = self.main_native else {
256
295
return;
257
296
};
258
self.minimized = platform::window_minimized(native);
297
let minimized = platform::window_minimized(native);
298
if self.minimized && !minimized {
299
self.minimized_for_share = false;
300
}
301
self.minimized = minimized;
259
302
if !self.minimized {
260
303
self.work_area = platform::work_area(native).or(self.work_area);
261
304
}
@@ -285,6 +328,7 @@ impl CallWindows {
285
328
started: Instant::now(),
286
329
source: None,
287
330
geometry: None,
331
minimize_checked: false,
288
332
});
289
333
refresh_geometry = true;
290
334
}
@@ -305,6 +349,10 @@ impl CallWindows {
305
349
}
306
350
let geometry = session.geometry;
307
351
let elapsed_seconds = session.started.elapsed().as_secs();
352
let check_minimize = !std::mem::replace(&mut session.minimize_checked, true);
353
if check_minimize {
354
self.minimize_for_share(geometry.map(|geometry| geometry.target), cx);
355
}
308
356
let Some(work) = geometry
309
357
.map(|geometry| geometry.work)
310
358
.or(self.work_area)
@@ -347,10 +395,55 @@ impl CallWindows {
347
395
}
348
396
}
349
397
398
fn local_share_mode(&self) -> LocalShare {
399
let kind = self
400
.share
401
.as_ref()
402
.and_then(|session| session.source.as_ref())
403
.map(|source| source.kind);
404
LocalShare::of(kind, self.share.is_some())
405
}
406
407
fn minimize_for_share(&mut self, shared: Option<ScreenRect>, cx: &mut Context<Self>) {
408
let Some(native) = self.main_native.filter(|_| !self.minimized) else {
409
return;
410
};
411
if !minimize_on_share_start(
412
self.local_share_mode(),
413
platform::window_rect(native),
414
shared,
415
) {
416
return;
417
}
418
self.minimized_for_share = true;
419
self.main_window
420
.update(cx, |_, window, _| window.minimize_window())
421
.ok();
422
}
423
424
fn sync_capture_exclusion(&mut self) {
425
let Some(native) = self.main_native else {
426
return;
427
};
428
let wanted = excluded_from_capture(Surface::Main, self.local_share_mode());
429
if wanted == self.main_excluded {
430
return;
431
}
432
self.main_excluded = wanted;
433
if wanted {
434
platform::exclude_from_capture(native);
435
} else {
436
platform::include_in_capture(native);
437
}
438
}
439
350
440
fn end_share(&mut self, cx: &mut Context<Self>) {
351
441
if self.share.take().is_none() {
352
442
return;
353
443
}
444
if std::mem::take(&mut self.minimized_for_share) && self.minimized {
445
self.return_to_call(cx);
446
}
354
447
self.bar_collapsed = false;
355
448
self.close(Role::Bar, cx);
356
449
self.close_borders(cx);
@@ -419,40 +512,91 @@ impl CallWindows {
419
512
});
420
513
}
421
514
422
fn sync_mini(&mut self, cx: &mut Context<Self>) {
515
fn sync_monitor(&mut self, cx: &mut Context<Self>) {
423
516
let in_call = self.app.read(cx).call.is_some();
517
let plan = overlay_plan(
518
in_call,
519
self.local_share_mode(),
520
self.minimized,
521
self.speaker_only,
522
);
424
523
let work = self.work_area.or_else(|| display_work_area(cx));
425
match work.filter(|_| mini_wanted(in_call, self.minimized)) {
426
Some(main_work) => {
524
match (plan.monitor, work) {
525
(Monitor::Mini, Some(main_work)) => {
526
self.close(Role::Gallery, cx);
427
527
let work = mini_work_area(main_work, self.mini_saved, platform::work_area_at);
428
528
let rect = mini_rect(work, self.mini_saved);
429
529
self.ensure_window(Role::Mini, rect, work.scale, false, cx);
430
530
}
431
None => self.close(Role::Mini, cx),
531
(Monitor::Gallery, Some(main_work)) => {
532
self.close(Role::Mini, cx);
533
self.place_gallery(main_work, cx);
534
}
535
_ => {
536
self.close(Role::Mini, cx);
537
self.close(Role::Gallery, cx);
538
}
432
539
}
433
540
}
434
541
435
fn track_mini_position(&mut self, cx: &mut Context<Self>) {
436
let Some(native) = self
542
fn place_gallery(&mut self, main_work: WorkArea, cx: &mut Context<Self>) {
543
let work = mini_work_area(main_work, self.gallery_saved, platform::work_area_at);
544
let (others, self_tile) = self.app.read(cx).call.as_ref().map_or((0, true), |call| {
545
(
546
gallery_candidates(&call.model).len(),
547
!call.model.view.hide_me,
548
)
549
});
550
let layout = gallery_layout(others, self_tile, gallery_available_height(work));
551
if layout != self.gallery_layout {
552
self.gallery_layout = layout;
553
cx.notify();
554
}
555
let origin = self
437
556
.windows
438
.get(&Role::Mini)
557
.get(&Role::Gallery)
439
558
.and_then(|placed| placed.native)
440
else {
559
.and_then(platform::window_rect)
560
.map(|rect| (rect.left, rect.top))
561
.or(self.gallery_saved);
562
let rect = gallery_rect(work, layout, origin);
563
match self.windows.get_mut(&Role::Gallery) {
564
Some(placed) => {
565
let size = |rect: ScreenRect| (rect.width(), rect.height());
566
if placed.rect.map(size) != Some(size(rect)) {
567
placed.place(rect, cx);
568
}
569
}
570
None => self.open(Role::Gallery, rect, work.scale, cx),
571
}
572
}
573
574
fn track_position(&mut self, role: Role, cx: &mut Context<Self>) {
575
let Some(native) = self.windows.get(&role).and_then(|placed| placed.native) else {
441
576
return;
442
577
};
443
578
let Some(rect) = platform::window_rect(native) else {
444
579
return;
445
580
};
581
let (key, saved, seen) = match role {
582
Role::Mini => (MINI_POSITION_KEY, &mut self.mini_saved, &mut self.mini_seen),
583
Role::Gallery => (
584
GALLERY_POSITION_KEY,
585
&mut self.gallery_saved,
586
&mut self.gallery_seen,
587
),
588
Role::Bar | Role::Border(_) => return,
589
};
446
590
let position = (rect.left, rect.top);
447
let settled = self.mini_seen == Some(position);
448
self.mini_seen = Some(position);
449
if settled && self.mini_saved != Some(position) {
450
self.mini_saved = Some(position);
591
let settled = *seen == Some(position);
592
*seen = Some(position);
593
if settled && *saved != Some(position) {
594
*saved = Some(position);
451
595
let _ = self
452
596
.app
453
597
.read(cx)
454
598
.store
455
.set_meta(MINI_POSITION_KEY, &format_position(position.0, position.1));
599
.set_meta(key, &format_position(position.0, position.1));
456
600
}
457
601
}
458
602
@@ -506,6 +650,9 @@ impl CallWindows {
506
650
let view: AnyView = match role {
507
651
Role::Bar => cx.new(|cx| ShareBarView::new(view_controller, cx)).into(),
508
652
Role::Mini => cx.new(|cx| MiniWindowView::new(view_controller, cx)).into(),
653
Role::Gallery => cx
654
.new(|cx| ShareGalleryView::new(view_controller, cx))
655
.into(),
509
656
Role::Border(_) => cx.new(|_| ShareBorderView).into(),
510
657
};
511
658
cx.new(|cx| base::Root::new(view, window, cx).bg(transparent_black()))
@@ -7,12 +7,18 @@ use gpui_kit::*;7
use super::model::format_elapsed;7
use super::model::format_elapsed;8
use super::overlay_layout::{8
use super::overlay_layout::{9
BorderVisibility, MINI_POSITION_KEY, bar_collapsed, bar_rect, border_rects, border_thickness,9
BorderVisibility, MINI_POSITION_KEY, bar_collapsed, bar_rect, border_rects, border_thickness,10
border_visibility, format_position, mini_rect, mini_wanted, mini_work_area, parse_position,10
border_visibility, format_position, mini_rect, mini_work_area, parse_position,11
};12
use super::share_overlay::{13
GALLERY_POSITION_KEY, GalleryLayout, LocalShare, Monitor, Surface, excluded_from_capture,14
gallery_available_height, gallery_candidates, gallery_layout, gallery_rect,15
minimize_on_share_start, overlay_plan,11
};16
};12
use crate::app_state::AppState;17
use crate::app_state::AppState;13
use crate::notify::platform::{self, NativeHandle, ScreenRect, ShareGeometry, WorkArea};18
use crate::notify::platform::{self, NativeHandle, ScreenRect, ShareGeometry, WorkArea};14
use crate::views::call_mini_window::MiniWindowView;19
use crate::views::call_mini_window::MiniWindowView;15
use crate::views::call_pop_out::{POP_OUT_SIZE, POP_OUT_TITLE, SharePopOutView};20
use crate::views::call_pop_out::{POP_OUT_SIZE, POP_OUT_TITLE, SharePopOutView};21
use crate::views::call_share_gallery::ShareGalleryView;16
use crate::views::share_bar::{ShareBarView, ShareBorderView};22
use crate::views::share_bar::{ShareBarView, ShareBorderView};17
23
18
const TICK: Duration = Duration::from_millis(100);24
const TICK: Duration = Duration::from_millis(100);@@ -24,6 +30,7 @@ const BORDER_SIDES: usize = 4;24
enum Role {30
enum Role {25
Bar,31
Bar,26
Mini,32
Mini,33
Gallery,27
Border(usize),34
Border(usize),28
}35
}29
36
@@ -76,6 +83,7 @@ struct ShareSession {76
started: Instant,83
started: Instant,77
source: Option<ShareSource>,84
source: Option<ShareSource>,78
geometry: Option<ShareGeometry>,85
geometry: Option<ShareGeometry>,86
minimize_checked: bool,79
}87
}80
88
81
pub struct CallWindows {89
pub struct CallWindows {@@ -95,6 +103,12 @@ pub struct CallWindows {95
shown_second: u64,103
shown_second: u64,96
mini_saved: Option<(i32, i32)>,104
mini_saved: Option<(i32, i32)>,97
mini_seen: Option<(i32, i32)>,105
mini_seen: Option<(i32, i32)>,106
gallery_saved: Option<(i32, i32)>,107
gallery_seen: Option<(i32, i32)>,108
gallery_layout: GalleryLayout,109
speaker_only: bool,110
main_excluded: bool,111
minimized_for_share: bool,98
ticks: u32,112
ticks: u32,99
}113
}100
114
@@ -125,12 +139,12 @@ fn overlay_options(role: Role, rect: ScreenRect, scale: f32) -> WindowOptions {125
focus: false,139
focus: false,126
show: true,140
show: true,127
kind: WindowKind::PopUp,141
kind: WindowKind::PopUp,128
is_movable: role == Role::Mini,142
is_movable: matches!(role, Role::Mini | Role::Gallery),129
is_resizable: false,143
is_resizable: false,130
is_minimizable: false,144
is_minimizable: false,131
window_background: match role {145
window_background: match role {132
Role::Border(_) => WindowBackgroundAppearance::Opaque,146
Role::Border(_) => WindowBackgroundAppearance::Opaque,133
Role::Bar | Role::Mini => WindowBackgroundAppearance::Transparent,147
Role::Bar | Role::Mini | Role::Gallery => WindowBackgroundAppearance::Transparent,134
},148
},135
..Default::default()149
..Default::default()136
}150
}@@ -138,13 +152,16 @@ fn overlay_options(role: Role, rect: ScreenRect, scale: f32) -> WindowOptions {138
152
139
impl CallWindows {153
impl CallWindows {140
pub fn new(app: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {154
pub fn new(app: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {141
let mini_saved = app155
let saved_position = |key: &str, cx: &App| {142
.read(cx)156
app.read(cx)143
.store157
.store144
.meta(MINI_POSITION_KEY)158
.meta(key)145
.ok()159
.ok()146
.flatten()160
.flatten()147
.and_then(|text| parse_position(&text));161
.and_then(|text| parse_position(&text))162
};163
let mini_saved = saved_position(MINI_POSITION_KEY, cx);164
let gallery_saved = saved_position(GALLERY_POSITION_KEY, cx);148
let windows = CallWindows {165
let windows = CallWindows {149
app,166
app,150
main_window: window.window_handle(),167
main_window: window.window_handle(),@@ -162,6 +179,12 @@ impl CallWindows {162
shown_second: 0,179
shown_second: 0,163
mini_saved,180
mini_saved,164
mini_seen: None,181
mini_seen: None,182
gallery_saved,183
gallery_seen: None,184
gallery_layout: gallery_layout(0, true, f32::MAX),185
speaker_only: false,186
main_excluded: false,187
minimized_for_share: false,165
ticks: 0,188
ticks: 0,166
};189
};167
cx.spawn(async move |this, cx| {190
cx.spawn(async move |this, cx| {@@ -190,6 +213,19 @@ impl CallWindows {190
self.bar_collapsed213
self.bar_collapsed191
}214
}192
215
216
pub fn gallery_layout(&self) -> GalleryLayout {217
self.gallery_layout218
}219
220
pub fn sharing(&self) -> bool {221
self.share.is_some()222
}223
224
pub fn toggle_speaker_only(&mut self, cx: &mut Context<Self>) {225
self.speaker_only = !self.speaker_only;226
cx.notify();227
}228
193
pub fn share_text(&self) -> String {229
pub fn share_text(&self) -> String {194
let Some(session) = &self.share else {230
let Some(session) = &self.share else {195
return String::new();231
return String::new();@@ -233,6 +269,7 @@ impl CallWindows {233
&& self.share.is_none()269
&& self.share.is_none()234
&& self.windows.is_empty()270
&& self.windows.is_empty()235
&& self.opening.is_empty()271
&& self.opening.is_empty()272
&& !self.main_excluded236
}273
}237
274
238
fn tick(&mut self, cx: &mut Context<Self>) -> Duration {275
fn tick(&mut self, cx: &mut Context<Self>) -> Duration {@@ -243,10 +280,12 @@ impl CallWindows {243
let slow = self.ticks % SLOW_TICK_EVERY == 0;280
let slow = self.ticks % SLOW_TICK_EVERY == 0;244
self.refresh_main_window();281
self.refresh_main_window();245
self.sync_share(slow, cx);282
self.sync_share(slow, cx);283
self.sync_capture_exclusion();246
self.sync_pop_out(cx);284
self.sync_pop_out(cx);247
self.sync_mini(cx);285
self.sync_monitor(cx);248
if slow {286
if slow {249
self.track_mini_position(cx);287
self.track_position(Role::Mini, cx);288
self.track_position(Role::Gallery, cx);250
}289
}251
TICK290
TICK252
}291
}@@ -255,7 +294,11 @@ impl CallWindows {255
let Some(native) = self.main_native else {294
let Some(native) = self.main_native else {256
return;295
return;257
};296
};258
self.minimized = platform::window_minimized(native);297
let minimized = platform::window_minimized(native);298
if self.minimized && !minimized {299
self.minimized_for_share = false;300
}301
self.minimized = minimized;259
if !self.minimized {302
if !self.minimized {260
self.work_area = platform::work_area(native).or(self.work_area);303
self.work_area = platform::work_area(native).or(self.work_area);261
}304
}@@ -285,6 +328,7 @@ impl CallWindows {285
started: Instant::now(),328
started: Instant::now(),286
source: None,329
source: None,287
geometry: None,330
geometry: None,331
minimize_checked: false,288
});332
});289
refresh_geometry = true;333
refresh_geometry = true;290
}334
}@@ -305,6 +349,10 @@ impl CallWindows {305
}349
}306
let geometry = session.geometry;350
let geometry = session.geometry;307
let elapsed_seconds = session.started.elapsed().as_secs();351
let elapsed_seconds = session.started.elapsed().as_secs();352
let check_minimize = !std::mem::replace(&mut session.minimize_checked, true);353
if check_minimize {354
self.minimize_for_share(geometry.map(|geometry| geometry.target), cx);355
}308
let Some(work) = geometry356
let Some(work) = geometry309
.map(|geometry| geometry.work)357
.map(|geometry| geometry.work)310
.or(self.work_area)358
.or(self.work_area)@@ -347,10 +395,55 @@ impl CallWindows {347
}395
}348
}396
}349
397
398
fn local_share_mode(&self) -> LocalShare {399
let kind = self400
.share401
.as_ref()402
.and_then(|session| session.source.as_ref())403
.map(|source| source.kind);404
LocalShare::of(kind, self.share.is_some())405
}406
407
fn minimize_for_share(&mut self, shared: Option<ScreenRect>, cx: &mut Context<Self>) {408
let Some(native) = self.main_native.filter(|_| !self.minimized) else {409
return;410
};411
if !minimize_on_share_start(412
self.local_share_mode(),413
platform::window_rect(native),414
shared,415
) {416
return;417
}418
self.minimized_for_share = true;419
self.main_window420
.update(cx, |_, window, _| window.minimize_window())421
.ok();422
}423
424
fn sync_capture_exclusion(&mut self) {425
let Some(native) = self.main_native else {426
return;427
};428
let wanted = excluded_from_capture(Surface::Main, self.local_share_mode());429
if wanted == self.main_excluded {430
return;431
}432
self.main_excluded = wanted;433
if wanted {434
platform::exclude_from_capture(native);435
} else {436
platform::include_in_capture(native);437
}438
}439
350
fn end_share(&mut self, cx: &mut Context<Self>) {440
fn end_share(&mut self, cx: &mut Context<Self>) {351
if self.share.take().is_none() {441
if self.share.take().is_none() {352
return;442
return;353
}443
}444
if std::mem::take(&mut self.minimized_for_share) && self.minimized {445
self.return_to_call(cx);446
}354
self.bar_collapsed = false;447
self.bar_collapsed = false;355
self.close(Role::Bar, cx);448
self.close(Role::Bar, cx);356
self.close_borders(cx);449
self.close_borders(cx);@@ -419,40 +512,91 @@ impl CallWindows {419
});512
});420
}513
}421
514
422
fn sync_mini(&mut self, cx: &mut Context<Self>) {515
fn sync_monitor(&mut self, cx: &mut Context<Self>) {423
let in_call = self.app.read(cx).call.is_some();516
let in_call = self.app.read(cx).call.is_some();517
let plan = overlay_plan(518
in_call,519
self.local_share_mode(),520
self.minimized,521
self.speaker_only,522
);424
let work = self.work_area.or_else(|| display_work_area(cx));523
let work = self.work_area.or_else(|| display_work_area(cx));425
match work.filter(|_| mini_wanted(in_call, self.minimized)) {524
match (plan.monitor, work) {426
Some(main_work) => {525
(Monitor::Mini, Some(main_work)) => {526
self.close(Role::Gallery, cx);427
let work = mini_work_area(main_work, self.mini_saved, platform::work_area_at);527
let work = mini_work_area(main_work, self.mini_saved, platform::work_area_at);428
let rect = mini_rect(work, self.mini_saved);528
let rect = mini_rect(work, self.mini_saved);429
self.ensure_window(Role::Mini, rect, work.scale, false, cx);529
self.ensure_window(Role::Mini, rect, work.scale, false, cx);430
}530
}431
None => self.close(Role::Mini, cx),531
(Monitor::Gallery, Some(main_work)) => {532
self.close(Role::Mini, cx);533
self.place_gallery(main_work, cx);534
}535
_ => {536
self.close(Role::Mini, cx);537
self.close(Role::Gallery, cx);538
}432
}539
}433
}540
}434
541
435
fn track_mini_position(&mut self, cx: &mut Context<Self>) {542
fn place_gallery(&mut self, main_work: WorkArea, cx: &mut Context<Self>) {436
let Some(native) = self543
let work = mini_work_area(main_work, self.gallery_saved, platform::work_area_at);544
let (others, self_tile) = self.app.read(cx).call.as_ref().map_or((0, true), |call| {545
(546
gallery_candidates(&call.model).len(),547
!call.model.view.hide_me,548
)549
});550
let layout = gallery_layout(others, self_tile, gallery_available_height(work));551
if layout != self.gallery_layout {552
self.gallery_layout = layout;553
cx.notify();554
}555
let origin = self437
.windows556
.windows438
.get(&Role::Mini)557
.get(&Role::Gallery)439
.and_then(|placed| placed.native)558
.and_then(|placed| placed.native)440
else {559
.and_then(platform::window_rect)560
.map(|rect| (rect.left, rect.top))561
.or(self.gallery_saved);562
let rect = gallery_rect(work, layout, origin);563
match self.windows.get_mut(&Role::Gallery) {564
Some(placed) => {565
let size = |rect: ScreenRect| (rect.width(), rect.height());566
if placed.rect.map(size) != Some(size(rect)) {567
placed.place(rect, cx);568
}569
}570
None => self.open(Role::Gallery, rect, work.scale, cx),571
}572
}573
574
fn track_position(&mut self, role: Role, cx: &mut Context<Self>) {575
let Some(native) = self.windows.get(&role).and_then(|placed| placed.native) else {441
return;576
return;442
};577
};443
let Some(rect) = platform::window_rect(native) else {578
let Some(rect) = platform::window_rect(native) else {444
return;579
return;445
};580
};581
let (key, saved, seen) = match role {582
Role::Mini => (MINI_POSITION_KEY, &mut self.mini_saved, &mut self.mini_seen),583
Role::Gallery => (584
GALLERY_POSITION_KEY,585
&mut self.gallery_saved,586
&mut self.gallery_seen,587
),588
Role::Bar | Role::Border(_) => return,589
};446
let position = (rect.left, rect.top);590
let position = (rect.left, rect.top);447
let settled = self.mini_seen == Some(position);591
let settled = *seen == Some(position);448
self.mini_seen = Some(position);592
*seen = Some(position);449
if settled && self.mini_saved != Some(position) {593
if settled && *saved != Some(position) {450
self.mini_saved = Some(position);594
*saved = Some(position);451
let _ = self595
let _ = self452
.app596
.app453
.read(cx)597
.read(cx)454
.store598
.store455
.set_meta(MINI_POSITION_KEY, &format_position(position.0, position.1));599
.set_meta(key, &format_position(position.0, position.1));456
}600
}457
}601
}458
602
@@ -506,6 +650,9 @@ impl CallWindows {506
let view: AnyView = match role {650
let view: AnyView = match role {507
Role::Bar => cx.new(|cx| ShareBarView::new(view_controller, cx)).into(),651
Role::Bar => cx.new(|cx| ShareBarView::new(view_controller, cx)).into(),508
Role::Mini => cx.new(|cx| MiniWindowView::new(view_controller, cx)).into(),652
Role::Mini => cx.new(|cx| MiniWindowView::new(view_controller, cx)).into(),653
Role::Gallery => cx654
.new(|cx| ShareGalleryView::new(view_controller, cx))655
.into(),509
Role::Border(_) => cx.new(|_| ShareBorderView).into(),656
Role::Border(_) => cx.new(|_| ShareBorderView).into(),510
};657
};511
cx.new(|cx| base::Root::new(view, window, cx).bg(transparent_black()))658
cx.new(|cx| base::Root::new(view, window, cx).bg(transparent_black()))@@ -3,9 +3,11 @@ use std::time::Instant;
3
3
use calling::VideoKey;
4
4
use gpui_kit::assets::IconName;
5
5
use gpui_kit::component::{h_flex, tooltip::Tooltip, v_flex};
6
use gpui_kit::prelude::FluentBuilder as _;
6
7
use gpui_kit::*;
7
8
8
9
use super::avatar::person_avatar;
10
use super::call_share_gallery::{SHOW_MORE_PEOPLE, view_switch_button};
9
11
use super::call_view::{camera_button, leave_button, mute_button, round_control, status_line};
10
12
use super::widgets::icon;
11
13
use crate::app_state::AppState;
@@ -234,6 +236,7 @@ impl Render for MiniWindowView {
234
236
let now = Instant::now();
235
237
let (status, _) = status_line(model, now);
236
238
let windows = self.windows.clone();
239
let sharing = self.windows.read(cx).sharing();
237
240
let speaking = speaker_speaking(model);
238
241
let speaker_name = speaker_name_chip(state, model, now);
239
242
div()
@@ -274,17 +277,30 @@ impl Render for MiniWindowView {
274
277
}))
275
278
.children(self_view(state, model, now)),
276
279
)
277
.child(controls_row(
278
&self.app,
279
model,
280
ControlIds {
281
mute: "call-mini-window-mute",
282
back: "call-mini-window-back",
283
leave: "call-mini-window-leave",
284
},
285
"call-mini-window",
286
move |cx| windows.update(cx, |windows, cx| windows.return_to_call(cx)),
287
))
280
.child(
281
controls_row(
282
&self.app,
283
model,
284
ControlIds {
285
mute: "call-mini-window-mute",
286
back: "call-mini-window-back",
287
leave: "call-mini-window-leave",
288
},
289
"call-mini-window",
290
move |cx| windows.update(cx, |windows, cx| windows.return_to_call(cx)),
291
)
292
.when(sharing, |row| {
293
row.child(
294
view_switch_button(
295
&self.windows,
296
"call-mini-window-more-people",
297
IconName::Users,
298
SHOW_MORE_PEOPLE,
299
)
300
.size(px(CONTROL_SIZE)),
301
)
302
}),
303
)
288
304
.into_any_element()
289
305
}
290
306
}
@@ -3,9 +3,11 @@ use std::time::Instant;3
use calling::VideoKey;3
use calling::VideoKey;4
use gpui_kit::assets::IconName;4
use gpui_kit::assets::IconName;5
use gpui_kit::component::{h_flex, tooltip::Tooltip, v_flex};5
use gpui_kit::component::{h_flex, tooltip::Tooltip, v_flex};6
use gpui_kit::prelude::FluentBuilder as _;6
use gpui_kit::*;7
use gpui_kit::*;7
8
8
use super::avatar::person_avatar;9
use super::avatar::person_avatar;10
use super::call_share_gallery::{SHOW_MORE_PEOPLE, view_switch_button};9
use super::call_view::{camera_button, leave_button, mute_button, round_control, status_line};11
use super::call_view::{camera_button, leave_button, mute_button, round_control, status_line};10
use super::widgets::icon;12
use super::widgets::icon;11
use crate::app_state::AppState;13
use crate::app_state::AppState;@@ -234,6 +236,7 @@ impl Render for MiniWindowView {234
let now = Instant::now();236
let now = Instant::now();235
let (status, _) = status_line(model, now);237
let (status, _) = status_line(model, now);236
let windows = self.windows.clone();238
let windows = self.windows.clone();239
let sharing = self.windows.read(cx).sharing();237
let speaking = speaker_speaking(model);240
let speaking = speaker_speaking(model);238
let speaker_name = speaker_name_chip(state, model, now);241
let speaker_name = speaker_name_chip(state, model, now);239
div()242
div()@@ -274,17 +277,30 @@ impl Render for MiniWindowView {274
}))277
}))275
.children(self_view(state, model, now)),278
.children(self_view(state, model, now)),276
)279
)277
.child(controls_row(280
.child(278
&self.app,281
controls_row(279
model,282
&self.app,280
ControlIds {283
model,281
mute: "call-mini-window-mute",284
ControlIds {282
back: "call-mini-window-back",285
mute: "call-mini-window-mute",283
leave: "call-mini-window-leave",286
back: "call-mini-window-back",284
},287
leave: "call-mini-window-leave",285
"call-mini-window",288
},286
move |cx| windows.update(cx, |windows, cx| windows.return_to_call(cx)),289
"call-mini-window",287
))290
move |cx| windows.update(cx, |windows, cx| windows.return_to_call(cx)),291
)292
.when(sharing, |row| {293
row.child(294
view_switch_button(295
&self.windows,296
"call-mini-window-more-people",297
IconName::Users,298
SHOW_MORE_PEOPLE,299
)300
.size(px(CONTROL_SIZE)),301
)302
}),303
)288
.into_any_element()304
.into_any_element()289
}305
}290
}306
}@@ -963,6 +963,17 @@ pub(super) fn person_tile(
963
963
remote: &Tile,
964
964
size: TileSize,
965
965
now: Instant,
966
) -> AnyElement {
967
let element = plain_person_tile(state, model, remote, size, now);
968
with_tile_menu(app, model, &remote.mri, &remote.name, false, element)
969
}
970
971
pub(super) fn plain_person_tile(
972
state: &AppState,
973
model: &CallModel,
974
remote: &Tile,
975
size: TileSize,
976
now: Instant,
966
977
) -> AnyElement {
967
978
let extras = TileExtras {
968
979
hand: remote.hand.map(|rank| model.hand_position(rank)),
@@ -973,8 +984,7 @@ pub(super) fn person_tile(
973
984
spotlight: remote.spotlight.is_some(),
974
985
pinned: model.is_pinned(&remote.mri),
975
986
};
976
let element = person_tile_body(state, model, remote, size, now, &extras);
977
with_tile_menu(app, model, &remote.mri, &remote.name, false, element)
987
person_tile_body(state, model, remote, size, now, &extras)
978
988
}
979
989
980
990
fn person_tile_body(
@@ -1042,18 +1052,28 @@ pub(super) fn own_tile(
1042
1052
now: Instant,
1043
1053
) -> AnyElement {
1044
1054
let own_mri = model.own_mri.clone().unwrap_or_default();
1055
let element = plain_own_tile(state, model, size, now);
1056
if own_mri.is_empty() {
1057
return element;
1058
}
1059
with_tile_menu(app, model, &own_mri, "You", true, element)
1060
}
1061
1062
pub(super) fn plain_own_tile(
1063
state: &AppState,
1064
model: &CallModel,
1065
size: TileSize,
1066
now: Instant,
1067
) -> AnyElement {
1068
let own_mri = model.own_mri.as_deref().unwrap_or_default();
1045
1069
let extras = TileExtras {
1046
1070
hand: model.own_hand.map(|rank| model.hand_position(rank)),
1047
1071
own: true,
1048
1072
reaction: model.own_chip(now).map(|chip| (chip.reaction, chip.serial)),
1049
1073
spotlight: model.own_spotlight.is_some(),
1050
pinned: model.is_pinned(&own_mri),
1074
pinned: model.is_pinned(own_mri),
1051
1075
};
1052
let element = own_tile_body(state, model, size, now, &extras);
1053
if own_mri.is_empty() {
1054
return element;
1055
}
1056
with_tile_menu(app, model, &own_mri, "You", true, element)
1076
own_tile_body(state, model, size, now, &extras)
1057
1077
}
1058
1078
1059
1079
fn own_tile_body(
@@ -963,6 +963,17 @@ pub(super) fn person_tile(963
remote: &Tile,963
remote: &Tile,964
size: TileSize,964
size: TileSize,965
now: Instant,965
now: Instant,966
) -> AnyElement {967
let element = plain_person_tile(state, model, remote, size, now);968
with_tile_menu(app, model, &remote.mri, &remote.name, false, element)969
}970
971
pub(super) fn plain_person_tile(972
state: &AppState,973
model: &CallModel,974
remote: &Tile,975
size: TileSize,976
now: Instant,966
) -> AnyElement {977
) -> AnyElement {967
let extras = TileExtras {978
let extras = TileExtras {968
hand: remote.hand.map(|rank| model.hand_position(rank)),979
hand: remote.hand.map(|rank| model.hand_position(rank)),@@ -973,8 +984,7 @@ pub(super) fn person_tile(973
spotlight: remote.spotlight.is_some(),984
spotlight: remote.spotlight.is_some(),974
pinned: model.is_pinned(&remote.mri),985
pinned: model.is_pinned(&remote.mri),975
};986
};976
let element = person_tile_body(state, model, remote, size, now, &extras);987
person_tile_body(state, model, remote, size, now, &extras)977
with_tile_menu(app, model, &remote.mri, &remote.name, false, element)978
}988
}979
989
980
fn person_tile_body(990
fn person_tile_body(@@ -1042,18 +1052,28 @@ pub(super) fn own_tile(1042
now: Instant,1052
now: Instant,1043
) -> AnyElement {1053
) -> AnyElement {1044
let own_mri = model.own_mri.clone().unwrap_or_default();1054
let own_mri = model.own_mri.clone().unwrap_or_default();1055
let element = plain_own_tile(state, model, size, now);1056
if own_mri.is_empty() {1057
return element;1058
}1059
with_tile_menu(app, model, &own_mri, "You", true, element)1060
}1061
1062
pub(super) fn plain_own_tile(1063
state: &AppState,1064
model: &CallModel,1065
size: TileSize,1066
now: Instant,1067
) -> AnyElement {1068
let own_mri = model.own_mri.as_deref().unwrap_or_default();1045
let extras = TileExtras {1069
let extras = TileExtras {1046
hand: model.own_hand.map(|rank| model.hand_position(rank)),1070
hand: model.own_hand.map(|rank| model.hand_position(rank)),1047
own: true,1071
own: true,1048
reaction: model.own_chip(now).map(|chip| (chip.reaction, chip.serial)),1072
reaction: model.own_chip(now).map(|chip| (chip.reaction, chip.serial)),1049
spotlight: model.own_spotlight.is_some(),1073
spotlight: model.own_spotlight.is_some(),1050
pinned: model.is_pinned(&own_mri),1074
pinned: model.is_pinned(own_mri),1051
};1075
};1052
let element = own_tile_body(state, model, size, now, &extras);1076
own_tile_body(state, model, size, now, &extras)1053
if own_mri.is_empty() {1054
return element;1055
}1056
with_tile_menu(app, model, &own_mri, "You", true, element)1057
}1077
}1058
1078
1059
fn own_tile_body(1079
fn own_tile_body(@@ -18,6 +18,7 @@ pub mod call_mini_window;
18
18
pub mod call_organizer;
19
19
pub mod call_people;
20
20
pub mod call_pop_out;
21
pub mod call_share_gallery;
21
22
pub mod call_record;
22
23
pub mod call_stage;
23
24
pub mod call_transcript;
@@ -18,6 +18,7 @@ pub mod call_mini_window;18
pub mod call_organizer;18
pub mod call_organizer;19
pub mod call_people;19
pub mod call_people;20
pub mod call_pop_out;20
pub mod call_pop_out;21
pub mod call_share_gallery;21
pub mod call_record;22
pub mod call_record;22
pub mod call_stage;23
pub mod call_stage;23
pub mod call_transcript;24
pub mod call_transcript;