diff options
author | George Hazan <ghazan@miranda.im> | 2022-06-15 23:06:12 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-06-15 23:06:12 +0300 |
commit | 751824c60f37e2c268fbd54deba8fccc30034436 (patch) | |
tree | 4dcf1b10de51584255fdab709853cee9ec6b0cea /src/mir_core | |
parent | a984e6c6faa433370386365607b8a6bde8ae325f (diff) |
DpiAware option moved to Windows-specific code in mir_core.dll
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/mir_core.vcxproj.filters | 6 | ||||
-rw-r--r-- | src/mir_core/src/Windows/CDlgBase.cpp | 7 | ||||
-rw-r--r-- | src/mir_core/src/Windows/miranda.cpp | 12 | ||||
-rw-r--r-- | src/mir_core/src/miranda.h | 1 |
4 files changed, 20 insertions, 6 deletions
diff --git a/src/mir_core/mir_core.vcxproj.filters b/src/mir_core/mir_core.vcxproj.filters index 958ae40b4e..3a4bd83508 100644 --- a/src/mir_core/mir_core.vcxproj.filters +++ b/src/mir_core/mir_core.vcxproj.filters @@ -184,9 +184,6 @@ </ClCompile>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="src\miranda.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -199,6 +196,9 @@ <ClInclude Include="src\Windows\diatheme.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\miranda.h">
+ <Filter>Source Files\Windows</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\version.rc">
diff --git a/src/mir_core/src/Windows/CDlgBase.cpp b/src/mir_core/src/Windows/CDlgBase.cpp index 91b5237884..6eca57b417 100644 --- a/src/mir_core/src/Windows/CDlgBase.cpp +++ b/src/mir_core/src/Windows/CDlgBase.cpp @@ -46,10 +46,11 @@ static int CompareTimerId(const CTimer *t1, const CTimer *t2) return t1->GetEventId() - t2->GetEventId(); } -CDlgBase::CDlgBase(CMPluginBase &pPlug, int idDialog) - : m_controls(1, CompareControlId), +CDlgBase::CDlgBase(CMPluginBase &pPlug, int idDialog) : + m_controls(1, CompareControlId), m_timers(1, CompareTimerId), - m_pPlugin(pPlug) + m_pPlugin(pPlug), + m_bFixedSize(!g_bEnableDpiAware) { m_idDialog = idDialog; m_autoClose = CLOSE_ON_OK | CLOSE_ON_CANCEL; diff --git a/src/mir_core/src/Windows/miranda.cpp b/src/mir_core/src/Windows/miranda.cpp index aea24d96d8..a00eb3d448 100644 --- a/src/mir_core/src/Windows/miranda.cpp +++ b/src/mir_core/src/Windows/miranda.cpp @@ -47,6 +47,7 @@ HANDLE hShutdownEvent, hPreShutdownEvent; uint32_t mir_tls = 0; static bool g_bMirandaTerminated = false; +bool g_bEnableDpiAware = false; MIR_CORE_DLL(bool) Miranda_IsTerminated() { @@ -254,6 +255,17 @@ MIR_CORE_DLL(void) BeginMessageLoop() bufferedPaintUninit = (pfnBufferedPaintUninit)GetProcAddress(hThemeAPI, "BufferedPaintUninit"); } + wchar_t wszIniPath[MAX_PATH]; + PathToAbsoluteW(L"mirandaboot.ini", wszIniPath); + if (GetPrivateProfileIntW(L"Interface", L"DpiAware", 0, wszIniPath) == 1) { + typedef BOOL (WINAPI *pfnSetProcessDPIAware_t)(void); + auto *pFunc = (pfnSetProcessDPIAware_t)GetProcAddress(GetModuleHandleW(L"user32"), "SetProcessDPIAware"); + if (pFunc != nullptr) + pFunc(); + + g_bEnableDpiAware = true; + } + if (bufferedPaintInit) bufferedPaintInit(); diff --git a/src/mir_core/src/miranda.h b/src/mir_core/src/miranda.h index 24a15d0af9..7264f27444 100644 --- a/src/mir_core/src/miranda.h +++ b/src/mir_core/src/miranda.h @@ -35,6 +35,7 @@ extern HINSTANCE g_hInst; extern HWND hAPCWindow; extern HANDLE hThreadQueueEmpty; extern HCURSOR g_hCursorNS, g_hCursorWE; +extern bool g_bEnableDpiAware; ///////////////////////////////////////////////////////////////////////////////////////// // modules.cpp |