mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-14 04:43:42 +01:00
refactor(mac): name the Window liveness check alive, as the shared Backend does
Renames Window::is_valid to Window::alive (window.rs, reaper.rs, workspace.rs, macos_backend.rs). Same body (the element still answers a copy-attribute-names query), so nothing changes at runtime. Application::is_valid is a different type and keeps its name. This is the 'alive' operation of the step 6 list. 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
796c3832b7
commit
7c2e1bea8a
4 files changed
+9
-9
No files matched your search
@@ -118,7 +118,7 @@ impl MacosBackend {
|
||||
window: &Window,
|
||||
error: impl std::error::Error + Send + Sync + 'static,
|
||||
) -> Error {
|
||||
if window.is_valid() {
|
||||
if window.alive() {
|
||||
platform(error)
|
||||
} else {
|
||||
Error::WindowGone(id)
|
||||
@@ -126,7 +126,7 @@ impl MacosBackend {
|
||||
}
|
||||
|
||||
fn info(window: &Window) -> Option<WindowInfo> {
|
||||
if !window.is_valid() {
|
||||
if !window.alive() {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ fn handle_notifications(wm: Arc<Mutex<WindowManager>>) -> color_eyre::Result<()>
|
||||
continue 'notification;
|
||||
}
|
||||
|
||||
handle_notification(&mut wm, notification, Window::is_valid)?;
|
||||
handle_notification(&mut wm, notification, Window::alive)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -465,7 +465,7 @@ impl Drop for Window {
|
||||
fn drop(&mut self) {
|
||||
// this gets called when a cloned Window is dropped, so we need to make sure it only
|
||||
// invalidates the observer if the Window is no longer open
|
||||
if !self.is_valid() {
|
||||
if !self.alive() {
|
||||
tracing::info!(
|
||||
"invalidating window observer for {}",
|
||||
self.title()
|
||||
@@ -574,7 +574,7 @@ impl Window {
|
||||
MacosApi::window_rect(&self.element)
|
||||
}
|
||||
|
||||
pub fn is_valid(&self) -> bool {
|
||||
pub fn alive(&self) -> bool {
|
||||
AccessibilityApi::copy_attribute_names(&self.element).is_some()
|
||||
}
|
||||
|
||||
@@ -1290,7 +1290,7 @@ impl Window {
|
||||
event: Option<WindowManagerEvent>,
|
||||
debug: &mut RuleDebug,
|
||||
) -> eyre::Result<bool> {
|
||||
if !self.is_valid() {
|
||||
if !self.alive() {
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -566,7 +566,7 @@ impl Workspace {
|
||||
|
||||
// if accessibility API calls fail on AXError::InvalidUIElement
|
||||
// let's try and nuke these early
|
||||
if !focused_window.is_valid() {
|
||||
if !focused_window.alive() {
|
||||
invalid_window_ids.push(focused_window.id);
|
||||
}
|
||||
}
|
||||
@@ -591,7 +591,7 @@ impl Workspace {
|
||||
|
||||
// if accessibility API calls fail on AXError::InvalidUIElement
|
||||
// let's try and nuke these early
|
||||
if !focused_window.is_valid() {
|
||||
if !focused_window.alive() {
|
||||
invalid_window_ids.push(focused_window.id);
|
||||
}
|
||||
}
|
||||
@@ -612,7 +612,7 @@ impl Workspace {
|
||||
|
||||
// if accessibility API calls fail on AXError::InvalidUIElement
|
||||
// let's try and nuke these early
|
||||
if !window.is_valid() {
|
||||
if !window.alive() {
|
||||
invalid_floating_window_ids.push(window.id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user