Jankily adjust left padding on workspace title in fullscreen

This could seriously be done better

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
ForLoveOfCats 2022-08-09 19:03:03 -04:00
parent 43b9f3beb3
commit 3d9821b430
2 changed files with 18 additions and 7 deletions

View file

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

View file

@ -1858,6 +1858,17 @@ impl Workspace {
worktree_root_names.push_str(name); 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( ConstrainedBox::new(
Container::new( Container::new(
Stack::new() Stack::new()
@ -1885,7 +1896,7 @@ impl Workspace {
) )
.boxed(), .boxed(),
) )
.with_style(theme.workspace.titlebar.container) .with_style(container_theme)
.boxed(), .boxed(),
) )
.with_height(theme.workspace.titlebar.height) .with_height(theme.workspace.titlebar.height)