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

@ -10,7 +10,7 @@ use collections::VecDeque;
use editor::{scroll::Autoscroll, Editor, MultiBuffer};
use gpui::{
actions, point, px, AppContext, AsyncAppContext, Context, FocusableView, PromptLevel,
TitlebarOptions, View, ViewContext, VisualContext, WindowBounds, WindowKind, WindowOptions,
TitlebarOptions, View, ViewContext, VisualContext, WindowKind, WindowOptions,
};
pub use only_instance::*;
pub use open_listener::*;
@ -79,12 +79,7 @@ pub fn init(cx: &mut AppContext) {
cx.on_action(quit);
}
pub fn build_window_options(
bounds: Option<WindowBounds>,
display_uuid: Option<Uuid>,
cx: &mut AppContext,
) -> WindowOptions {
let bounds = bounds.unwrap_or(WindowBounds::Maximized);
pub fn build_window_options(display_uuid: Option<Uuid>, cx: &mut AppContext) -> WindowOptions {
let display = display_uuid.and_then(|uuid| {
cx.displays()
.into_iter()
@ -92,18 +87,18 @@ pub fn build_window_options(
});
WindowOptions {
bounds,
titlebar: Some(TitlebarOptions {
title: None,
appears_transparent: true,
traffic_light_position: Some(point(px(9.5), px(9.5))),
}),
center: false,
bounds: None,
focus: false,
show: false,
kind: WindowKind::Normal,
is_movable: true,
display_id: display.map(|display| display.id()),
fullscreen: false,
}
}