mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 15:13:13 -04:00
On X11, reload DPI on _XSETTINGS_SETTINGS
This also fixes the deadlock when such reload may happen. Fixes: #3383 Signed-off-by: John Nunley <dev@notgull.net> Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
@@ -38,6 +38,15 @@ pub fn calc_dpi_factor(
|
||||
impl XConnection {
|
||||
// Retrieve DPI from Xft.dpi property
|
||||
pub fn get_xft_dpi(&self) -> Option<f64> {
|
||||
// Try to get it from XSETTINGS first.
|
||||
match self.xsettings_dpi() {
|
||||
Ok(Some(dpi)) => return Some(dpi),
|
||||
Ok(None) => {}
|
||||
Err(err) => {
|
||||
log::warn!("failed to fetch XSettings: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
self.database()
|
||||
.get_string("Xft.dpi", "")
|
||||
.and_then(|s| f64::from_str(s).ok())
|
||||
|
||||
Reference in New Issue
Block a user