1
0
mirror of synced 2025-01-10 21:41:53 +01:00

impr: Moved Windows DPI awareness to manifest file, added detached console allocation

Closes #1543
This commit is contained in:
WerWolv 2024-12-28 23:47:42 +01:00
parent f79de6fbe8
commit 6a5473f6fe
3 changed files with 11 additions and 16 deletions

View File

@ -397,22 +397,6 @@ namespace hex {
void Window::initNative() {
// Setup DPI Awareness
{
using SetProcessDpiAwarenessContextFunc = HRESULT(WINAPI *)(DPI_AWARENESS_CONTEXT);
SetProcessDpiAwarenessContextFunc setProcessDpiAwarenessContext =
reinterpret_cast<SetProcessDpiAwarenessContextFunc>(
reinterpret_cast<void*>(
GetProcAddress(GetModuleHandleW(L"user32.dll"), "SetProcessDpiAwarenessContext")
)
);
if (setProcessDpiAwarenessContext != nullptr) {
setProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
}
}
if (ImHexApi::System::isDebugBuild()) {
// If the application is running in debug mode, ImHex runs under the CONSOLE subsystem,
// so we don't need to do anything besides enabling ANSI colors

10
resources/dist/windows/imhex.manifest vendored Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<application>
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
<consoleAllocationPolicy xmlns="http://schemas.microsoft.com/SMI/2024/WindowsSettings">detached</consoleAllocationPolicy>
</windowsSettings>
</application>
</assembly>

View File

@ -1,6 +1,7 @@
#pragma code_page(65001)
GLFW_ICON ICON dist/windows/icon.ico
1 24 "dist/windows/imhex.manifest"
1 VERSIONINFO
FILEVERSION PROJECT_VERSION_MAJOR,PROJECT_VERSION_MINOR,PROJECT_VERSION_PATCH