-
Notifications
You must be signed in to change notification settings - Fork 66
[GEN][ZH] Add Windows application manifest to executables #595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[GEN][ZH] Add Windows application manifest to executables #595
Conversation
Is this more an enhancement or a fix? I have difficulties to decide. |
I'd say that this is more enhancement. It's also currently possible to disable windows scaling by using "Compatibility" section on executable, but with this change there will be no need to do that. Also, looks like windows already applies this compatibility setting for original executables, possibly using some kind of compatibility database, so the issue happens only on manually built executable which is unknown to Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just reviewed it and tested this with VS6 and VS19 and it looks good.
Some things to note regarding the DPI Aware Setting:
- We should use AdjustWindowRectExForDpi instead of AdjustWindowRect when we declare us dpi aware. But my Center Window PR [ZH] Center Window on Startup #541 touches that code as well, so I'd wait until that is merged before we fix that.
- We probably also should make the window resizeable to make different scalings on different monitors work.
But both issues shouldn't block this PR, we'll just have to fix those things eventually.
Not sure if I'm actually allowed to approve this and xezon want's this merged already though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the same file used for both binaries? It should probably be in a common location and just one copy used in addition to possibly templating it and having cmake generate the final file.
<dependency> | ||
<dependentAssembly> | ||
<assemblyIdentity | ||
type="win32" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manifest file should probably be templated for cmake to generate so we aren't hard coding 32bit unless "win32" covers both 32bit and 64bit applications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's also win32 for 64-bit. Win32 is the name of the Windows-API, even the 64-bit version.
Currently, Windows treats the Gen and ZH executables as DPI unaware and forcefully scales the content of all application windows when the display scaling factor is set to something other than 100%. This means that when running the game in windowed mode with a resolution of 800x600, the real window size on screens with scaling set to 200% will be 1600x1200, and every pixel will simply be stretched to four pixels. To prevent this system scaling, the application should indicate to the system that it is DPI aware. The best way to achieve this is to add an application manifest with the
dpiAware
setting.Another feature that can be configured via the application manifest is the application of modern visual styles. By default, applications are linked to ComCtl32.dll version 5, which contains UI elements styled like Windows 98/ME/2000. To use modern-looking elements, the application should request loading ComCtl32.dll version 6, which supports themed UI elements from Windows XP and later.
Changes
This PR adds an application manifest that addresses both issues:
Screenshots on screen with 200% display scaling
Without Manifest
Splash screen window scaled to 1600x1200 from 800x600, and the message dialog has stretched pixelated text, a Windows 98-style button, and an icon.
With Manifest
Splash screen remains unscaled at 800x600, and the message dialog has crisp text, a modern-looking button, and an icon.