RustAudio / baseview

low-level window system interface for audio plugin UIs
Apache License 2.0
266 stars 57 forks source link

Add UI scaling support #48

Closed BillyDM closed 3 years ago

BillyDM commented 3 years ago

Oh yeah, I should fix the ubuntu and mac builds

BillyDM commented 3 years ago

Although I notice the size hints only work in the baseview example. The window doesn't resize as a plugin in Bitwig.

BillyDM commented 3 years ago

I don't have a Mac to test it on, and for some reason the data I put into WindowState<H> on Windows is getting corrupted. Do you have any clues?

Please let me know how you feel about this PR. Do you think baseview should handle the logic of logical and physical sizes and coordinates, or should the user be the one to handle it? If not, I can change it.

wrl commented 3 years ago

macOS is going to be really interesting. We may in the future have to redo the scaling policies, but, hey, we'll cross that bridge when we come to it.

BillyDM commented 3 years ago

I'm just trying to get it to build for now.

wrl commented 3 years ago

Yeah absolutely. The thing on Mac is that all of the sizes and coordinates are already in logical units at the window system level, and the physical pixels come into play at a different layer. We'll just have to address the sizing policy slightly differently.

wrl commented 3 years ago

Some notes from Discord:

so, i'm going to merge this, but i have some reservations about the amount of combinations that are possible here and i would like you to follow up on this PR by writing some documentation about what each of the scaling policies do at window open when combined with both logical and physical sizes because to be frank i'm struggling to figure out all of the possible outputs and relatedly i'm struggling to figure out how i would want to construct window open options like if i pass in the physical size of the window, does that imply WindowScalePolicy::NoScaling? should that turn off backing-store scaling on mac?

Going to merge, but want to get this sorted out ASAP. There's no real sense in having a comprehensive API if people

  1. Aren't going to use much of the scope of it
  2. Struggle to accomplish the simple/common case with it.