Open rien333 opened 5 years ago
DPI scaling is manually disabled on Mono (in Mesen) by default because otherwise Mono ends up resizing windows even at regular DPI settings, which makes the windows look less good than they do otherwise.
https://github.com/SourMesen/Mesen/blob/master/GUI.NET/Forms/BaseForm.cs#L181 https://github.com/SourMesen/Mesen/blob/master/GUI.NET/Controls/BaseControl.cs#L53
Removing the AutoScaleDimensions & AutoScaleMode overrides here should enable DPI scaling for Mono, but it's very likely that some stuff will break since it's never been tested (and Mono's layout logic differs from .NET's WinForms in a lot of scenarios)
Right, I'll have a look. Thanks!
Removing the AutoScaleDimensions & AutoScaleMode overrides here should enable DPI scaling for Mono
Couldn't get this to work, but I am not familiar with .NET development. Are you sure this is the only thing that there is to it?
Maybe I am not removing the overrides in the correct way. I tried both removing the functions you mentioned, and I've also tried reducing them to
set
{
base.AutoScaleDimensions = value;
}
However, both alterations achieve no noticeable effects.
Removing the functions completely should have worked, I don't recall there being anything else that disabled scaling under Mono in Mesen's code.
I did some testing on Kubuntu 18, removing the overrides does alter the result (slightly, some things get bigger), but in general, the UI is somewhat broken. As far as I can tell, there's nothing else in Mesen's code that tries to alter the scaling behavior on Mono, so it looks like Mono itself doesn't scale the controls properly. I seem to be getting a different behavior than what you get, though, as the size of the text and forms does properly scale on my end, it's mostly just the contents of the forms that don't resize/position themselves properly.
It looks like Mono also ignores the value of the app.manifest file setting that tells the OS whether or not the application is DPI-aware. Applications that aren't DPI-aware in Windows get scaled as a bitmap (which causes some blur, but at least makes the window usable on high resolution screens), in Mono, the setting appears to have no effect, so it's likely not implemented.
I probably won't have the time to try and fix this anytime soon, unfortunately.
Whenever I run Mesen (0.9.7, build from git with mono 5.23.0 on Arch Linux) all the text UI elements (menubar font, all the text in preferences and tools) is way too small, most likely due to my HiDPI screen. The arch wiki states that HiDPI scaling with mono applications should work similar to GTK3 applications, but unfortunately that solution does not work for Mesen (GTK3 apps scale fine).
I know UI text scaling for HiDPI screens was already addressed in https://github.com/SourMesen/Mesen/issues/246, but the fix seems to be Windows only. Is there anyway to get the text to scale-up? Maybe somebody could add support for the GTK3 scaling variables?