I use CGWindowListCopyWindowInfo to get a list of all windows. It gives me the co-ordinates of each window based upon the origin being the **top-left** of the screen.

If I use NSWindow's setFrame method, the co-ordinates on based upon the origin being the **bottom-left** of the screen.

What's a clean, reliable way to convert from one to the other?

Added: By clean and reliable, I mean, something sure to work regardless whether the user has multiple screens or is using Spaces. I figure there must be a known idiom using library APIs.