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

@ -1,7 +1,7 @@
use crate::{
AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId, ForegroundExecutor,
Keymap, Platform, PlatformDisplay, PlatformTextSystem, Task, TestDisplay, TestWindow,
WindowAppearance, WindowOptions,
WindowAppearance, WindowParams,
};
use anyhow::{anyhow, Result};
use collections::VecDeque;
@ -161,6 +161,10 @@ impl Platform for TestPlatform {
vec![self.active_display.clone()]
}
fn primary_display(&self) -> Option<std::rc::Rc<dyn crate::PlatformDisplay>> {
Some(self.active_display.clone())
}
fn display(&self, id: DisplayId) -> Option<std::rc::Rc<dyn crate::PlatformDisplay>> {
self.displays().iter().find(|d| d.id() == id).cloned()
}
@ -175,11 +179,11 @@ impl Platform for TestPlatform {
fn open_window(
&self,
handle: AnyWindowHandle,
options: WindowOptions,
params: WindowParams,
) -> Box<dyn crate::PlatformWindow> {
let window = TestWindow::new(
options,
handle,
params,
self.weak.clone(),
self.active_display.clone(),
);