0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

UI: Fix screen resolution for canvas size

In #3988, @RytoEx mentioned that the recent Qt upgrade to 5.15.2
introduced a regression in which Qt begins returning DPI/scaling
aware resolutions for each screen. While this was fixed for
new profiles, this was not reflected in the choice for the
Canvas (Base) Resolution in the Settings screen yet.

This commits fixes this issue, and calculates the correct
physical screen size again, respecting per-screen DPI scaling.
This commit is contained in:
Nirusu 2021-02-12 21:50:40 +01:00 committed by Jim
parent e64c61710f
commit 2787e63d8e

View File

@ -1563,7 +1563,15 @@ void OBSBasicSettings::LoadResolutionLists()
for (QScreen *screen : QGuiApplication::screens()) {
QSize as = screen->size();
addRes(as.width(), as.height());
uint32_t as_width = as.width();
uint32_t as_height = as.height();
// Calculate physical screen resolution based on the virtual screen resolution
// They might differ if scaling is enabled, e.g. for HiDPI screens
as_width = round(as_width * screen->devicePixelRatio());
as_height = round(as_height * screen->devicePixelRatio());
addRes(as_width, as_height);
}
addRes(1920, 1080);