Skip to content

Improper rounding of DPI value

Submitted by sim..@..dig.de

Assigned to Nick Schermer

Link to original bug (#12353)

Description

There is a roudning error when calculating the dpi value for a screen.

In xsettings.c / xfce_xsettings_helper_screen_dpi() the calculation of width_dpi / height_dpi lacks rounding.

Tools like xdpyinfo use rounding for presenting the dpi value. In some corner cases this has the effect that "overriding" the dpi value within xfce-settings with the same value as reported by xdpyinfo results in changing font sizes.

  width_dpi =  (int) ((25.4 * WidthOfScreen  (xscreen)) / width_mm  + 0.5);
  height_dpi = (int) ((25.4 * HeightOfScreen (xscreen)) / height_mm + 0.5);