Add default for X servers that return DPI 0 and round the result as does Mozilla.

This commit is contained in:
Tomeu Vizoso 2007-02-22 12:07:20 +01:00
parent 1b5ac988d7
commit 1d02002719

View File

@ -17,9 +17,11 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#include <math.h> #include <stdlib.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include "sugar-utils.h"
gint gint
sugar_get_screen_dpi(void) sugar_get_screen_dpi(void)
{ {
@ -27,8 +29,8 @@ sugar_get_screen_dpi(void)
if (val) { if (val) {
char *e; char *e;
double d = strtod(val, &e); double d = strtod(val, &e);
if (e != val) if (d > 0.0)
return round(d); return (int)(d+0.5);
} }
return 96; return 96;