servo / core-foundation-rs

Rust bindings to Core Foundation and other low level libraries on Mac OS X and iOS
Other
987 stars 216 forks source link

feat(CGDisplay): add displays_with_point and displays_with_rect #657

Closed mattjbray closed 4 weeks ago

mattjbray commented 6 months ago

Add CGDisplay::displays_with_point and CGDisplay::displays_with_rect.

Uses the pattern from CGDisplay::active_displays to first get the count of matching displays, then intialize the result Vec with vec![0; count as usize].

jrmuizel commented 5 months ago

Can you add some tests?

mattjbray commented 5 months ago

Can you add some tests?

Added some simple tests. I'm not sure how to test anything more specific without mocking the displays somehow - any pointers on how to do that would be appreciated.

mattjbray commented 5 months ago

I've also added #[inline] attributes to match all the other fns in this module.