diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2022-11-04 16:45:43 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2022-11-04 16:49:01 +0000 |
| commit | 42c6af091440e89be9c0d8895a1c5ff1caac5427 (patch) | |
| tree | 42cdaf7055e212bfcfab4c432efaf6f3f3ccd64a /wayland.c | |
| parent | wayland: use fp math all the way when calculating DPI (diff) | |
wayland: force monitor DPI to 96 when it’s unreasonably high
If an output has a bogus physical width or height, the DPI can become
so high that the cell width/height is too large for
pixman_image_fill_rectangles(), resulting in a crash in pixman_fill().
Since it doesn’t make any sense to use a DPI that is obviously bogus,
don’t. Force it 96 instead.
Diffstat (limited to 'wayland.c')
| -rw-r--r-- | wayland.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -409,6 +409,14 @@ output_update_ppi(struct monitor *mon) double px_diag = sqrt(pow(scaled_width, 2) + pow(scaled_height, 2)); mon->dpi = px_diag / mon->inch * mon->scale; + + if (mon->dpi > 1000) { + if (mon->name != NULL) { + LOG_WARN("%s: DPI=%f is unreasonable, using 96 instead", + mon->name, mon->dpi); + } + mon->dpi = 96; + } } static void |
