On X11, don't require XSETTINGS

We could fail to setup property watcher and fail to start, thus
don't require XSETTINGS to work.

Fixes: df8805c0 (On X11, reload DPI on _XSETTINGS_SETTINGS)
This commit is contained in:
Kirill Chibisov 2024-02-10 00:24:03 +04:00 committed by GitHub
parent 4112fccc12
commit d1902aa15a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 57 additions and 43 deletions

View file

@ -39,11 +39,13 @@ 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}");
if let Some(xsettings_screen) = self.xsettings_screen() {
match self.xsettings_dpi(xsettings_screen) {
Ok(Some(dpi)) => return Some(dpi),
Ok(None) => {}
Err(err) => {
log::warn!("failed to fetch XSettings: {err}");
}
}
}