Skip to content

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

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

fix: fall back to default DPI when GTK returns 0 on Linux#50488
jkleinsc merged 1 commit into40-x-yfrom
trop/40-x-y-bp-fix-fall-back-to-default-dpi-when-gtk-returns-0-on-linux-1774460278142

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 40-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Mar 25, 2026
@jkleinsc jkleinsc merged commit 904fbbd into 40-x-y Mar 26, 2026
148 of 154 checks passed
@jkleinsc jkleinsc deleted the trop/40-x-y-bp-fix-fall-back-to-default-dpi-when-gtk-returns-0-on-linux-1774460278142 branch March 26, 2026 15:47
@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

40-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