Skip to content

Commit

Permalink
Extract the manifest from main and add dpiAware=false setting
Browse files Browse the repository at this point in the history
Forcing the application to dpi unware status allows Windows to apply
the window scaling set by the user in the control panel. Icons and bitmaps
that were previously too small to be usable are now scaled suitably.
Other platforms are unaffected by this change.
Refs mantidproject#19078
  • Loading branch information
martyngigg committed Mar 7, 2017
1 parent 310ec4d commit d4da3ef
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 17 deletions.
6 changes: 5 additions & 1 deletion MantidPlot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,11 @@ set ( MOCCED_FILES ${MOCCED_FILES} ${CMAKE_CURRENT_BINARY_DIR}/qtcolorpicker.moc

set ( SRC_FILES ${QTIPLOT_SRCS} ${MANTID_SRCS} ${SIP_SRC} )
set ( INC_FILES ${QTIPLOT_HDRS} ${MANTID_HDRS} )
set ( ALL_SRC ${SRC_FILES} ${MOCCED_FILES} )
if ( WIN32 )
set ( MANIFEST_FILES MantidPlot.manifest )
endif ()

set ( ALL_SRC ${SRC_FILES} ${MOCCED_FILES} ${MANIFEST_FILES} )

# Use a precompiled header where they are supported
enable_precompiled_headers( src/PrecompiledHeader.h ALL_SRC )
Expand Down
35 changes: 35 additions & 0 deletions MantidPlot/MantidPlot.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0' xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
<!--
MantidPlot embeds a Python interpreter which depends on MSVCRT90.dll.
Extension modules
can also depend on the same runtime but it exists in the SxS system folder.
Even though Python27.dll loads the runtime correctly there is an issue that extension
modules
using ctypes.cdll.LoadLibrary don't consult the SxS registry and fail to load
the correct
runtime library. See for example zmq.
For more information see https://bugs.python.org/issue24429 -->
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='amd64' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
<!--
MantidPlot is not DPI aware and we need Windows to apply the user-defined scaling factor.
The documentation claims that dpi unaware is the default but without this setting
appears to be set to SystemAware when viewed with Process Explorer.
https://blogs.msdn.microsoft.com/chuckw/2013/09/10/manifest-madness/ -->
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>false</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
16 changes: 0 additions & 16 deletions MantidPlot/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,6 @@ only one class per file, with the exception of
the indentation depth for him/herself.
*/

#if defined(_MSC_VER)
// MantidPlot embeds a Python interpreter which depends on MSVCRT90.dll.
// Extension modules
// can also depend on the same runtime but it exists in the SxS system folder.
// Even though
// Python27.dll loads the runtime correctly there is an issue that extension
// modules
// using ctypes.cdll.LoadLibrary don't consult the SxS registry and fail to load
// the correct
// runtime library. See for example zmq.
// For more information see https://bugs.python.org/issue24429
#pragma comment( \
linker, \
"\"/manifestdependency:type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='amd64' publicKeyToken='1fc8b3b9a1e18e3b'\"")
#endif

int main(int argc, char **argv) {
// First, look for command-line arguments that we want to deal with before
// launching anything
Expand Down

0 comments on commit d4da3ef

Please sign in to comment.