Skip to content

Commit 5121f07

Browse files
authored
[GEN][ZH] Add Windows application manifest to tell Windows that the App is DPI aware (#595)
1 parent cc0e461 commit 5121f07

File tree

6 files changed

+74
-0
lines changed

6 files changed

+74
-0
lines changed

Generals/Code/Main/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ target_sources(g_generals PRIVATE
6969
)
7070

7171
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
72+
# VS2005 and later adds default manifest, we need to turn it off to prevent conflict with custom manifest
73+
if(NOT IS_VS6_BUILD)
74+
target_link_options(g_generals PRIVATE
75+
"/MANIFEST:NO"
76+
)
77+
endif()
78+
7279
target_sources(g_generals PRIVATE
7380
RTS.RC
7481
)

Generals/Code/Main/RTS.RC

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ IDB_LOAD_SCREEN BITMAP DISCARDABLE "Install_Final.bmp"
6565
#endif // English (U.S.) resources
6666
/////////////////////////////////////////////////////////////////////////////
6767

68+
// Add manifest to specify that the app is DPI aware and prevent forced scaling by the system
69+
1 24 "app.manifest"
6870

6971

7072
#ifndef APSTUDIO_INVOKED

Generals/Code/Main/app.manifest

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
3+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
4+
<security>
5+
<requestedPrivileges>
6+
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
7+
</requestedPrivileges>
8+
</security>
9+
</trustInfo>
10+
<dependency>
11+
<dependentAssembly>
12+
<assemblyIdentity
13+
type="win32"
14+
name="Microsoft.Windows.Common-Controls"
15+
version="6.0.0.0"
16+
processorArchitecture="*"
17+
publicKeyToken="6595b64144ccf1df"
18+
language="*"
19+
/>
20+
</dependentAssembly>
21+
</dependency>
22+
<asmv3:application>
23+
<asmv3:windowsSettings>
24+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
25+
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
26+
</asmv3:windowsSettings>
27+
</asmv3:application>
28+
</assembly>

GeneralsMD/Code/Main/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ target_sources(z_generals PRIVATE
5959
)
6060

6161
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
62+
# VS2005 and later adds default manifest, we need to turn it off to prevent conflict with custom manifest
63+
if(NOT IS_VS6_BUILD)
64+
target_link_options(z_generals PRIVATE
65+
"/MANIFEST:NO"
66+
)
67+
endif()
68+
6269
target_sources(z_generals PRIVATE
6370
RTS.RC
6471
)

GeneralsMD/Code/Main/RTS.RC

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ IDI_ApplicationIcon ICON DISCARDABLE "GENERALS.ICO"
5858
#endif // English (U.S.) resources
5959
/////////////////////////////////////////////////////////////////////////////
6060

61+
// Add manifest to specify that the app is DPI aware and prevent forced scaling by the system
62+
1 24 "app.manifest"
6163

6264

6365
#ifndef APSTUDIO_INVOKED

GeneralsMD/Code/Main/app.manifest

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
3+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
4+
<security>
5+
<requestedPrivileges>
6+
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
7+
</requestedPrivileges>
8+
</security>
9+
</trustInfo>
10+
<dependency>
11+
<dependentAssembly>
12+
<assemblyIdentity
13+
type="win32"
14+
name="Microsoft.Windows.Common-Controls"
15+
version="6.0.0.0"
16+
processorArchitecture="*"
17+
publicKeyToken="6595b64144ccf1df"
18+
language="*"
19+
/>
20+
</dependentAssembly>
21+
</dependency>
22+
<asmv3:application>
23+
<asmv3:windowsSettings>
24+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
25+
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
26+
</asmv3:windowsSettings>
27+
</asmv3:application>
28+
</assembly>

0 commit comments

Comments
 (0)