Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Implement is_minimized for macOS (#9651)
Mikayla Makie07192e4e3bb
diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rsindex cc519139199..b9e03168d14 100644--- a/crates/gpui/src/platform/mac/window.rs+++ b/crates/gpui/src/platform/mac/window.rs@@ -303,6 +303,14 @@ unsafe fn build_window_class(name: &'static str, superclass: &Class) -> *const Csel!(concludeDragOperation:),conclude_drag_operation as extern "C" fn(&Object, Sel, id),);+ decl.add_method(+ sel!(windowDidMiniaturize:),+ window_did_miniaturize as extern "C" fn(&Object, Sel, id),+ );+ decl.add_method(+ sel!(windowDidDeminiaturize:),+ window_did_deminiaturize as extern "C" fn(&Object, Sel, id),+ );decl.register()}@@ -342,6 +350,7 @@ struct MacWindowState {input_during_keydown: Option<SmallVec<[ImeInput; 1]>>,previous_keydown_inserted_text: Option<String>,external_files_dragged: bool,+ mimized: bool,}impl MacWindowState {@@ -419,9 +428,8 @@ impl MacWindowState {}}- // todo(macos)fn is_minimized(&self) -> bool {- false+ self.mimized}fn is_fullscreen(&self) -> bool {@@ -599,6 +607,7 @@ impl MacWindow {input_during_keydown: None,previous_keydown_inserted_text: None,external_files_dragged: false,+ mimized: false,})));(*native_window).set_ivar(@@ -1818,6 +1827,18 @@ extern "C" fn conclude_drag_operation(this: &Object, _: Sel, _: id) {);}+extern "C" fn window_did_miniaturize(this: &Object, _: Sel, _: id) {+ let window_state = unsafe { get_window_state(this) };++ window_state.lock().mimized = true;+}++extern "C" fn window_did_deminiaturize(this: &Object, _: Sel, _: id) {+ let window_state = unsafe { get_window_state(this) };++ window_state.lock().mimized = false;+}+async fn synthetic_drag(window_state: Weak<Mutex<MacWindowState>>,drag_id: usize,