Skip to content

fix: fall back to default DPI when GTK returns 0 on Linux#50489

Merged
jkleinsc merged 1 commit into41-x-yfrom
trop/41-x-y-bp-fix-fall-back-to-default-dpi-when-gtk-returns-0-on-linux-1774460280864
Mar 26, 2026
Merged

fix: fall back to default DPI when GTK returns 0 on Linux#50489
jkleinsc merged 1 commit into41-x-yfrom
trop/41-x-y-bp-fix-fall-back-to-default-dpi-when-gtk-returns-0-on-linux-1774460280864

Conversation

@trop
Copy link
Copy Markdown
Contributor

@trop trop bot commented Mar 25, 2026

Backport of #50453

See that PR for details.

Notes: none.

GetDefaultPrinterDPI() creates a blank GtkPrintSettings and reads
its resolution, which returns 0 for uninitialized settings. With
DPI=0, SetPrintableAreaIfValid() computes a zero scale factor,
producing empty page dimensions that fail PrintMsgPrintParamsIsValid().

Fall back to kDefaultPdfDpi (72) when GTK returns 0, matching the
existing Windows fallback pattern when CreateDC fails.

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
@trop trop bot requested review from a team and codebytere March 25, 2026 17:38
@trop trop bot added 41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Mar 25, 2026
@jkleinsc jkleinsc merged commit 707541d into 41-x-y Mar 26, 2026
98 of 104 checks passed
@jkleinsc jkleinsc deleted the trop/41-x-y-bp-fix-fall-back-to-default-dpi-when-gtk-returns-0-on-linux-1774460280864 branch March 26, 2026 13:17
@release-clerk
Copy link
Copy Markdown

release-clerk bot commented Mar 26, 2026

No Release Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant