summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-06-15 23:06:12 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-06-15 23:06:12 +0300
commit751824c60f37e2c268fbd54deba8fccc30034436 (patch)
tree4dcf1b10de51584255fdab709853cee9ec6b0cea /src
parenta984e6c6faa433370386365607b8a6bde8ae325f (diff)
DpiAware option moved to Windows-specific code in mir_core.dll
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/modules.cpp7
-rw-r--r--src/mir_app/src/newplugins.cpp1
-rw-r--r--src/mir_core/mir_core.vcxproj.filters6
-rw-r--r--src/mir_core/src/Windows/CDlgBase.cpp7
-rw-r--r--src/mir_core/src/Windows/miranda.cpp12
-rw-r--r--src/mir_core/src/miranda.h1
6 files changed, 20 insertions, 14 deletions
diff --git a/src/mir_app/src/modules.cpp b/src/mir_app/src/modules.cpp
index e8dd32dfb2..0fb5de49e5 100644
--- a/src/mir_app/src/modules.cpp
+++ b/src/mir_app/src/modules.cpp
@@ -90,13 +90,6 @@ int LoadDefaultModules(void)
// load database drivers & service plugins without executing their Load()
if (LoadNewPluginsModuleInfos()) return 1;
- if (GetPrivateProfileInt(L"Interface", L"DpiAware", 0, mirandabootini) == 1) {
- typedef BOOL (WINAPI *SetProcessDPIAware_t)(void);
- SetProcessDPIAware_t pfn = (SetProcessDPIAware_t)GetProcAddress(GetModuleHandleW(L"user32"), "SetProcessDPIAware");
- if (pfn != nullptr)
- pfn();
- }
-
// the database will select which db plugin to use, or fail if no profile is selected
if (LoadDatabaseModule()) return 1;
if (LoadNetlibModule()) return 1;
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index 7ff6548751..301ef162d4 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -774,7 +774,6 @@ static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM)
int LoadNewPluginsModuleInfos(void)
{
bModuleInitialized = true;
- DeleteFile(L"mir_core.dll");
hevLoadModule = CreateHookableEvent(ME_SYSTEM_MODULELOAD);
hevUnloadModule = CreateHookableEvent(ME_SYSTEM_MODULEUNLOAD);
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