tmandry / Swindler

macOS window management library for Swift
https://tmandry.github.io/Swindler/docs/main/
MIT License
695 stars 66 forks source link

Use bottom-up coordinate system for windows #29

Closed tmandry closed 5 years ago

tmandry commented 5 years ago

Fixes #24. Closes #16.

Calculating the bottom-left coordinate from the top-left also requires the size. This required using frame as our normal "source of truth" for anything related to the position, so that property was added.

The downside of this change is that you can no longer set only the position atomically (you must set the entire frame at once). I can't imagine any use case for needing to do this, but that could be a lack of imagination on my part.

On the other hand, I can imagine a use case for atomically changing the size. Say in a tiling window manager, when a window is being moved around the screen, you want to resize it to the tile it is about to snap to, without disrupting the drag that is currently happening. This will continue to be supported.

Since Window.position is now pretty useless compared to Window.frame, it should probably be removed.

tmandry commented 5 years ago

Sigh.. this might depend on #16, because I have to calculate the bottom-left coordinate, which requires having the position and size in the same place.