Revert "windows: better looking titlebar" and follow-up (#9392)

This reverts #9053 and #9375 because they introduced a regression on
`main` that broke the titlebars on macOS:


![image](https://github.com/zed-industries/zed/assets/1185253/d046003b-5c66-4a42-9385-623f5d58c9a4)

Two things are off:

- Left padding is missing
- Titlebar height is less than it was before, which means the
traffic-light buttons are not centered vertically

What @as-cii and I noticed while looking into this: the `cfg!(macos)`
macros that were used don't work like that. You need to check for
`cfg!(target = "macos")` etc. Means that on macOS we never used the
macOS-specific code because the condition was always false.

Overall height, we're not sure about.

Release Notes:

- N/A
This commit is contained in:
Thorsten Ball
2024-03-15 12:25:51 +01:00
committed by GitHub
parent 5ae145145e
commit 5bf0c8ed2d
15 changed files with 121 additions and 687 deletions
+7 -11
View File
@@ -1,7 +1,7 @@
use crate::{
AnyWindowHandle, AtlasKey, AtlasTextureId, AtlasTile, Bounds, DispatchEventResult,
GlobalPixels, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler,
PlatformWindow, Point, Size, TestPlatform, TileId, WindowAppearance, WindowParams,
AnyWindowHandle, AtlasKey, AtlasTextureId, AtlasTile, Bounds, GlobalPixels, Pixels,
PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, Point,
Size, TestPlatform, TileId, WindowAppearance, WindowParams,
};
use collections::HashMap;
use parking_lot::Mutex;
@@ -20,7 +20,7 @@ pub(crate) struct TestWindowState {
platform: Weak<TestPlatform>,
sprite_atlas: Arc<dyn PlatformAtlas>,
pub(crate) should_close_handler: Option<Box<dyn FnMut() -> bool>>,
input_callback: Option<Box<dyn FnMut(PlatformInput) -> DispatchEventResult>>,
input_callback: Option<Box<dyn FnMut(PlatformInput) -> bool>>,
active_status_change_callback: Option<Box<dyn FnMut(bool)>>,
resize_callback: Option<Box<dyn FnMut(Size<Pixels>, f32)>>,
moved_callback: Option<Box<dyn FnMut()>>,
@@ -102,7 +102,7 @@ impl TestWindow {
drop(lock);
let result = callback(event);
self.0.lock().input_callback = Some(callback);
!result.propagate
result
}
}
@@ -111,10 +111,6 @@ impl PlatformWindow for TestWindow {
self.0.lock().bounds
}
fn is_maximized(&self) -> bool {
unimplemented!()
}
fn content_size(&self) -> Size<Pixels> {
self.bounds().size.into()
}
@@ -124,7 +120,7 @@ impl PlatformWindow for TestWindow {
}
fn titlebar_height(&self) -> Pixels {
32.0.into()
unimplemented!()
}
fn appearance(&self) -> WindowAppearance {
@@ -212,7 +208,7 @@ impl PlatformWindow for TestWindow {
fn on_request_frame(&self, _callback: Box<dyn FnMut()>) {}
fn on_input(&self, callback: Box<dyn FnMut(crate::PlatformInput) -> DispatchEventResult>) {
fn on_input(&self, callback: Box<dyn FnMut(crate::PlatformInput) -> bool>) {
self.0.lock().input_callback = Some(callback)
}