Show button as selected if screen sharing is on

This commit is contained in:
Antonio Scandurra 2023-12-20 14:17:15 +01:00
parent 57f3a882fe
commit 6e1ba645f3

View file

@ -176,6 +176,7 @@ impl Render for CollabTitlebarItem {
let is_shared = self.project.read(cx).is_shared(); let is_shared = self.project.read(cx).is_shared();
let is_muted = room.is_muted(cx); let is_muted = room.is_muted(cx);
let is_deafened = room.is_deafened().unwrap_or(false); let is_deafened = room.is_deafened().unwrap_or(false);
let is_screen_sharing = room.is_screen_sharing();
this.child( this.child(
Button::new( Button::new(
@ -225,7 +226,7 @@ impl Render for CollabTitlebarItem {
}, },
) )
.style(ButtonStyle::Subtle) .style(ButtonStyle::Subtle)
.selected(is_deafened.clone()) .selected(is_deafened)
.tooltip(move |cx| { .tooltip(move |cx| {
Tooltip::with_meta("Deafen Audio", None, "Mic will be muted", cx) Tooltip::with_meta("Deafen Audio", None, "Mic will be muted", cx)
}) })
@ -234,6 +235,7 @@ impl Render for CollabTitlebarItem {
.child( .child(
IconButton::new("screen-share", ui::Icon::Screen) IconButton::new("screen-share", ui::Icon::Screen)
.style(ButtonStyle::Subtle) .style(ButtonStyle::Subtle)
.selected(is_screen_sharing)
.on_click(move |_, cx| { .on_click(move |_, cx| {
crate::toggle_screen_sharing(&Default::default(), cx) crate::toggle_screen_sharing(&Default::default(), cx)
}), }),