Release Notes: - N/A
Unified · Split
| @@ -303,6 +303,14 @@ unsafe fn build_window_class(name: &'static str, superclass: &Class) -> *const C · 302 unmodified lines | |||
| 303 | sel!(concludeDragOperation:), | 303 | sel!(concludeDragOperation:), |
| 304 | conclude_drag_operation as extern "C" fn(&Object, Sel, id), | 304 | conclude_drag_operation as extern "C" fn(&Object, Sel, id), |
| 305 | ); | 305 | ); |
| 306 | decl.add_method( | ||
| 307 | sel!(windowDidMiniaturize:), | ||
| 308 | window_did_miniaturize as extern "C" fn(&Object, Sel, id), | ||
| 309 | ); | ||
| 310 | decl.add_method( | ||
| 311 | sel!(windowDidDeminiaturize:), | ||
| 312 | window_did_deminiaturize as extern "C" fn(&Object, Sel, id), | ||
| 313 | ); | ||
| 306 | 314 | ||
| 307 | decl.register() | 315 | decl.register() |
| 308 | } | 316 | } |
| @@ -342,6 +350,7 @@ struct MacWindowState { · 33 unmodified lines | |||
| 342 | input_during_keydown: Option<SmallVec<[ImeInput; 1]>>, | 350 | input_during_keydown: Option<SmallVec<[ImeInput; 1]>>, |
| 343 | previous_keydown_inserted_text: Option<String>, | 351 | previous_keydown_inserted_text: Option<String>, |
| 344 | external_files_dragged: bool, | 352 | external_files_dragged: bool, |
| 353 | mimized: bool, | ||
| 345 | } | 354 | } |
| 346 | 355 | ||
| 347 | impl MacWindowState { | 356 | impl MacWindowState { |
| @@ -419,9 +428,8 @@ impl MacWindowState { · 71 unmodified lines | |||
| 419 | } | 428 | } |
| 420 | } | 429 | } |
| 421 | 430 | ||
| 422 | // todo(macos) | ||
| 423 | fn is_minimized(&self) -> bool { | 431 | fn is_minimized(&self) -> bool { |
| 424 | false | 432 | self.mimized |
| 425 | } | 433 | } |
| 426 | 434 | ||
| 427 | fn is_fullscreen(&self) -> bool { | 435 | fn is_fullscreen(&self) -> bool { |
| @@ -599,6 +607,7 @@ impl MacWindow { · 171 unmodified lines | |||
| 599 | input_during_keydown: None, | 607 | input_during_keydown: None, |
| 600 | previous_keydown_inserted_text: None, | 608 | previous_keydown_inserted_text: None, |
| 601 | external_files_dragged: false, | 609 | external_files_dragged: false, |
| 610 | mimized: false, | ||
| 602 | }))); | 611 | }))); |
| 603 | 612 | ||
| 604 | (*native_window).set_ivar( | 613 | (*native_window).set_ivar( |
| @@ -1818,6 +1827,18 @@ extern "C" fn conclude_drag_operation(this: &Object, _: Sel, _: id) { · 1213 unmodified lines | |||
| 1818 | ); | 1827 | ); |
| 1819 | } | 1828 | } |
| 1820 | 1829 | ||
| 1830 | extern "C" fn window_did_miniaturize(this: &Object, _: Sel, _: id) { | ||
| 1831 | let window_state = unsafe { get_window_state(this) }; | ||
| 1832 | |||
| 1833 | window_state.lock().mimized = true; | ||
| 1834 | } | ||
| 1835 | |||
| 1836 | extern "C" fn window_did_deminiaturize(this: &Object, _: Sel, _: id) { | ||
| 1837 | let window_state = unsafe { get_window_state(this) }; | ||
| 1838 | |||
| 1839 | window_state.lock().mimized = false; | ||
| 1840 | } | ||
| 1841 | |||
| 1821 | async fn synthetic_drag( | 1842 | async fn synthetic_drag( |
| 1822 | window_state: Weak<Mutex<MacWindowState>>, | 1843 | window_state: Weak<Mutex<MacWindowState>>, |
| 1823 | drag_id: usize, | 1844 | drag_id: usize, |