Fix DPI functions are link to system libraries directly.

Forgot to change them during refactor.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-10-25 11:26:06 +08:00
parent 1c0e4a4657
commit 10876e6f0b
1 changed files with 26 additions and 27 deletions

View File

@ -798,9 +798,9 @@ BOOL IsApplicationDpiAware()
{ {
if (coreData()->m_lpGetProcessDpiAwareness) { if (coreData()->m_lpGetProcessDpiAwareness) {
PROCESS_DPI_AWARENESS awareness = PROCESS_DPI_UNAWARE; PROCESS_DPI_AWARENESS awareness = PROCESS_DPI_UNAWARE;
WNEF_EXECUTE_WINAPI(GetProcessDpiAwareness, coreData()->m_lpGetProcessDpiAwareness(WNEF_EXECUTE_WINAPI_RETURN(GetCurrentProcess,
WNEF_EXECUTE_WINAPI_RETURN(GetCurrentProcess, nullptr), nullptr),
&awareness) &awareness);
return (awareness != PROCESS_DPI_UNAWARE); return (awareness != PROCESS_DPI_UNAWARE);
} else { } else {
return WNEF_EXECUTE_WINAPI_RETURN(IsProcessDPIAware, FALSE); return WNEF_EXECUTE_WINAPI_RETURN(IsProcessDPIAware, FALSE);
@ -843,12 +843,11 @@ UINT GetDotsPerInchForSystem()
return defaultValue; return defaultValue;
}; };
if (coreData()->m_lpGetSystemDpiForProcess) { if (coreData()->m_lpGetSystemDpiForProcess) {
return WNEF_EXECUTE_WINAPI_RETURN(GetSystemDpiForProcess, return coreData()->m_lpGetSystemDpiForProcess(
0,
WNEF_EXECUTE_WINAPI_RETURN(GetCurrentProcess, nullptr)); WNEF_EXECUTE_WINAPI_RETURN(GetCurrentProcess, nullptr));
} }
if (coreData()->m_lpGetDpiForSystem) { if (coreData()->m_lpGetDpiForSystem) {
return WNEF_EXECUTE_WINAPI_RETURN(GetDpiForSystem, 0); return coreData()->m_lpGetDpiForSystem();
} }
return getScreenDpi(m_defaultDotsPerInch); return getScreenDpi(m_defaultDotsPerInch);
} }
@ -862,18 +861,17 @@ UINT GetDotsPerInchForWindow(const HWND handle)
} }
if (WNEF_EXECUTE_WINAPI_RETURN(IsWindow, FALSE, handle)) { if (WNEF_EXECUTE_WINAPI_RETURN(IsWindow, FALSE, handle)) {
if (coreData()->m_lpGetDpiForWindow) { if (coreData()->m_lpGetDpiForWindow) {
return WNEF_EXECUTE_WINAPI_RETURN(GetDpiForWindow, 0, handle); return coreData()->m_lpGetDpiForWindow(handle);
} }
if (coreData()->m_lpGetDpiForMonitor) { if (coreData()->m_lpGetDpiForMonitor) {
UINT dpiX = m_defaultDotsPerInch, dpiY = m_defaultDotsPerInch; UINT dpiX = m_defaultDotsPerInch, dpiY = m_defaultDotsPerInch;
WNEF_EXECUTE_WINAPI(GetDpiForMonitor, coreData()->m_lpGetDpiForMonitor(WNEF_EXECUTE_WINAPI_RETURN(MonitorFromWindow,
WNEF_EXECUTE_WINAPI_RETURN(MonitorFromWindow,
nullptr, nullptr,
handle, handle,
MONITOR_DEFAULTTONEAREST), MONITOR_DEFAULTTONEAREST),
MDT_EFFECTIVE_DPI, MDT_EFFECTIVE_DPI,
&dpiX, &dpiX,
&dpiY) &dpiY);
// The values of *dpiX and *dpiY are identical. // The values of *dpiX and *dpiY are identical.
return dpiX == dpiY ? dpiY : dpiX; return dpiX == dpiY ? dpiY : dpiX;
} }
@ -950,12 +948,15 @@ RECT GetFrameSizeForWindow(const HWND handle, const BOOL includingTitleBar = FAL
// It's the same with using GetSystemMetrics, the returned values // It's the same with using GetSystemMetrics, the returned values
// of the two functions are identical. // of the two functions are identical.
if (coreData()->m_lpAdjustWindowRectExForDpi) { if (coreData()->m_lpAdjustWindowRectExForDpi) {
WNEF_EXECUTE_WINAPI(AdjustWindowRectExForDpi, coreData()->m_lpAdjustWindowRectExForDpi(&rect,
&rect, includingTitleBar ? (style | WS_CAPTION)
includingTitleBar ? (style | WS_CAPTION) : (style & ~WS_CAPTION), : (style & ~WS_CAPTION),
FALSE, FALSE,
WNEF_EXECUTE_WINAPI_RETURN(GetWindowLongPtrW, 0, handle, GWL_EXSTYLE), WNEF_EXECUTE_WINAPI_RETURN(GetWindowLongPtrW,
GetDotsPerInchForWindow(handle)) 0,
handle,
GWL_EXSTYLE),
GetDotsPerInchForWindow(handle));
} else { } else {
WNEF_EXECUTE_WINAPI(AdjustWindowRectEx, WNEF_EXECUTE_WINAPI(AdjustWindowRectEx,
&rect, &rect,
@ -1031,9 +1032,7 @@ int GetSystemMetricsForWindow(const HWND handle, const int index)
Q_ASSERT(handle); Q_ASSERT(handle);
if (WNEF_EXECUTE_WINAPI_RETURN(IsWindow, FALSE, handle)) { if (WNEF_EXECUTE_WINAPI_RETURN(IsWindow, FALSE, handle)) {
if (coreData()->m_lpGetSystemMetricsForDpi) { if (coreData()->m_lpGetSystemMetricsForDpi) {
return WNEF_EXECUTE_WINAPI_RETURN(GetSystemMetricsForDpi, return coreData()->m_lpGetSystemMetricsForDpi(index,
0,
index,
static_cast<UINT>(qRound(GetPreferedNumber( static_cast<UINT>(qRound(GetPreferedNumber(
GetDotsPerInchForWindow(handle))))); GetDotsPerInchForWindow(handle)))));
} else { } else {