Skip to content

Commit

Permalink
Merge pull request musescore#17759 from laarmen/default-dpi-broken-sc…
Browse files Browse the repository at this point in the history
…reens

uiconfiguration: fix DPI for bad screen metadata
  • Loading branch information
RomanPudashkin committed Jul 6, 2023
2 parents 9bc47d3 + 886ca9e commit 2f0cc6f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/framework/ui/internal/uiconfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,16 @@ double UiConfiguration::physicalDpi() const
return m_customDPI.value();
}

constexpr double DEFAULT_DPI = 96;
const QScreen* screen = mainWindow() ? mainWindow()->screen() : nullptr;
if (!screen) {
constexpr double DEFAULT_DPI = 96;
return DEFAULT_DPI;
}

auto physicalSize = screen->physicalSize();
// Work around xrandr reporting a 1x1mm size if
// the screen doesn't have a valid physical size
if (physicalSize.height() <= 1 && physicalSize.width() <= 1) {
return DEFAULT_DPI;
}

Expand Down

0 comments on commit 2f0cc6f

Please sign in to comment.