Open chris-morgan opened 5 years ago
This could be the answer: https://github.com/c-smile/sciter-sdk/blob/master/demos/usciter/win-res/dpi-aware.manifest
Yeah, that’d do it. My understanding from a couple of projects in the past that have spent quite a bit of effort on optimal high-DPI support is that for best compatibility DLL calls are preferred to manifests—to say nothing of manifests not fitting particularly well into Rust’s compilation model at present.
Sounds reasonable. Are you talking about SetThreadDpiAwarenessContext
& K°?
Though it'd be better to have such a function in the Sciter API rather than in each binding. But we can do it here as well.
I don’t recall which precise DLL calls were involved, but that looks about right (though I’ve never seen it done at the thread level, only the process level). I recall compatibility across multiple versions of Windows (e.g. trying DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 first, then DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE, then DPI_AWARENESS_CONTEXT_SYSTEM_AWARE, or something) being a little fiddly.
winit is the primary experience I’ve had of being involved with high-quality and high-compatibility DPI awareness: it started in https://github.com/tomaka/winit/pull/332 for Windows, and ended up landing in https://github.com/tomaka/winit/pull/548.
The current code for it on Windows is in src/platform/windows/dpi.rs: I expect that to be a very useful resource. (See also the shared file src/dpi.rs.)
Yes, there is a group of them:
SetThreadDpiAwarenessContext is for Windows 10 1607 or higher SetProcessDpiAwarenessContext is for 1703 at least SetThreadDpiHostingBehavior is for 1803
Anyway, thanks for pointing this out. I'll try to come up with something. Ideally, this should be enabled by default with an option to opt out.
And thanks for the links, they are very thorough.
I don’t know exactly where the fault may be, but when I run the examples they’re all low DPI on my 200% scaling factor Windows device. I know that Sciter itself must be capable of running high-DPI, because I tried out the HTML Notepad app and it’s scaled properly.