diff --git a/komorebi-for-mac/komorebi/src/settle.rs b/komorebi-for-mac/komorebi/src/settle.rs index 8c9fd60a..75492363 100644 --- a/komorebi-for-mac/komorebi/src/settle.rs +++ b/komorebi-for-mac/komorebi/src/settle.rs @@ -8,7 +8,6 @@ //! and any that are not where they are to be are sent there again, and looked at once more after //! that. -use crate::accessibility::AccessibilityApi; use crate::animation::animator; use crate::core::Rect; use crate::window::Snapping; @@ -184,9 +183,9 @@ impl WindowManager { return Ok(0); } - let _ = AccessibilityApi::set_messaging_timeout(&window.element, LOOK_TIMEOUT); + let _ = window.set_messaging_timeout(LOOK_TIMEOUT); let rect = window.frame().map(Rect::from); - let _ = AccessibilityApi::set_messaging_timeout(&window.element, 0.0); + let _ = window.set_messaging_timeout(0.0); if let Ok(rect) = rect && is_off(&rect, &layout) diff --git a/komorebi-for-mac/komorebi/src/window.rs b/komorebi-for-mac/komorebi/src/window.rs index 1b9b441b..51aabbad 100644 --- a/komorebi-for-mac/komorebi/src/window.rs +++ b/komorebi-for-mac/komorebi/src/window.rs @@ -574,6 +574,12 @@ impl Window { MacosApi::window_rect(&self.element) } + /// How long an Accessibility call to this window's app may block, in seconds (0 restores the + /// system default). Not an operation of the shared `Backend`; it bounds the frame query. + pub fn set_messaging_timeout(&self, seconds: f32) -> Result<(), AccessibilityError> { + AccessibilityApi::set_messaging_timeout(&self.element, seconds) + } + pub fn alive(&self) -> bool { AccessibilityApi::copy_attribute_names(&self.element).is_some() } @@ -959,7 +965,7 @@ impl Window { } // the window manager is waiting for this, and so is every window after this one - let _ = AccessibilityApi::set_messaging_timeout(&self.element, ARRIVAL_TIMEOUT); + let _ = self.set_messaging_timeout(ARRIVAL_TIMEOUT); match self.frame() { Ok(actual) => arrival::report(self.id, *target, Rect::from(actual)),