diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index ba5011ef160af20b97d9c118d662fb80b0449153..382ae6f7a77a0a0ae42c747afcdcd56b7fc27426 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -268,6 +268,10 @@ unsafe fn build_window_class(name: &'static str, superclass: &Class) -> *const C sel!(windowWillEnterFullScreen:), window_will_enter_fullscreen as extern "C" fn(&Object, Sel, id), ); + decl.add_method( + sel!(windowWillExitFullScreen:), + window_will_exit_fullscreen as extern "C" fn(&Object, Sel, id), + ); decl.add_method( sel!(windowDidMove:), window_did_move as extern "C" fn(&Object, Sel, id), @@ -334,6 +338,7 @@ struct MacWindowState { last_key_equivalent: Option, synthetic_drag_counter: usize, traffic_light_position: Option>, + transparent_titlebar: bool, previous_modifiers_changed_event: Option, keystroke_for_do_command: Option, do_command_handled: Option, @@ -613,6 +618,9 @@ impl MacWindow { traffic_light_position: titlebar .as_ref() .and_then(|titlebar| titlebar.traffic_light_position), + transparent_titlebar: titlebar + .as_ref() + .map_or(true, |titlebar| titlebar.appears_transparent), previous_modifiers_changed_event: None, keystroke_for_do_command: None, do_command_handled: None, @@ -1490,6 +1498,19 @@ extern "C" fn window_will_enter_fullscreen(this: &Object, _: Sel, _: id) { let window_state = unsafe { get_window_state(this) }; let mut lock = window_state.as_ref().lock(); lock.fullscreen_restore_bounds = lock.bounds(); + unsafe { + lock.native_window.setTitlebarAppearsTransparent_(NO); + } +} + +extern "C" fn window_will_exit_fullscreen(this: &Object, _: Sel, _: id) { + let window_state = unsafe { get_window_state(this) }; + let mut lock = window_state.as_ref().lock(); + if lock.transparent_titlebar { + unsafe { + lock.native_window.setTitlebarAppearsTransparent_(YES); + } + } } extern "C" fn window_did_move(this: &Object, _: Sel, _: id) {