Allow leaving calls once project is unshared (#4081)

Release Notes:

- Fixes a bug where you could not use call controls after a project was
unshared
This commit is contained in:
Conrad Irwin 2024-01-17 08:34:45 -07:00 committed by GitHub
commit 65664452f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View file

@ -3,7 +3,7 @@ use auto_update::AutoUpdateStatus;
use call::{ActiveCall, ParticipantLocation, Room}; use call::{ActiveCall, ParticipantLocation, Room};
use client::{proto::PeerId, Client, User, UserStore}; use client::{proto::PeerId, Client, User, UserStore};
use gpui::{ use gpui::{
actions, canvas, div, point, px, rems, Action, AnyElement, AppContext, Element, Hsla, actions, canvas, div, point, px, Action, AnyElement, AppContext, Element, Hsla,
InteractiveElement, IntoElement, Model, ParentElement, Path, Render, InteractiveElement, IntoElement, Model, ParentElement, Path, Render,
StatefulInteractiveElement, Styled, Subscription, View, ViewContext, VisualContext, WeakView, StatefulInteractiveElement, Styled, Subscription, View, ViewContext, VisualContext, WeakView,
WindowBounds, WindowBounds,
@ -19,7 +19,7 @@ use ui::{
}; };
use util::ResultExt; use util::ResultExt;
use vcs_menu::{build_branch_list, BranchList, OpenRecent as ToggleVcsMenu}; use vcs_menu::{build_branch_list, BranchList, OpenRecent as ToggleVcsMenu};
use workspace::{notifications::NotifyResultExt, Workspace}; use workspace::{notifications::NotifyResultExt, titlebar_height, Workspace};
const MAX_PROJECT_NAME_LENGTH: usize = 40; const MAX_PROJECT_NAME_LENGTH: usize = 40;
const MAX_BRANCH_NAME_LENGTH: usize = 40; const MAX_BRANCH_NAME_LENGTH: usize = 40;
@ -62,10 +62,7 @@ impl Render for CollabTitlebarItem {
.id("titlebar") .id("titlebar")
.justify_between() .justify_between()
.w_full() .w_full()
.h(rems(1.75)) .h(titlebar_height(cx))
// Set a non-scaling min-height here to ensure the titlebar is
// always at least the height of the traffic lights.
.min_h(px(32.))
.map(|this| { .map(|this| {
if matches!(cx.window_bounds(), WindowBounds::Fullscreen) { if matches!(cx.window_bounds(), WindowBounds::Fullscreen) {
this.pl_2() this.pl_2()

View file

@ -25,7 +25,7 @@ use futures::{
Future, FutureExt, StreamExt, Future, FutureExt, StreamExt,
}; };
use gpui::{ use gpui::{
actions, canvas, div, impl_actions, point, size, Action, AnyElement, AnyModel, AnyView, actions, canvas, div, impl_actions, point, px, size, Action, AnyElement, AnyModel, AnyView,
AnyWeakView, AppContext, AsyncAppContext, AsyncWindowContext, BorrowWindow, Bounds, Context, AnyWeakView, AppContext, AsyncAppContext, AsyncWindowContext, BorrowWindow, Bounds, Context,
Div, DragMoveEvent, Element, Entity, EntityId, EventEmitter, FocusHandle, FocusableView, Div, DragMoveEvent, Element, Entity, EntityId, EventEmitter, FocusHandle, FocusableView,
GlobalPixels, InteractiveElement, IntoElement, KeyContext, LayoutId, ManagedView, Model, GlobalPixels, InteractiveElement, IntoElement, KeyContext, LayoutId, ManagedView, Model,
@ -4302,6 +4302,10 @@ fn parse_pixel_size_env_var(value: &str) -> Option<Size<GlobalPixels>> {
Some(size((width as f64).into(), (height as f64).into())) Some(size((width as f64).into(), (height as f64).into()))
} }
pub fn titlebar_height(cx: &mut WindowContext) -> Pixels {
(1.75 * cx.rem_size()).max(px(32.))
}
struct DisconnectedOverlay; struct DisconnectedOverlay;
impl Element for DisconnectedOverlay { impl Element for DisconnectedOverlay {
@ -4318,7 +4322,7 @@ impl Element for DisconnectedOverlay {
.bg(background) .bg(background)
.absolute() .absolute()
.left_0() .left_0()
.top_0() .top(titlebar_height(cx))
.size_full() .size_full()
.flex() .flex()
.items_center() .items_center()