Skip to content

Commit

Permalink
fix Win7/8 resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Filtik authored and Hoikas committed May 1, 2024
1 parent c506969 commit 9ed9c40
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 UINT(float(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(float(ydpi));
}

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

0 comments on commit 9ed9c40

Please sign in to comment.