Open new windows with a default size and position (#9204)

This PR changes GPUI to open windows with a default size and location,
and to otherwise inherit from their spawning window.

Note: The linux build now crashes on startup.

Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Ezekiel Warren <zaucy@users.noreply.github.com>
This commit is contained in:
Mikayla Maki 2024-03-12 21:19:51 -07:00 committed by GitHub
parent 9a2dceeea1
commit e792c1a5c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 443 additions and 347 deletions

View file

@ -6,7 +6,6 @@ use gpui::{
actions, canvas, div, point, px, Action, AnyElement, AppContext, Element, Hsla,
InteractiveElement, IntoElement, Model, ParentElement, Path, Render,
StatefulInteractiveElement, Styled, Subscription, View, ViewContext, VisualContext, WeakView,
WindowBounds,
};
use project::{Project, RepositoryEntry};
use recent_projects::RecentProjects;
@ -65,7 +64,7 @@ impl Render for CollabTitlebarItem {
.w_full()
.h(titlebar_height(cx))
.map(|this| {
if matches!(cx.window_bounds(), WindowBounds::Fullscreen) {
if cx.is_full_screen() {
this.pl_2()
} else {
// Use pixels here instead of a rem-based size because the macOS traffic

View file

@ -13,8 +13,8 @@ use call::{report_call_event_for_room, ActiveCall};
pub use collab_panel::CollabPanel;
pub use collab_titlebar_item::CollabTitlebarItem;
use gpui::{
actions, point, AppContext, GlobalPixels, Pixels, PlatformDisplay, Size, Task, WindowBounds,
WindowContext, WindowKind, WindowOptions,
actions, point, AppContext, GlobalPixels, Pixels, PlatformDisplay, Size, Task, WindowContext,
WindowKind, WindowOptions,
};
use panel_settings::MessageEditorSettings;
pub use panel_settings::{
@ -111,14 +111,15 @@ fn notification_window_options(
),
size: window_size.into(),
};
WindowOptions {
bounds: WindowBounds::Fixed(bounds),
bounds: Some(bounds),
titlebar: None,
center: false,
focus: false,
show: true,
kind: WindowKind::PopUp,
is_movable: false,
display_id: Some(screen.id()),
fullscreen: false,
}
}