Skip to content

Commit

Permalink
Merge pull request #1580 from Filtik/master
Browse files Browse the repository at this point in the history
fix Win7/8 resolution
  • Loading branch information
Hoikas committed May 2, 2024
2 parents c506969 + 12d51af commit f865f41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Plasma/PubUtilLib/plWinDpi/plWinDpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ UINT plWinDpi::GetDpi(HWND hWnd) const
auto dpiForMonitor = fGetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY);
if (dpiForMonitor.has_value()) {
if (SUCCEEDED(dpiForMonitor.value()))
return UINT(float(dpiY) / 96.0f);
return dpiY;
LogRed("Per-Monitor DPI failed: {}", hsCOMError(dpiForMonitor.value()));
}

// Legacy DPI computation... This is both slow and lacks much knowledge about DPI.
HDC hdc = GetDC(hWnd);
int ydpi = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(hWnd, hdc);
return UINT(float(ydpi) / 96.0f);
return UINT(ydpi);
}

int plWinDpi::GetSystemMetrics(int nIndex, std::variant<UINT, HWND, std::monostate> dpiArg) const
Expand Down

0 comments on commit f865f41

Please sign in to comment.