Jankily adjust left padding on workspace title in fullscreen

ForLoveOfCats and Mikayla created

This could seriously be done better

Co-authored-by: Mikayla <mikayla@zed.dev>

Change summary

crates/gpui/src/platform/mac/window.rs | 12 ++++++------
crates/workspace/src/workspace.rs      | 13 ++++++++++++-
2 files changed, 18 insertions(+), 7 deletions(-)

Detailed changes

crates/gpui/src/platform/mac/window.rs 🔗

@@ -129,12 +129,12 @@ unsafe fn build_classes() {
             window_did_resize as extern "C" fn(&Object, Sel, id),
         );
         decl.add_method(
-            sel!(windowDidEnterFullScreen:),
-            window_did_enter_fullscreen as extern "C" fn(&Object, Sel, id),
+            sel!(windowWillEnterFullScreen:),
+            window_will_enter_fullscreen as extern "C" fn(&Object, Sel, id),
         );
         decl.add_method(
-            sel!(windowDidExitFullScreen:),
-            window_did_exit_fullscreen as extern "C" fn(&Object, Sel, id),
+            sel!(windowWillExitFullScreen:),
+            window_will_exit_fullscreen as extern "C" fn(&Object, Sel, id),
         );
         decl.add_method(
             sel!(windowDidBecomeKey:),
@@ -922,11 +922,11 @@ extern "C" fn window_did_resize(this: &Object, _: Sel, _: id) {
     window_state.as_ref().borrow().move_traffic_light();
 }
 
-extern "C" fn window_did_enter_fullscreen(this: &Object, _: Sel, _: id) {
+extern "C" fn window_will_enter_fullscreen(this: &Object, _: Sel, _: id) {
     window_fullscreen_changed(this, true);
 }
 
-extern "C" fn window_did_exit_fullscreen(this: &Object, _: Sel, _: id) {
+extern "C" fn window_will_exit_fullscreen(this: &Object, _: Sel, _: id) {
     window_fullscreen_changed(this, false);
 }
 

crates/workspace/src/workspace.rs 🔗

@@ -1858,6 +1858,17 @@ impl Workspace {
             worktree_root_names.push_str(name);
         }
 
+        // TODO: There should be a better system in place for this
+        // (https://github.com/zed-industries/zed/issues/1290)
+        let is_fullscreen = cx.window_is_fullscreen(cx.window_id());
+        let container_theme = if is_fullscreen {
+            let mut container_theme = theme.workspace.titlebar.container;
+            container_theme.padding.left = container_theme.padding.right;
+            container_theme
+        } else {
+            theme.workspace.titlebar.container
+        };
+
         ConstrainedBox::new(
             Container::new(
                 Stack::new()
@@ -1885,7 +1896,7 @@ impl Workspace {
                     )
                     .boxed(),
             )
-            .with_style(theme.workspace.titlebar.container)
+            .with_style(container_theme)
             .boxed(),
         )
         .with_height(theme.workspace.titlebar.height)