Fix window restoration bugs (#9358)

- [x] fixes https://github.com/zed-industries/zed/issues/9349
- [x] fixes https://github.com/zed-industries/zed/issues/4656
- [x] fixes https://github.com/zed-industries/zed/issues/8345

Release Notes:

- TODO
This commit is contained in:
Mikayla Maki 2024-03-14 14:25:12 -07:00 committed by GitHub
parent 14cdafb0a8
commit 35c9216ed7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 106 additions and 56 deletions

View file

@ -191,8 +191,8 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
fn show_character_palette(&self);
fn minimize(&self);
fn zoom(&self);
fn toggle_full_screen(&self);
fn is_full_screen(&self) -> bool;
fn toggle_fullscreen(&self);
fn is_fullscreen(&self) -> bool;
fn on_request_frame(&self, callback: Box<dyn FnMut()>);
fn on_input(&self, callback: Box<dyn FnMut(PlatformInput) -> bool>);
fn on_active_status_change(&self, callback: Box<dyn FnMut(bool)>);
@ -596,7 +596,7 @@ pub enum WindowKind {
/// Platform level interface
/// bounds: Bounds<GlobalPixels>
/// full_screen: bool
/// fullscreen: bool
/// The appearance of the window, as defined by the operating system.
///

View file

@ -362,7 +362,7 @@ impl PlatformWindow for WaylandWindow {
// todo(linux)
}
fn toggle_full_screen(&self) {
fn toggle_fullscreen(&self) {
if !self.0.inner.borrow().fullscreen {
self.0.toplevel.set_fullscreen(None);
} else {
@ -370,7 +370,7 @@ impl PlatformWindow for WaylandWindow {
}
}
fn is_full_screen(&self) -> bool {
fn is_fullscreen(&self) -> bool {
self.0.inner.borrow_mut().fullscreen
}

View file

@ -438,12 +438,12 @@ impl PlatformWindow for X11Window {
}
// todo(linux)
fn toggle_full_screen(&self) {
fn toggle_fullscreen(&self) {
unimplemented!()
}
// todo(linux)
fn is_full_screen(&self) -> bool {
fn is_fullscreen(&self) -> bool {
false
}

View file

@ -252,7 +252,7 @@ impl platform::Window for StatusItem {
}
}
fn toggle_full_screen(&self) {
fn toggle_fullscreen(&self) {
unimplemented!()
}

View file

@ -941,7 +941,7 @@ impl PlatformWindow for MacWindow {
.detach();
}
fn toggle_full_screen(&self) {
fn toggle_fullscreen(&self) {
let this = self.0.lock();
let window = this.native_window;
this.executor
@ -953,7 +953,7 @@ impl PlatformWindow for MacWindow {
.detach();
}
fn is_full_screen(&self) -> bool {
fn is_fullscreen(&self) -> bool {
let this = self.0.lock();
let window = this.native_window;

View file

@ -197,12 +197,12 @@ impl PlatformWindow for TestWindow {
unimplemented!()
}
fn toggle_full_screen(&self) {
fn toggle_fullscreen(&self) {
let mut lock = self.0.lock();
lock.is_fullscreen = !lock.is_fullscreen;
}
fn is_full_screen(&self) -> bool {
fn is_fullscreen(&self) -> bool {
self.0.lock().is_fullscreen
}

View file

@ -909,10 +909,10 @@ impl PlatformWindow for WindowsWindow {
fn zoom(&self) {}
// todo(windows)
fn toggle_full_screen(&self) {}
fn toggle_fullscreen(&self) {}
// todo(windows)
fn is_full_screen(&self) -> bool {
fn is_fullscreen(&self) -> bool {
false
}

View file

@ -338,9 +338,6 @@ fn default_bounds(cx: &mut AppContext) -> Bounds<GlobalPixels> {
})
}
// Fixed, Maximized, Fullscreen, and 'Inherent / default'
// Platform part, you don't, you only need Fixed, Maximized, Fullscreen
impl Window {
pub(crate) fn new(
handle: AnyWindowHandle,
@ -386,7 +383,7 @@ impl Window {
let last_input_timestamp = Rc::new(Cell::new(Instant::now()));
if fullscreen {
platform_window.toggle_full_screen();
platform_window.toggle_fullscreen();
}
platform_window.on_close(Box::new({
@ -807,8 +804,8 @@ impl<'a> WindowContext<'a> {
}
/// Retusn whether or not the window is currently fullscreen
pub fn is_full_screen(&self) -> bool {
self.window.platform_window.is_full_screen()
pub fn is_fullscreen(&self) -> bool {
self.window.platform_window.is_fullscreen()
}
fn appearance_changed(&mut self) {
@ -1481,8 +1478,8 @@ impl<'a> WindowContext<'a> {
}
/// Toggle full screen status on the current window at the platform level.
pub fn toggle_full_screen(&self) {
self.window.platform_window.toggle_full_screen();
pub fn toggle_fullscreen(&self) {
self.window.platform_window.toggle_fullscreen();
}
/// Present a platform dialog.