mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-14 04:43:42 +01:00
refactor(mac): set a window's AX messaging timeout through Window
Adds Window::set_messaging_timeout and uses it in settle.rs (the look at a window after a drag, 3 raw AX sites) and in Window::note_arrival. Same call on the same element; nothing changes at runtime. It is not one of the shared Backend operations, but it bounds the frame query, so the raw AX call leaves settle.rs with the frame read. The window manager's timeouts list and the animator keep calling AccessibilityApi: they hold elements (app elements, lane handles), not Windows. Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified: cannot run or unit-test on Linux.
This commit is contained in:
1 parent
49a6dbdabb
commit
803a141088
2 files changed
+9
-4
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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)),
|
||||
|
||||
Reference in new issue
Block a user