mirror of
https://github.com/lahfir/agent-desktop.git
synced 2026-08-17 20:45:50 +00:00
fix: resolve fullscreen AX tree retrieval returning ref_count: 0
- Add !t.is_empty() check to prevent false positives in partial title matching - Add fallback to select the first window with children > 0 using count_children API - Ensures reliable active window selection in macOS native fullscreen mode
This commit is contained in:
parent
594e93f4db
commit
a52b7c704a
1 changed files with 6 additions and 1 deletions
|
|
@ -31,11 +31,16 @@ pub fn window_element_for(pid: i32, win_title: &str) -> AXElement {
|
|||
let title = copy_string_attr(win, kAXTitleAttribute);
|
||||
if title
|
||||
.as_deref()
|
||||
.is_some_and(|t| t.contains(win_title) || win_title.contains(t))
|
||||
.is_some_and(|t| !t.is_empty() && (t.contains(win_title) || win_title.contains(t)))
|
||||
{
|
||||
return win.clone();
|
||||
}
|
||||
}
|
||||
for win in &windows {
|
||||
if count_children(win, None) > 0 {
|
||||
return win.clone();
|
||||
}
|
||||
}
|
||||
if let Some(first) = windows.into_iter().next() {
|
||||
return first;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue