I have a Juce application which hosts a native window, and if I modify the global scale factor from the operating system (via the Displays section in Windows' control panel, "change the size of all items"), the Juce window is scaled correctly, while the native window is not.
Does anybody have any suggestions?
Thank you :)
Sadly Windows doesn't give you much help in rescaling your UI. HWNDs were designed long before anyone thought that desktop scale factors would be a thing, and it's up to your own code to scale things appropriately.
Ah yes, that's what I thought. Infact, I just double-checked with the Plugin Host demo and I see that plugin windows simply ignore the scale factor.
The funny thing is, If I use a non-Juce application to host the native window, everything gets scaled correctly!
When you say "correctly", maybe you're not inspecting it too closely.. If you run an app that's not scale-aware, then Windows will just render it secretly to a bitmap and then rescale that image, which gets it to the right size, but is obviously very blurry!
Yes, but I don't care about the blurriness. My point is: why can any commonly used plugin host (e.g. Reaper) scale plugin windows while Juce can't? Is there any special flags or settings for the host window?
IIRC it's a global flag for the whole app, not for particular windows.
Ok, I think I found it. It's in juce_win32_Windowing.cpp, static void setDPIAwareness().
Jules, what do you think about adding a macro to bypass it?
Yeah, I guess I could add that. In the long run you should probably make your native windows draw themselves properly though.
Great! Thank you very much. I agree with you btw :)