mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-23 02:16:33 +11:00
On X11, if RANDR based scale factor is higher than 20 reset it to 1
Some video drivers could set display metrics to odd values, which can result in extra large scale factors (e.g. winit is sending 720 for 5k screen on nvidia binary drivers), so let's just drop them to prevent clients from using them. The value 20 was picked, because the DPR for 8k @ 5 inch is ~18.36. Fixes #1983.
This commit is contained in:
parent
9768f73bb7
commit
b4774861db
2 changed files with 6 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
|||
- On Wayland, bump `smithay-client-toolkit` to 0.15.1.
|
||||
- On Wayland, implement `request_user_attention` with `xdg_activation_v1`.
|
||||
- On X11, emit missing `WindowEvent::ScaleFactorChanged` when the only monitor gets reconnected.
|
||||
- On X11, if RANDR based scale factor is higher than 20 reset it to 1
|
||||
|
||||
# 0.25.0 (2021-05-15)
|
||||
|
||||
|
|
|
@ -27,7 +27,11 @@ pub fn calc_dpi_factor(
|
|||
// Quantize 1/12 step size
|
||||
let dpi_factor = ((ppmm * (12.0 * 25.4 / 96.0)).round() / 12.0).max(1.0);
|
||||
assert!(validate_scale_factor(dpi_factor));
|
||||
dpi_factor
|
||||
if dpi_factor <= 20. {
|
||||
dpi_factor
|
||||
} else {
|
||||
1.
|
||||
}
|
||||
}
|
||||
|
||||
impl XConnection {
|
||||
|
|
Loading…
Add table
Reference in a new issue