Skip to content

Commit

Permalink
Fix: reliably find elements on non-primary displays.
Browse files Browse the repository at this point in the history
This addresses an issue where Scoot would sometimes be unable to find elements
on non-primary displays. (Specifically, if the app was located on a non-primary
display positioned immediately *above* or *below* the primary display, Scoot
would previously not find any elements.)
  • Loading branch information
mjrusso committed Feb 3, 2022
1 parent d852f60 commit 79f2756
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Scoot/Accessibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ struct Accessibility {
continue
}

let convertedFrame = frame.convertToCocoa()

let screen = NSScreen.screens.first(where: {
$0.frame.contains(frame)
$0.frame.contains(convertedFrame)
})

let role: Role? = try? child.role()
Expand All @@ -156,7 +158,7 @@ struct Accessibility {
valueDescription: try? child.attribute(.valueDescription),
enabled: (try? child.attribute(.enabled)) ?? false,
screen: screen,
frame: frame.convertToCocoa()
frame: convertedFrame
)
elements.append(element)
}
Expand Down

0 comments on commit 79f2756

Please sign in to comment.